forked from enlightenment/efl
parent
4a514076ad
commit
26d8a50642
|
@ -66,8 +66,7 @@ struct _Ecore_Pipe
|
|||
};
|
||||
|
||||
|
||||
static int _ecore_pipe_read(void *data,
|
||||
Ecore_Fd_Handler *fd_handler);
|
||||
static int _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler);
|
||||
|
||||
/**
|
||||
* @defgroup Ecore_Pipe_Group Pipe wrapper
|
||||
|
@ -289,12 +288,10 @@ ecore_pipe_add(void (*handler) (void *data, void *buffer, unsigned int nbyte),
|
|||
Ecore_Pipe *p;
|
||||
int fds[2];
|
||||
|
||||
if(!handler)
|
||||
return NULL;
|
||||
if (!handler) return NULL;
|
||||
|
||||
p = (Ecore_Pipe *)calloc(1, sizeof(Ecore_Pipe));
|
||||
if (!p)
|
||||
return NULL;
|
||||
if (!p) return NULL;
|
||||
|
||||
if (pipe(fds))
|
||||
{
|
||||
|
@ -316,7 +313,6 @@ ecore_pipe_add(void (*handler) (void *data, void *buffer, unsigned int nbyte),
|
|||
_ecore_pipe_read,
|
||||
p,
|
||||
NULL, NULL);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -334,18 +330,14 @@ ecore_pipe_del(Ecore_Pipe *p)
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE,
|
||||
"ecore_pipe_del");
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_del");
|
||||
return NULL;
|
||||
}
|
||||
if(p->fd_handler != NULL)
|
||||
ecore_main_fd_handler_del(p->fd_handler);
|
||||
if(p->fd_read != PIPE_FD_INVALID)
|
||||
pipe_close(p->fd_read);
|
||||
if(p->fd_write != PIPE_FD_INVALID)
|
||||
pipe_close(p->fd_write);
|
||||
if (p->fd_handler != NULL) ecore_main_fd_handler_del(p->fd_handler);
|
||||
if (p->fd_read != PIPE_FD_INVALID) pipe_close(p->fd_read);
|
||||
if (p->fd_write != PIPE_FD_INVALID) pipe_close(p->fd_write);
|
||||
data = (void *)p->data;
|
||||
free (p);
|
||||
free(p);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -360,8 +352,7 @@ ecore_pipe_read_close(Ecore_Pipe *p)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE,
|
||||
"ecore_pipe_read_close");
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_close");
|
||||
return;
|
||||
}
|
||||
ecore_main_fd_handler_del(p->fd_handler);
|
||||
|
@ -381,8 +372,7 @@ ecore_pipe_write_close(Ecore_Pipe *p)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE,
|
||||
"ecore_pipe_write_close");
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write_close");
|
||||
return;
|
||||
}
|
||||
pipe_close(p->fd_write);
|
||||
|
@ -407,13 +397,11 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE,
|
||||
"ecore_pipe_write");
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(p->fd_write == PIPE_FD_INVALID)
|
||||
return FALSE;
|
||||
if (p->fd_write == PIPE_FD_INVALID) return FALSE;
|
||||
|
||||
/* First write the len into the pipe */
|
||||
do
|
||||
|
@ -449,8 +437,7 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
|
|||
}
|
||||
while (retry--);
|
||||
|
||||
if (retry != ECORE_PIPE_WRITE_RETRY)
|
||||
return FALSE;
|
||||
if (retry != ECORE_PIPE_WRITE_RETRY) return FALSE;
|
||||
|
||||
/* and now pass the data to the pipe */
|
||||
do
|
||||
|
|
Loading…
Reference in New Issue