Do not use efl as a prefix for variables
Renamed efl_fd to fd_obj.
This commit is contained in:
parent
792db6f59b
commit
d022796a35
|
@ -29,18 +29,18 @@ _print_loop(Efl_Loop *loop, const char *label)
|
||||||
static void
|
static void
|
||||||
_read_fd_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
_read_fd_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
{
|
{
|
||||||
Efl_Loop_Fd *efl_fd;
|
Efl_Loop_Fd *fd_obj;
|
||||||
char buf[7];
|
char buf[7];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
efl_fd = event->object;
|
fd_obj = event->object;
|
||||||
|
|
||||||
len = read(efl_loop_fd_file_get(efl_fd), &buf, sizeof(buf));
|
len = read(efl_loop_fd_file_get(fd_obj), &buf, sizeof(buf));
|
||||||
|
|
||||||
// here we are exiting
|
// here we are exiting
|
||||||
if (len <= 0)
|
if (len <= 0)
|
||||||
{
|
{
|
||||||
efl_del(efl_fd);
|
efl_del(fd_obj);
|
||||||
unlink(FILENAME);
|
unlink(FILENAME);
|
||||||
|
|
||||||
efl_exit(0);
|
efl_exit(0);
|
||||||
|
@ -48,68 +48,68 @@ _read_fd_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
}
|
}
|
||||||
|
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
printf("Reading from: %s\n", efl_name_get(efl_fd));
|
printf("Reading from: %s\n", efl_name_get(fd_obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_write_fd_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
_write_fd_cb(void *data EINA_UNUSED, const Efl_Event *event)
|
||||||
{
|
{
|
||||||
Efl_Loop_Fd *efl_fd;
|
Efl_Loop_Fd *fd_obj;
|
||||||
static int _count = 0;
|
static int _count = 0;
|
||||||
|
|
||||||
efl_fd = event->object;
|
fd_obj = event->object;
|
||||||
|
|
||||||
// we have output all we wanted, remove the write handler
|
// we have output all we wanted, remove the write handler
|
||||||
// and start checking for read availability instead
|
// and start checking for read availability instead
|
||||||
if (_count >= 5)
|
if (_count >= 5)
|
||||||
{
|
{
|
||||||
efl_del(efl_fd);
|
efl_del(fd_obj);
|
||||||
|
|
||||||
_read_fd_create();
|
_read_fd_create();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_count++;
|
_count++;
|
||||||
printf("Writing to: %s\n", efl_name_get(efl_fd));
|
printf("Writing to: %s\n", efl_name_get(fd_obj));
|
||||||
write(efl_loop_fd_file_get(efl_fd), eina_slstr_printf("TEST %d\n", _count), 7);
|
write(efl_loop_fd_file_get(fd_obj), eina_slstr_printf("TEST %d\n", _count), 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_write_fd_create()
|
_write_fd_create()
|
||||||
{
|
{
|
||||||
Efl_Loop_Fd *efl_fd;
|
Efl_Loop_Fd *fd_obj;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
efl_fd = efl_add(EFL_LOOP_FD_CLASS, NULL,
|
fd_obj = efl_add(EFL_LOOP_FD_CLASS, NULL,
|
||||||
efl_name_set(efl_added, "Write FD"));
|
efl_name_set(efl_added, "Write FD"));
|
||||||
|
|
||||||
efl_event_callback_add(efl_fd, EFL_LOOP_FD_EVENT_WRITE, _write_fd_cb, NULL);
|
efl_event_callback_add(fd_obj, EFL_LOOP_FD_EVENT_WRITE, _write_fd_cb, NULL);
|
||||||
|
|
||||||
file = fopen(FILENAME, "w+");
|
file = fopen(FILENAME, "w+");
|
||||||
fd = fileno(file);
|
fd = fileno(file);
|
||||||
|
|
||||||
printf("Opened file %s with fd %d\n", FILENAME, fd);
|
printf("Opened file %s with fd %d\n", FILENAME, fd);
|
||||||
efl_loop_fd_file_set(efl_fd, fd);
|
efl_loop_fd_file_set(fd_obj, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_read_fd_create()
|
_read_fd_create()
|
||||||
{
|
{
|
||||||
Efl_Loop_Fd *efl_fd;
|
Efl_Loop_Fd *fd_obj;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
efl_fd = efl_add(EFL_LOOP_FD_CLASS, NULL,
|
fd_obj = efl_add(EFL_LOOP_FD_CLASS, NULL,
|
||||||
efl_name_set(efl_added, "Read FD"));
|
efl_name_set(efl_added, "Read FD"));
|
||||||
|
|
||||||
efl_event_callback_add(efl_fd, EFL_LOOP_FD_EVENT_READ, _read_fd_cb, NULL);
|
efl_event_callback_add(fd_obj, EFL_LOOP_FD_EVENT_READ, _read_fd_cb, NULL);
|
||||||
|
|
||||||
file = fopen(FILENAME, "r");
|
file = fopen(FILENAME, "r");
|
||||||
fd = fileno(file);
|
fd = fileno(file);
|
||||||
|
|
||||||
printf("Opened file %s with fd %d\n", FILENAME, fd);
|
printf("Opened file %s with fd %d\n", FILENAME, fd);
|
||||||
efl_loop_fd_file_set(efl_fd, fd);
|
efl_loop_fd_file_set(fd_obj, fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI_MAIN void
|
EAPI_MAIN void
|
||||||
|
|
Loading…
Reference in New Issue