formatting.

SVN revision: 48354
This commit is contained in:
Carsten Haitzler 2010-04-27 04:30:55 +00:00
parent 53f05ae0e5
commit a08e3d18dc
2 changed files with 24 additions and 25 deletions

View File

@ -27,13 +27,14 @@ static Eina_Bool
_ecore_glib_fds_resize(size_t size)
{
void *tmp = realloc(_ecore_glib_fds, sizeof(GPollFD) * size);
if (!tmp)
{
ERR("Could not realloc from %zu to %zu buckets.",
_ecore_glib_fds_size, size);
return EINA_FALSE;
}
_ecore_glib_fds = tmp;
_ecore_glib_fds_size = size;
return EINA_TRUE;
@ -46,22 +47,19 @@ _ecore_glib_context_query(GMainContext *ctx, int priority, int *p_timer)
if (_ecore_glib_fds_size == 0)
{
if (!_ecore_glib_fds_resize(ECORE_GLIB_FDS_INITIAL))
return -1;
if (!_ecore_glib_fds_resize(ECORE_GLIB_FDS_INITIAL)) return -1;
}
while (1)
{
size_t size;
reqfds = g_main_context_query
(ctx, priority, p_timer, _ecore_glib_fds, _ecore_glib_fds_size);
if (reqfds <= (int)_ecore_glib_fds_size)
break;
if (reqfds <= (int)_ecore_glib_fds_size) break;
size = (1 + reqfds / ECORE_GLIB_FDS_STEP) * ECORE_GLIB_FDS_STEP;
if (!_ecore_glib_fds_resize(size))
return -1;
if (!_ecore_glib_fds_resize(size)) return -1;
}
if (reqfds + ECORE_GLIB_FDS_MAX_FREE < _ecore_glib_fds_size)
@ -80,6 +78,7 @@ _ecore_glib_context_poll_from(const GPollFD *pfds, int count, fd_set *rfds, fd_s
{
const GPollFD *itr = pfds, *itr_end = pfds + count;
int glib_fds = -1;
for (; itr < itr_end; itr++)
{
if (glib_fds < itr->fd)
@ -100,6 +99,7 @@ static int
_ecore_glib_context_poll_to(GPollFD *pfds, int count, const fd_set *rfds, const fd_set *wfds, const fd_set *efds, int ready)
{
GPollFD *itr = pfds, *itr_end = pfds + count;
for (; itr < itr_end && ready > 0; itr++)
{
itr->revents = 0;
@ -130,23 +130,23 @@ _ecore_glib_select__locked(GMainContext *ctx, int ecore_fds, fd_set *rfds, fd_se
g_main_context_prepare(ctx, &priority);
reqfds = _ecore_glib_context_query(ctx, priority, &reqtimeout);
if (reqfds < 0)
goto error;
if (reqfds < 0) goto error;
glib_fds = _ecore_glib_context_poll_from
(_ecore_glib_fds, reqfds, rfds, wfds, efds);
if (reqtimeout == -1)
timeout = ecore_timeout;
else {
glib_timeout.tv_sec = reqtimeout / 1000;
glib_timeout.tv_usec = (reqtimeout % 1000) * 1000;
if (!ecore_timeout || timercmp(ecore_timeout, &glib_timeout, >))
timeout = &glib_timeout;
else
timeout = ecore_timeout;
}
else
{
glib_timeout.tv_sec = reqtimeout / 1000;
glib_timeout.tv_usec = (reqtimeout % 1000) * 1000;
if (!ecore_timeout || timercmp(ecore_timeout, &glib_timeout, >))
timeout = &glib_timeout;
else
timeout = ecore_timeout;
}
maxfds = (ecore_fds >= glib_fds) ? ecore_fds : glib_fds;
ret = _ecore_glib_select_original(maxfds, rfds, wfds, efds, timeout);
@ -202,13 +202,12 @@ void
_ecore_glib_shutdown(void)
{
#ifdef HAVE_GLIB
if (!_ecore_glib_active)
return;
if (!_ecore_glib_active) return;
_ecore_glib_active = EINA_FALSE;
if (ecore_main_loop_select_func_get() == _ecore_glib_select)
ecore_main_loop_select_func_set(_ecore_glib_select_original);
if (_ecore_glib_fds)
{
free(_ecore_glib_fds);

View File

@ -539,7 +539,7 @@ _ecore_main_select(double timeout)
#ifndef _WIN32
if (errno == EINTR) return -1;
else if (errno == EBADF)
_ecore_main_fd_handlers_bads_rem();
_ecore_main_fd_handlers_bads_rem();
#endif
}
if (ret > 0)
@ -567,10 +567,10 @@ _ecore_main_select(double timeout)
static void
_ecore_main_fd_handlers_bads_rem(void)
{
ERR("Removing bad fds");
Ecore_Fd_Handler *fdh;
Eina_Inlist *l;
ERR("Removing bad fds");
for (l = EINA_INLIST_GET(fd_handlers); l; )
{
fdh = (Ecore_Fd_Handler *) l;