… | |
… | |
568 | } |
568 | } |
569 | |
569 | |
570 | static void * |
570 | static void * |
571 | ev_realloc_emul (void *ptr, long size) |
571 | ev_realloc_emul (void *ptr, long size) |
572 | { |
572 | { |
|
|
573 | #if __GLIBC__ |
|
|
574 | return realloc (ptr, size); |
|
|
575 | #else |
573 | /* some systems, notably openbsd and darwin, fail to properly |
576 | /* some systems, notably openbsd and darwin, fail to properly |
574 | * implement realloc (x, 0) (as required by both ansi c-98 and |
577 | * implement realloc (x, 0) (as required by both ansi c-98 and |
575 | * the single unix specification, so work around them here. |
578 | * the single unix specification, so work around them here. |
576 | */ |
579 | */ |
577 | |
580 | |
578 | if (size) |
581 | if (size) |
579 | return realloc (ptr, size); |
582 | return realloc (ptr, size); |
580 | |
583 | |
581 | free (ptr); |
584 | free (ptr); |
582 | return 0; |
585 | return 0; |
|
|
586 | #endif |
583 | } |
587 | } |
584 | |
588 | |
585 | static void *(*alloc)(void *ptr, long size) = ev_realloc_emul; |
589 | static void *(*alloc)(void *ptr, long size) = ev_realloc_emul; |
586 | |
590 | |
587 | void |
591 | void |