… | |
… | |
1191 | } |
1191 | } |
1192 | |
1192 | |
1193 | static void * |
1193 | static void * |
1194 | ev_realloc_emul (void *ptr, long size) EV_THROW |
1194 | ev_realloc_emul (void *ptr, long size) EV_THROW |
1195 | { |
1195 | { |
1196 | #if __GLIBC__ |
|
|
1197 | return realloc (ptr, size); |
|
|
1198 | #else |
|
|
1199 | /* some systems, notably openbsd and darwin, fail to properly |
1196 | /* some systems, notably openbsd and darwin, fail to properly |
1200 | * implement realloc (x, 0) (as required by both ansi c-89 and |
1197 | * implement realloc (x, 0) (as required by both ansi c-89 and |
1201 | * the single unix specification, so work around them here. |
1198 | * the single unix specification, so work around them here. |
|
|
1199 | * recently, also (at least) fedora and debian started breaking it, |
|
|
1200 | * despite documenting it otherwise. |
1202 | */ |
1201 | */ |
1203 | |
1202 | |
1204 | if (size) |
1203 | if (size) |
1205 | return realloc (ptr, size); |
1204 | return realloc (ptr, size); |
1206 | |
1205 | |
1207 | free (ptr); |
1206 | free (ptr); |
1208 | return 0; |
1207 | return 0; |
1209 | #endif |
|
|
1210 | } |
1208 | } |
1211 | |
1209 | |
1212 | static void *(*alloc)(void *ptr, long size) EV_THROW = ev_realloc_emul; |
1210 | static void *(*alloc)(void *ptr, long size) EV_THROW = ev_realloc_emul; |
1213 | |
1211 | |
1214 | void ecb_cold |
1212 | void ecb_cold |
… | |
… | |
2045 | void noinline |
2043 | void noinline |
2046 | ev_feed_signal_event (EV_P_ int signum) EV_THROW |
2044 | ev_feed_signal_event (EV_P_ int signum) EV_THROW |
2047 | { |
2045 | { |
2048 | WL w; |
2046 | WL w; |
2049 | |
2047 | |
2050 | if (expect_false (signum <= 0 || signum > EV_NSIG)) |
2048 | if (expect_false (signum <= 0 || signum >= EV_NSIG)) |
2051 | return; |
2049 | return; |
2052 | |
2050 | |
2053 | --signum; |
2051 | --signum; |
2054 | |
2052 | |
2055 | #if EV_MULTIPLICITY |
2053 | #if EV_MULTIPLICITY |
… | |
… | |
2762 | } |
2760 | } |
2763 | |
2761 | |
2764 | void noinline |
2762 | void noinline |
2765 | ev_invoke_pending (EV_P) |
2763 | ev_invoke_pending (EV_P) |
2766 | { |
2764 | { |
2767 | for (pendingpri = NUMPRI; pendingpri--; ) /* pendingpri is modified during the loop */ |
2765 | pendingpri = NUMPRI; |
|
|
2766 | |
|
|
2767 | while (pendingpri) /* pendingpri possibly gets modified in the inner loop */ |
|
|
2768 | { |
|
|
2769 | --pendingpri; |
|
|
2770 | |
2768 | while (pendingcnt [pendingpri]) |
2771 | while (pendingcnt [pendingpri]) |
2769 | { |
2772 | { |
2770 | ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri]; |
2773 | ANPENDING *p = pendings [pendingpri] + --pendingcnt [pendingpri]; |
2771 | |
2774 | |
2772 | p->w->pending = 0; |
2775 | p->w->pending = 0; |
2773 | EV_CB_INVOKE (p->w, p->events); |
2776 | EV_CB_INVOKE (p->w, p->events); |
2774 | EV_FREQUENT_CHECK; |
2777 | EV_FREQUENT_CHECK; |
2775 | } |
2778 | } |
|
|
2779 | } |
2776 | } |
2780 | } |
2777 | |
2781 | |
2778 | #if EV_IDLE_ENABLE |
2782 | #if EV_IDLE_ENABLE |
2779 | /* make idle watchers pending. this handles the "call-idle */ |
2783 | /* make idle watchers pending. this handles the "call-idle */ |
2780 | /* only when higher priorities are idle" logic */ |
2784 | /* only when higher priorities are idle" logic */ |
… | |
… | |
3177 | && !(flags & (EVRUN_ONCE | EVRUN_NOWAIT)) |
3181 | && !(flags & (EVRUN_ONCE | EVRUN_NOWAIT)) |
3178 | )); |
3182 | )); |
3179 | |
3183 | |
3180 | if (loop_done == EVBREAK_ONE) |
3184 | if (loop_done == EVBREAK_ONE) |
3181 | loop_done = EVBREAK_CANCEL; |
3185 | loop_done = EVBREAK_CANCEL; |
3182 | |
|
|
3183 | /* pendingpri is normally -1 here, which is not a good */ |
|
|
3184 | /* value when returning to an ev_invoke_pending */ |
|
|
3185 | pendingpri = NUMPRI - 1; |
|
|
3186 | |
3186 | |
3187 | #if EV_FEATURE_API |
3187 | #if EV_FEATURE_API |
3188 | --loop_depth; |
3188 | --loop_depth; |
3189 | #endif |
3189 | #endif |
3190 | |
3190 | |