… | |
… | |
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 |