mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-05-06 01:18:23 +02:00
utils: rename the sources close behavior for extra clarity
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
8a0bec7b87
commit
261f8c910b
1 changed files with 6 additions and 6 deletions
|
|
@ -40,9 +40,9 @@ struct sink {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum source_close_behavior {
|
enum source_close_behavior {
|
||||||
SOURCE_CLOSE_ON_REMOVE = 1, /* default */
|
SOURCE_CLOSE_FD_ON_REMOVE = 1, /* default */
|
||||||
SOURCE_CLOSE_ON_DESTROY,
|
SOURCE_CLOSE_FD_ON_DESTROY,
|
||||||
SOURCE_CLOSE_NEVER,
|
SOURCE_CLOSE_FD_NEVER,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct source {
|
struct source {
|
||||||
|
|
@ -70,7 +70,7 @@ source_remove(struct source *source)
|
||||||
{
|
{
|
||||||
if (source->fd != -1) {
|
if (source->fd != -1) {
|
||||||
epoll_ctl(source->sink->epollfd, EPOLL_CTL_DEL, source->fd, NULL);
|
epoll_ctl(source->sink->epollfd, EPOLL_CTL_DEL, source->fd, NULL);
|
||||||
if (source->close_behavior == SOURCE_CLOSE_ON_REMOVE)
|
if (source->close_behavior == SOURCE_CLOSE_FD_ON_REMOVE)
|
||||||
source->fd = xclose(source->fd);
|
source->fd = xclose(source->fd);
|
||||||
}
|
}
|
||||||
/* Note: epollfd was the owner of the source, new owner is the removed
|
/* Note: epollfd was the owner of the source, new owner is the removed
|
||||||
|
|
@ -85,7 +85,7 @@ source_destroy(struct source *source)
|
||||||
{
|
{
|
||||||
if (source->fd != -1) {
|
if (source->fd != -1) {
|
||||||
source_remove(source);
|
source_remove(source);
|
||||||
if (source->close_behavior == SOURCE_CLOSE_ON_DESTROY)
|
if (source->close_behavior == SOURCE_CLOSE_FD_ON_DESTROY)
|
||||||
source->fd = xclose(source->fd);
|
source->fd = xclose(source->fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -126,7 +126,7 @@ source_add_autoclose(struct sink *sink, int sourcefd,
|
||||||
source_dispatch_t dispatch,
|
source_dispatch_t dispatch,
|
||||||
void *user_data)
|
void *user_data)
|
||||||
{
|
{
|
||||||
return source_add(sink, sourcefd, dispatch, user_data, SOURCE_CLOSE_ON_REMOVE);
|
return source_add(sink, sourcefd, dispatch, user_data, SOURCE_CLOSE_FD_ON_REMOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue