summaryrefslogtreecommitdiff
path: root/legacy/ecore/src/lib/ecore/ecore_main.c
diff options
context:
space:
mode:
authorMike McCormack <mj.mccormack@samsung.com>2011-08-11 10:59:48 +0000
committerMike McCormack <mikem@ring3k.org>2011-08-11 10:59:48 +0000
commitf05e37addfc7d87a4f8b1af8f6665ea347b93f3e (patch)
treea99554fd3a8b02f1be6061cc6f0338935dda4f61 /legacy/ecore/src/lib/ecore/ecore_main.c
parentcc7d5115c3f0572e0a26f46029b2a321446e297a (diff)
ecore: Create callback wrappers
This gets rid of a lot of temporary variables and cleans the code up again... Signed-off-by: Mike McCormack <mj.mccormack@samsung.com> SVN revision: 62342
Diffstat (limited to '')
-rw-r--r--legacy/ecore/src/lib/ecore/ecore_main.c42
1 files changed, 5 insertions, 37 deletions
diff --git a/legacy/ecore/src/lib/ecore/ecore_main.c b/legacy/ecore/src/lib/ecore/ecore_main.c
index edce31d8a3..5653726a2b 100644
--- a/legacy/ecore/src/lib/ecore/ecore_main.c
+++ b/legacy/ecore/src/lib/ecore/ecore_main.c
@@ -1255,15 +1255,8 @@ _ecore_main_prepare_handlers(void)
1255 } 1255 }
1256 if (!fdh->delete_me && fdh->prep_func) 1256 if (!fdh->delete_me && fdh->prep_func)
1257 { 1257 {
1258 Ecore_Fd_Prep_Cb prep_func;
1259 void *prep_data;
1260
1261 prep_func = fdh->prep_func;
1262 prep_data = fdh->prep_data;
1263 fdh->references++; 1258 fdh->references++;
1264 _ecore_unlock(); 1259 _ecore_call_prep_cb(fdh->prep_func, fdh->prep_data, fdh);
1265 prep_func(prep_data, fdh);
1266 _ecore_lock();
1267 fdh->references--; 1260 fdh->references--;
1268 } 1261 }
1269 else 1262 else
@@ -1413,13 +1406,9 @@ _ecore_main_fd_handlers_bads_rem(void)
1413 ERR("Found bad fd at index %d", fdh->fd); 1406 ERR("Found bad fd at index %d", fdh->fd);
1414 if (fdh->flags & ECORE_FD_ERROR) 1407 if (fdh->flags & ECORE_FD_ERROR)
1415 { 1408 {
1416 Eina_Bool ret;
1417 ERR("Fd set for error! calling user"); 1409 ERR("Fd set for error! calling user");
1418 fdh->references++; 1410 fdh->references++;
1419 _ecore_unlock(); 1411 if (!_ecore_call_fd_cb(fdh->func, fdh->data, fdh))
1420 ret = fdh->func(fdh->data, fdh);
1421 _ecore_lock();
1422 if (!ret)
1423 { 1412 {
1424 ERR("Fd function err returned 0, remove it"); 1413 ERR("Fd function err returned 0, remove it");
1425 if (!fdh->delete_me) 1414 if (!fdh->delete_me)
@@ -1539,12 +1528,8 @@ _ecore_main_fd_handlers_call(void)
1539 (fdh->write_active) || 1528 (fdh->write_active) ||
1540 (fdh->error_active)) 1529 (fdh->error_active))
1541 { 1530 {
1542 Eina_Bool ret;
1543 fdh->references++; 1531 fdh->references++;
1544 _ecore_unlock(); 1532 if (!_ecore_call_fd_cb(fdh->func, fdh->data, fdh))
1545 ret = fdh->func(fdh->data, fdh);
1546 _ecore_lock();
1547 if (!ret)
1548 { 1533 {
1549 if (!fdh->delete_me) 1534 if (!fdh->delete_me)
1550 { 1535 {
@@ -1592,27 +1577,10 @@ _ecore_main_fd_handlers_buf_call(void)
1592 } 1577 }
1593 if ((!fdh->delete_me) && fdh->buf_func) 1578 if ((!fdh->delete_me) && fdh->buf_func)
1594 { 1579 {
1595 Ecore_Fd_Cb buf_func;
1596 void *buf_data;
1597 Eina_Bool r;
1598
1599 /* copy data before releasing lock */
1600 buf_func = fdh->buf_func;
1601 buf_data = fdh->buf_data;
1602 fdh->references++; 1580 fdh->references++;
1603 _ecore_unlock(); 1581 if (_ecore_call_fd_cb(fdh->buf_func, fdh->buf_data, fdh))
1604 r = buf_func(buf_data, fdh);
1605 _ecore_lock();
1606 if (r)
1607 { 1582 {
1608 Ecore_Fd_Cb func; 1583 ret |= _ecore_call_fd_cb(fdh->func, fdh->data, fdh);
1609 void *data;
1610
1611 func = fdh->func;
1612 data = fdh->data;
1613 _ecore_unlock();
1614 ret |= func(data, fdh);
1615 _ecore_lock();
1616 fdh->read_active = EINA_TRUE; 1584 fdh->read_active = EINA_TRUE;
1617 _ecore_try_add_to_call_list(fdh); 1585 _ecore_try_add_to_call_list(fdh);
1618 } 1586 }