| 347 | #endif |
| 348 | |
| 349 | void * calloc(size_t n, size_t lb) |
| 350 | { |
| 351 | # if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES) |
| 352 | /* libpthread allocated some memory that is only pointed to by */ |
| 353 | /* mmapped thread stacks. Make sure it's not collectable. */ |
| 354 | { |
| 355 | static GC_bool lib_bounds_set = FALSE; |
| 356 | ptr_t caller = (ptr_t)__builtin_return_address(0); |
| 357 | /* This test does not need to ensure memory visibility, since */ |
| 358 | /* the bounds will be set when/if we create another thread. */ |
| 359 | if (!lib_bounds_set) { |
| 360 | GC_init_lib_bounds(); |
| 361 | lib_bounds_set = TRUE; |
| 362 | } |
| 363 | if (caller >= GC_libpthread_start && caller < GC_libpthread_end |
| 364 | || (caller >= GC_libld_start && caller < GC_libld_end)) |
| 365 | return GC_malloc_uncollectable(n*lb); |
| 366 | /* The two ranges are actually usually adjacent, so there may */ |
| 367 | /* be a way to speed this up. */ |
| 368 | } |
| 369 | # endif |
| 370 | return((void *)REDIRECT_MALLOC(n*lb)); |
| 371 | } |
| 372 | |
| 373 | #ifndef strdup |
| 374 | # include <string.h> |
nothing calls this directly
no test coverage detected