goinfre/libs/libevent/add.c

goinfre/libs/libevent/add.c

  _____________________________________________________________________________ 
 /   / Index / Goinfre / Resume / Links / Contact / Sitemap /    .: v0.6.1.0 |^|
|\__/-------+         +--------+-------+---------+---------+-----------------+#|
|  1| /goinfre/libs/libevent/add.c                                           |#|
|  2| ==========================================                             |#|
|  3|                                                                        |#|
|  4|                                                   [ raw ] [ download ] |#|
|  5|                                             ` `` ````````````````````` |#|
|  6|                                                                        |#|
|  7| /**                                                                    |#|
|  8|  * libevent/add.c                                                      |#|
|  9|  *                                                                     |#|
| 10|  * Copyright (c) Manfred Touron 2008                                   |#|
| 11|  */                                                                    |#|
| 12|                                                                        |#|
| 13| #include <stdlib.h>                                                    |#|
| 14| #include <unistd.h>                                                    |#|
| 15| #include <stdio.h>                                                     |#|
| 16| #include <stdint.h>                                                    |#|
| 17| #include <string.h>                                                    |#|
| 18|                                                                        |#|
| 19| #include <liblc/liblc.h>                                               |#|
| 20|                                                                        |#|
| 21| #include "core.h"                                                      |#|
| 22|                                                                        |#|
| 23| void      event_add_handler(const char *name, cllbck callback)         |#|
| 24| {                                                                      |#|
| 25|   event      e;                                                        |#|
| 26|                                                                        | |
| 27|   if ((e = events_find(name)) == NULL)                                 | |
| 28|     {                                                                  | |
| 29|       e = event_new(name);                                             | |
| 30|       if (!event_callback_exists(e, callback))                         | |
| 31|       lc_push(e->lc, (void *)(uintptr_t)callback);                     | |
| 32|     }                                                                  | |
| 33|   else if (!event_callback_exists(e, callback))                        | |
| 34|     lc_push(e->lc, (void *)(uintptr_t)callback);                       | |
| 35|   return ;                                                             | |
| 36| }                                                                      | |
| 37|                                                                        | |
+---+                                                                        | |
\_   \______ mo5.so - normal - 1337.so - rev.so - video_r.so +---------------+ |
  |__       \_____   plain.so - color.so - comment.so       /  moul 2008 (c) |V|
     \-----\______\________________________________________/-----------------+-+