summaryrefslogtreecommitdiff
path: root/specific.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-06-06 20:01:41 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-06-07 14:08:30 +0300
commitaabfaeb28ccbc3016aa17d0934b0affb721286cf (patch)
treef596a1f6c0807c13df602e07cbbd9da321153f14 /specific.c
parent0c44b469646fb07cf82a62deed6a7ee693112c8f (diff)
downloadbdwgc-aabfaeb28ccbc3016aa17d0934b0affb721286cf.tar.gz
Specify that internal allocations failure is unlikely
(refactoring) * finalize.c [!GC_NO_FINALIZATION] (GC_register_disappearing_link_inner): Assume failure of allocation (resulting in NULL or GC_oom_fn call) is unlikely. * malloc.c [DBG_HDRS_ALL || GC_GCJ_SUPPORT || !GC_NO_FINALIZATION] (GC_generic_malloc_inner_ignore_off_page): Likewise. * malloc.c (GC_generic_malloc): Likewise. * malloc.c [REDIRECT_MALLOC && !REDIRECT_MALLOC_IN_HEADER] (calloc, strdup, strndup): Likewise. * mallocx.c (GC_realloc, GC_memalign, GC_strdup, GC_strndup): Likewise. * mallocx.c [GC_REQUIRE_WCSDUP] (GC_wcsdup): Likewise. * specific.c [USE_CUSTOM_SPECIFIC] (GC_setspecific): Likewise. * typd_mlc.c (GC_make_sequence_descriptor, GC_make_descriptor): Likewise. * malloc.c [REDIRECT_MALLOC && !REDIRECT_MALLOC_IN_HEADER] (calloc): Expect that lb and n are not greater than GC_SQRT_SIZE_MAX. * typd_mlc.c (GC_calloc_explicitly_typed): Likewise. * typd_mlc.c (GC_add_ext_descriptor): Assume that resizing of GC_ext_descriptors[] is rare. * typd_mlc.c (GC_calloc_explicitly_typed): Do not call GC_make_array_descriptor() if n * lb > GC_SIZE_MAX. * malloc.c [REDIRECT_MALLOC && !REDIRECT_MALLOC_IN_HEADER && !strndup] (strndup): Expect that len is not greater than size. * mallocx.c (GC_strndup): Likewise. * typd_mlc.c (GC_make_sequence_descriptor): Reformat code.
Diffstat (limited to 'specific.c')
-rw-r--r--specific.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/specific.c b/specific.c
index d4c0ef46..2a1f954e 100644
--- a/specific.c
+++ b/specific.c
@@ -59,7 +59,7 @@ GC_INNER int GC_setspecific(tsd * key, void * value)
GC_dont_gc++; /* disable GC */
entry = (volatile tse *)MALLOC_CLEAR(sizeof(tse));
GC_dont_gc--;
- if (0 == entry) return ENOMEM;
+ if (EXPECT(NULL == entry, FALSE)) return ENOMEM;
pthread_mutex_lock(&(key -> lock));
/* Could easily check for an existing entry here. */