Rename labels.

Rename labels from FOO to label_foo in order to avoid system macro
definitions, in particular OUT and ERROR on mingw.

Reported by Mike Hommey.
This commit is contained in:
Jason Evans 2012-04-10 15:07:44 -07:00
parent eae269036c
commit a1ee7838e1
11 changed files with 129 additions and 129 deletions

View File

@ -38,17 +38,17 @@ chunk_alloc(size_t size, size_t alignment, bool base, bool *zero)
if (config_dss) { if (config_dss) {
ret = chunk_alloc_dss(size, alignment, zero); ret = chunk_alloc_dss(size, alignment, zero);
if (ret != NULL) if (ret != NULL)
goto RETURN; goto label_return;
} }
ret = chunk_alloc_mmap(size, alignment); ret = chunk_alloc_mmap(size, alignment);
if (ret != NULL) { if (ret != NULL) {
*zero = true; *zero = true;
goto RETURN; goto label_return;
} }
/* All strategies for allocation failed. */ /* All strategies for allocation failed. */
ret = NULL; ret = NULL;
RETURN: label_return:
if (config_ivsalloc && base == false && ret != NULL) { if (config_ivsalloc && base == false && ret != NULL) {
if (rtree_set(chunks_rtree, (uintptr_t)ret, ret)) { if (rtree_set(chunks_rtree, (uintptr_t)ret, ret)) {
chunk_dealloc(ret, size, true); chunk_dealloc(ret, size, true);

View File

@ -293,11 +293,11 @@ chunk_dealloc_dss(void *chunk, size_t size)
madvise(chunk, size, MADV_DONTNEED); madvise(chunk, size, MADV_DONTNEED);
ret = false; ret = false;
goto RETURN; goto label_return;
} }
ret = true; ret = true;
RETURN: label_return:
malloc_mutex_unlock(&dss_mtx); malloc_mutex_unlock(&dss_mtx);
return (ret); return (ret);
} }

View File

@ -267,12 +267,12 @@ ckh_grow(ckh_t *ckh)
usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE, NULL); usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE, NULL);
if (usize == 0) { if (usize == 0) {
ret = true; ret = true;
goto RETURN; goto label_return;
} }
tab = (ckhc_t *)ipalloc(usize, CACHELINE, true); tab = (ckhc_t *)ipalloc(usize, CACHELINE, true);
if (tab == NULL) { if (tab == NULL) {
ret = true; ret = true;
goto RETURN; goto label_return;
} }
/* Swap in new table. */ /* Swap in new table. */
ttab = ckh->tab; ttab = ckh->tab;
@ -292,7 +292,7 @@ ckh_grow(ckh_t *ckh)
} }
ret = false; ret = false;
RETURN: label_return:
return (ret); return (ret);
} }
@ -385,16 +385,16 @@ ckh_new(ckh_t *ckh, size_t minitems, ckh_hash_t *hash, ckh_keycomp_t *keycomp)
usize = sa2u(sizeof(ckhc_t) << lg_mincells, CACHELINE, NULL); usize = sa2u(sizeof(ckhc_t) << lg_mincells, CACHELINE, NULL);
if (usize == 0) { if (usize == 0) {
ret = true; ret = true;
goto RETURN; goto label_return;
} }
ckh->tab = (ckhc_t *)ipalloc(usize, CACHELINE, true); ckh->tab = (ckhc_t *)ipalloc(usize, CACHELINE, true);
if (ckh->tab == NULL) { if (ckh->tab == NULL) {
ret = true; ret = true;
goto RETURN; goto label_return;
} }
ret = false; ret = false;
RETURN: label_return:
return (ret); return (ret);
} }
@ -466,12 +466,12 @@ ckh_insert(ckh_t *ckh, const void *key, const void *data)
while (ckh_try_insert(ckh, &key, &data)) { while (ckh_try_insert(ckh, &key, &data)) {
if (ckh_grow(ckh)) { if (ckh_grow(ckh)) {
ret = true; ret = true;
goto RETURN; goto label_return;
} }
} }
ret = false; ret = false;
RETURN: label_return:
return (ret); return (ret);
} }

View File

@ -546,7 +546,7 @@ ctl_init(void)
(narenas + 1) * sizeof(ctl_arena_stats_t)); (narenas + 1) * sizeof(ctl_arena_stats_t));
if (ctl_stats.arenas == NULL) { if (ctl_stats.arenas == NULL) {
ret = true; ret = true;
goto RETURN; goto label_return;
} }
memset(ctl_stats.arenas, 0, (narenas + 1) * memset(ctl_stats.arenas, 0, (narenas + 1) *
sizeof(ctl_arena_stats_t)); sizeof(ctl_arena_stats_t));
@ -561,7 +561,7 @@ ctl_init(void)
for (i = 0; i <= narenas; i++) { for (i = 0; i <= narenas; i++) {
if (ctl_arena_init(&ctl_stats.arenas[i])) { if (ctl_arena_init(&ctl_stats.arenas[i])) {
ret = true; ret = true;
goto RETURN; goto label_return;
} }
} }
} }
@ -573,7 +573,7 @@ ctl_init(void)
} }
ret = false; ret = false;
RETURN: label_return:
malloc_mutex_unlock(&ctl_mtx); malloc_mutex_unlock(&ctl_mtx);
return (ret); return (ret);
} }
@ -593,7 +593,7 @@ ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp,
elen = (size_t)((uintptr_t)dot - (uintptr_t)elm); elen = (size_t)((uintptr_t)dot - (uintptr_t)elm);
if (elen == 0) { if (elen == 0) {
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
node = super_root_node; node = super_root_node;
for (i = 0; i < *depthp; i++) { for (i = 0; i < *depthp; i++) {
@ -618,7 +618,7 @@ ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp,
} }
if (node == pnode) { if (node == pnode) {
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
} else { } else {
uintmax_t index; uintmax_t index;
@ -628,7 +628,7 @@ ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp,
index = malloc_strtoumax(elm, NULL, 10); index = malloc_strtoumax(elm, NULL, 10);
if (index == UINTMAX_MAX || index > SIZE_T_MAX) { if (index == UINTMAX_MAX || index > SIZE_T_MAX) {
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
inode = &node->u.named.children[0]; inode = &node->u.named.children[0];
@ -636,7 +636,7 @@ ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp,
(size_t)index); (size_t)index);
if (node == NULL) { if (node == NULL) {
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
if (nodesp != NULL) if (nodesp != NULL)
@ -652,7 +652,7 @@ ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp,
* in this path through the tree. * in this path through the tree.
*/ */
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
/* Complete lookup successful. */ /* Complete lookup successful. */
*depthp = i + 1; *depthp = i + 1;
@ -663,7 +663,7 @@ ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp,
if (*dot == '\0') { if (*dot == '\0') {
/* No more elements. */ /* No more elements. */
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
elm = &dot[1]; elm = &dot[1];
dot = ((tdot = strchr(elm, '.')) != NULL) ? tdot : dot = ((tdot = strchr(elm, '.')) != NULL) ? tdot :
@ -672,7 +672,7 @@ ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp,
} }
ret = 0; ret = 0;
RETURN: label_return:
return (ret); return (ret);
} }
@ -687,22 +687,22 @@ ctl_byname(const char *name, void *oldp, size_t *oldlenp, void *newp,
if (ctl_initialized == false && ctl_init()) { if (ctl_initialized == false && ctl_init()) {
ret = EAGAIN; ret = EAGAIN;
goto RETURN; goto label_return;
} }
depth = CTL_MAX_DEPTH; depth = CTL_MAX_DEPTH;
ret = ctl_lookup(name, nodes, mib, &depth); ret = ctl_lookup(name, nodes, mib, &depth);
if (ret != 0) if (ret != 0)
goto RETURN; goto label_return;
if (nodes[depth-1]->ctl == NULL) { if (nodes[depth-1]->ctl == NULL) {
/* The name refers to a partial path through the ctl tree. */ /* The name refers to a partial path through the ctl tree. */
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
ret = nodes[depth-1]->ctl(mib, depth, oldp, oldlenp, newp, newlen); ret = nodes[depth-1]->ctl(mib, depth, oldp, oldlenp, newp, newlen);
RETURN: label_return:
return(ret); return(ret);
} }
@ -713,11 +713,11 @@ ctl_nametomib(const char *name, size_t *mibp, size_t *miblenp)
if (ctl_initialized == false && ctl_init()) { if (ctl_initialized == false && ctl_init()) {
ret = EAGAIN; ret = EAGAIN;
goto RETURN; goto label_return;
} }
ret = ctl_lookup(name, NULL, mibp, miblenp); ret = ctl_lookup(name, NULL, mibp, miblenp);
RETURN: label_return:
return(ret); return(ret);
} }
@ -731,7 +731,7 @@ ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
if (ctl_initialized == false && ctl_init()) { if (ctl_initialized == false && ctl_init()) {
ret = EAGAIN; ret = EAGAIN;
goto RETURN; goto label_return;
} }
/* Iterate down the tree. */ /* Iterate down the tree. */
@ -741,7 +741,7 @@ ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
/* Children are named. */ /* Children are named. */
if (node->u.named.nchildren <= mib[i]) { if (node->u.named.nchildren <= mib[i]) {
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
node = &node->u.named.children[mib[i]]; node = &node->u.named.children[mib[i]];
} else { } else {
@ -752,7 +752,7 @@ ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
node = inode->u.indexed.index(mib, miblen, mib[i]); node = inode->u.indexed.index(mib, miblen, mib[i]);
if (node == NULL) { if (node == NULL) {
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
} }
} }
@ -761,11 +761,11 @@ ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
if (node->ctl == NULL) { if (node->ctl == NULL) {
/* Partial MIB. */ /* Partial MIB. */
ret = ENOENT; ret = ENOENT;
goto RETURN; goto label_return;
} }
ret = node->ctl(mib, miblen, oldp, oldlenp, newp, newlen); ret = node->ctl(mib, miblen, oldp, oldlenp, newp, newlen);
RETURN: label_return:
return(ret); return(ret);
} }
@ -787,14 +787,14 @@ ctl_boot(void)
#define READONLY() do { \ #define READONLY() do { \
if (newp != NULL || newlen != 0) { \ if (newp != NULL || newlen != 0) { \
ret = EPERM; \ ret = EPERM; \
goto RETURN; \ goto label_return; \
} \ } \
} while (0) } while (0)
#define WRITEONLY() do { \ #define WRITEONLY() do { \
if (oldp != NULL || oldlenp != NULL) { \ if (oldp != NULL || oldlenp != NULL) { \
ret = EPERM; \ ret = EPERM; \
goto RETURN; \ goto label_return; \
} \ } \
} while (0) } while (0)
@ -810,7 +810,7 @@ ctl_boot(void)
? sizeof(t) : *oldlenp; \ ? sizeof(t) : *oldlenp; \
memcpy(oldp, (void *)&v, copylen); \ memcpy(oldp, (void *)&v, copylen); \
ret = EINVAL; \ ret = EINVAL; \
goto RETURN; \ goto label_return; \
} else \ } else \
*(t *)oldp = v; \ *(t *)oldp = v; \
} \ } \
@ -820,7 +820,7 @@ ctl_boot(void)
if (newp != NULL) { \ if (newp != NULL) { \
if (newlen != sizeof(t)) { \ if (newlen != sizeof(t)) { \
ret = EINVAL; \ ret = EINVAL; \
goto RETURN; \ goto label_return; \
} \ } \
v = *(t *)newp; \ v = *(t *)newp; \
} \ } \
@ -847,7 +847,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
READ(oldval, t); \ READ(oldval, t); \
\ \
ret = 0; \ ret = 0; \
RETURN: \ label_return: \
if (l) \ if (l) \
malloc_mutex_unlock(&ctl_mtx); \ malloc_mutex_unlock(&ctl_mtx); \
return (ret); \ return (ret); \
@ -869,7 +869,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
READ(oldval, t); \ READ(oldval, t); \
\ \
ret = 0; \ ret = 0; \
RETURN: \ label_return: \
malloc_mutex_unlock(&ctl_mtx); \ malloc_mutex_unlock(&ctl_mtx); \
return (ret); \ return (ret); \
} }
@ -888,7 +888,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
READ(oldval, t); \ READ(oldval, t); \
\ \
ret = 0; \ ret = 0; \
RETURN: \ label_return: \
malloc_mutex_unlock(&ctl_mtx); \ malloc_mutex_unlock(&ctl_mtx); \
return (ret); \ return (ret); \
} }
@ -912,7 +912,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
READ(oldval, t); \ READ(oldval, t); \
\ \
ret = 0; \ ret = 0; \
RETURN: \ label_return: \
return (ret); \ return (ret); \
} }
@ -929,7 +929,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
READ(oldval, t); \ READ(oldval, t); \
\ \
ret = 0; \ ret = 0; \
RETURN: \ label_return: \
return (ret); \ return (ret); \
} }
@ -946,7 +946,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
READ(oldval, bool); \ READ(oldval, bool); \
\ \
ret = 0; \ ret = 0; \
RETURN: \ label_return: \
return (ret); \ return (ret); \
} }
@ -967,7 +967,7 @@ epoch_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
READ(ctl_epoch, uint64_t); READ(ctl_epoch, uint64_t);
ret = 0; ret = 0;
RETURN: label_return:
malloc_mutex_unlock(&ctl_mtx); malloc_mutex_unlock(&ctl_mtx);
return (ret); return (ret);
} }
@ -986,13 +986,13 @@ thread_tcache_enabled_ctl(const size_t *mib, size_t miblen, void *oldp,
if (newp != NULL) { if (newp != NULL) {
if (newlen != sizeof(bool)) { if (newlen != sizeof(bool)) {
ret = EINVAL; ret = EINVAL;
goto RETURN; goto label_return;
} }
tcache_enabled_set(*(bool *)newp); tcache_enabled_set(*(bool *)newp);
} }
READ(oldval, bool); READ(oldval, bool);
RETURN: label_return:
ret = 0; ret = 0;
return (ret); return (ret);
} }
@ -1011,7 +1011,7 @@ thread_tcache_flush_ctl(const size_t *mib, size_t miblen, void *oldp,
tcache_flush(); tcache_flush();
ret = 0; ret = 0;
RETURN: label_return:
return (ret); return (ret);
} }
@ -1031,7 +1031,7 @@ thread_arena_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
if (newind >= narenas) { if (newind >= narenas) {
/* New arena index is out of range. */ /* New arena index is out of range. */
ret = EFAULT; ret = EFAULT;
goto RETURN; goto label_return;
} }
/* Initialize arena if necessary. */ /* Initialize arena if necessary. */
@ -1040,7 +1040,7 @@ thread_arena_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
arenas_extend(newind)) == NULL) { arenas_extend(newind)) == NULL) {
malloc_mutex_unlock(&arenas_lock); malloc_mutex_unlock(&arenas_lock);
ret = EAGAIN; ret = EAGAIN;
goto RETURN; goto label_return;
} }
assert(arena == arenas[newind]); assert(arena == arenas[newind]);
arenas[oldind]->nthreads--; arenas[oldind]->nthreads--;
@ -1059,7 +1059,7 @@ thread_arena_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
} }
ret = 0; ret = 0;
RETURN: label_return:
return (ret); return (ret);
} }
@ -1156,7 +1156,7 @@ arenas_initialized_ctl(const size_t *mib, size_t miblen, void *oldp,
for (i = 0; i < nread; i++) for (i = 0; i < nread; i++)
((bool *)oldp)[i] = ctl_stats.arenas[i].initialized; ((bool *)oldp)[i] = ctl_stats.arenas[i].initialized;
RETURN: label_return:
malloc_mutex_unlock(&ctl_mtx); malloc_mutex_unlock(&ctl_mtx);
return (ret); return (ret);
} }
@ -1180,7 +1180,7 @@ arenas_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
WRITE(arena, unsigned); WRITE(arena, unsigned);
if (newp != NULL && arena >= narenas) { if (newp != NULL && arena >= narenas) {
ret = EFAULT; ret = EFAULT;
goto RETURN; goto label_return;
} else { } else {
arena_t *tarenas[narenas]; arena_t *tarenas[narenas];
@ -1202,7 +1202,7 @@ arenas_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
} }
ret = 0; ret = 0;
RETURN: label_return:
return (ret); return (ret);
} }
@ -1232,7 +1232,7 @@ prof_active_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
READ(oldval, bool); READ(oldval, bool);
ret = 0; ret = 0;
RETURN: label_return:
malloc_mutex_unlock(&ctl_mtx); malloc_mutex_unlock(&ctl_mtx);
return (ret); return (ret);
} }
@ -1252,11 +1252,11 @@ prof_dump_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
if (prof_mdump(filename)) { if (prof_mdump(filename)) {
ret = EFAULT; ret = EFAULT;
goto RETURN; goto label_return;
} }
ret = 0; ret = 0;
RETURN: label_return:
return (ret); return (ret);
} }
@ -1354,11 +1354,11 @@ stats_arenas_i_index(const size_t *mib, size_t miblen, size_t i)
malloc_mutex_lock(&ctl_mtx); malloc_mutex_lock(&ctl_mtx);
if (ctl_stats.arenas[i].initialized == false) { if (ctl_stats.arenas[i].initialized == false) {
ret = NULL; ret = NULL;
goto RETURN; goto label_return;
} }
ret = super_stats_arenas_i_node; ret = super_stats_arenas_i_node;
RETURN: label_return:
malloc_mutex_unlock(&ctl_mtx); malloc_mutex_unlock(&ctl_mtx);
return (ret); return (ret);
} }

View File

@ -742,7 +742,7 @@ je_malloc(size_t size)
if (malloc_init()) { if (malloc_init()) {
ret = NULL; ret = NULL;
goto OOM; goto label_oom;
} }
if (size == 0) if (size == 0)
@ -753,7 +753,7 @@ je_malloc(size_t size)
PROF_ALLOC_PREP(1, usize, cnt); PROF_ALLOC_PREP(1, usize, cnt);
if (cnt == NULL) { if (cnt == NULL) {
ret = NULL; ret = NULL;
goto OOM; goto label_oom;
} }
if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <= if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <=
SMALL_MAXCLASS) { SMALL_MAXCLASS) {
@ -768,7 +768,7 @@ je_malloc(size_t size)
ret = imalloc(size); ret = imalloc(size);
} }
OOM: label_oom:
if (ret == NULL) { if (ret == NULL) {
if (config_xmalloc && opt_xmalloc) { if (config_xmalloc && opt_xmalloc) {
malloc_write("<jemalloc>: Error in malloc(): " malloc_write("<jemalloc>: Error in malloc(): "
@ -822,14 +822,14 @@ imemalign(void **memptr, size_t alignment, size_t size,
} }
result = NULL; result = NULL;
ret = EINVAL; ret = EINVAL;
goto RETURN; goto label_return;
} }
usize = sa2u(size, alignment, NULL); usize = sa2u(size, alignment, NULL);
if (usize == 0) { if (usize == 0) {
result = NULL; result = NULL;
ret = ENOMEM; ret = ENOMEM;
goto RETURN; goto label_return;
} }
if (config_prof && opt_prof) { if (config_prof && opt_prof) {
@ -864,13 +864,13 @@ imemalign(void **memptr, size_t alignment, size_t size,
abort(); abort();
} }
ret = ENOMEM; ret = ENOMEM;
goto RETURN; goto label_return;
} }
*memptr = result; *memptr = result;
ret = 0; ret = 0;
RETURN: label_return:
if (config_stats && result != NULL) { if (config_stats && result != NULL) {
assert(usize == isalloc(result)); assert(usize == isalloc(result));
thread_allocated_tsd_get()->allocated += usize; thread_allocated_tsd_get()->allocated += usize;
@ -918,7 +918,7 @@ je_calloc(size_t num, size_t size)
if (malloc_init()) { if (malloc_init()) {
num_size = 0; num_size = 0;
ret = NULL; ret = NULL;
goto RETURN; goto label_return;
} }
num_size = num * size; num_size = num * size;
@ -927,7 +927,7 @@ je_calloc(size_t num, size_t size)
num_size = 1; num_size = 1;
else { else {
ret = NULL; ret = NULL;
goto RETURN; goto label_return;
} }
/* /*
* Try to avoid division here. We know that it isn't possible to * Try to avoid division here. We know that it isn't possible to
@ -938,7 +938,7 @@ je_calloc(size_t num, size_t size)
&& (num_size / size != num)) { && (num_size / size != num)) {
/* size_t overflow. */ /* size_t overflow. */
ret = NULL; ret = NULL;
goto RETURN; goto label_return;
} }
if (config_prof && opt_prof) { if (config_prof && opt_prof) {
@ -946,7 +946,7 @@ je_calloc(size_t num, size_t size)
PROF_ALLOC_PREP(1, usize, cnt); PROF_ALLOC_PREP(1, usize, cnt);
if (cnt == NULL) { if (cnt == NULL) {
ret = NULL; ret = NULL;
goto RETURN; goto label_return;
} }
if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize
<= SMALL_MAXCLASS) { <= SMALL_MAXCLASS) {
@ -961,7 +961,7 @@ je_calloc(size_t num, size_t size)
ret = icalloc(num_size); ret = icalloc(num_size);
} }
RETURN: label_return:
if (ret == NULL) { if (ret == NULL) {
if (config_xmalloc && opt_xmalloc) { if (config_xmalloc && opt_xmalloc) {
malloc_write("<jemalloc>: Error in calloc(): out of " malloc_write("<jemalloc>: Error in calloc(): out of "
@ -1002,7 +1002,7 @@ je_realloc(void *ptr, size_t size)
} }
idalloc(ptr); idalloc(ptr);
ret = NULL; ret = NULL;
goto RETURN; goto label_return;
} else } else
size = 1; size = 1;
} }
@ -1019,7 +1019,7 @@ je_realloc(void *ptr, size_t size)
if (cnt == NULL) { if (cnt == NULL) {
old_ctx = NULL; old_ctx = NULL;
ret = NULL; ret = NULL;
goto OOM; goto label_oom;
} }
if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U &&
usize <= SMALL_MAXCLASS) { usize <= SMALL_MAXCLASS) {
@ -1040,7 +1040,7 @@ je_realloc(void *ptr, size_t size)
ret = iralloc(ptr, size, 0, 0, false, false); ret = iralloc(ptr, size, 0, 0, false, false);
} }
OOM: label_oom:
if (ret == NULL) { if (ret == NULL) {
if (config_xmalloc && opt_xmalloc) { if (config_xmalloc && opt_xmalloc) {
malloc_write("<jemalloc>: Error in realloc(): " malloc_write("<jemalloc>: Error in realloc(): "
@ -1092,7 +1092,7 @@ OOM:
} }
} }
RETURN: label_return:
if (config_prof && opt_prof) if (config_prof && opt_prof)
prof_realloc(ret, usize, cnt, old_size, old_ctx); prof_realloc(ret, usize, cnt, old_size, old_ctx);
if (config_stats && ret != NULL) { if (config_stats && ret != NULL) {
@ -1300,16 +1300,16 @@ je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
assert(size != 0); assert(size != 0);
if (malloc_init()) if (malloc_init())
goto OOM; goto label_oom;
usize = (alignment == 0) ? s2u(size) : sa2u(size, alignment, NULL); usize = (alignment == 0) ? s2u(size) : sa2u(size, alignment, NULL);
if (usize == 0) if (usize == 0)
goto OOM; goto label_oom;
if (config_prof && opt_prof) { if (config_prof && opt_prof) {
PROF_ALLOC_PREP(1, usize, cnt); PROF_ALLOC_PREP(1, usize, cnt);
if (cnt == NULL) if (cnt == NULL)
goto OOM; goto label_oom;
if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <= if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <=
SMALL_MAXCLASS) { SMALL_MAXCLASS) {
size_t usize_promoted = (alignment == 0) ? size_t usize_promoted = (alignment == 0) ?
@ -1318,18 +1318,18 @@ je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
assert(usize_promoted != 0); assert(usize_promoted != 0);
p = iallocm(usize_promoted, alignment, zero); p = iallocm(usize_promoted, alignment, zero);
if (p == NULL) if (p == NULL)
goto OOM; goto label_oom;
arena_prof_promoted(p, usize); arena_prof_promoted(p, usize);
} else { } else {
p = iallocm(usize, alignment, zero); p = iallocm(usize, alignment, zero);
if (p == NULL) if (p == NULL)
goto OOM; goto label_oom;
} }
prof_malloc(p, usize, cnt); prof_malloc(p, usize, cnt);
} else { } else {
p = iallocm(usize, alignment, zero); p = iallocm(usize, alignment, zero);
if (p == NULL) if (p == NULL)
goto OOM; goto label_oom;
} }
if (rsize != NULL) if (rsize != NULL)
*rsize = usize; *rsize = usize;
@ -1341,7 +1341,7 @@ je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
} }
UTRACE(0, size, p); UTRACE(0, size, p);
return (ALLOCM_SUCCESS); return (ALLOCM_SUCCESS);
OOM: label_oom:
if (config_xmalloc && opt_xmalloc) { if (config_xmalloc && opt_xmalloc) {
malloc_write("<jemalloc>: Error in allocm(): " malloc_write("<jemalloc>: Error in allocm(): "
"out of memory\n"); "out of memory\n");
@ -1387,7 +1387,7 @@ je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags)
old_size = isalloc(p); old_size = isalloc(p);
PROF_ALLOC_PREP(1, max_usize, cnt); PROF_ALLOC_PREP(1, max_usize, cnt);
if (cnt == NULL) if (cnt == NULL)
goto OOM; goto label_oom;
/* /*
* Use minimum usize to determine whether promotion may happen. * Use minimum usize to determine whether promotion may happen.
*/ */
@ -1398,7 +1398,7 @@ je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags)
size+extra) ? 0 : size+extra - (SMALL_MAXCLASS+1), size+extra) ? 0 : size+extra - (SMALL_MAXCLASS+1),
alignment, zero, no_move); alignment, zero, no_move);
if (q == NULL) if (q == NULL)
goto ERR; goto label_err;
if (max_usize < PAGE) { if (max_usize < PAGE) {
usize = max_usize; usize = max_usize;
arena_prof_promoted(q, usize); arena_prof_promoted(q, usize);
@ -1407,7 +1407,7 @@ je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags)
} else { } else {
q = iralloc(p, size, extra, alignment, zero, no_move); q = iralloc(p, size, extra, alignment, zero, no_move);
if (q == NULL) if (q == NULL)
goto ERR; goto label_err;
usize = isalloc(q); usize = isalloc(q);
} }
prof_realloc(q, usize, cnt, old_size, old_ctx); prof_realloc(q, usize, cnt, old_size, old_ctx);
@ -1418,7 +1418,7 @@ je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags)
old_size = isalloc(p); old_size = isalloc(p);
q = iralloc(p, size, extra, alignment, zero, no_move); q = iralloc(p, size, extra, alignment, zero, no_move);
if (q == NULL) if (q == NULL)
goto ERR; goto label_err;
if (config_stats) if (config_stats)
usize = isalloc(q); usize = isalloc(q);
if (rsize != NULL) { if (rsize != NULL) {
@ -1437,12 +1437,12 @@ je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags)
} }
UTRACE(p, size, q); UTRACE(p, size, q);
return (ALLOCM_SUCCESS); return (ALLOCM_SUCCESS);
ERR: label_err:
if (no_move) { if (no_move) {
UTRACE(p, size, q); UTRACE(p, size, q);
return (ALLOCM_ERR_NOT_MOVED); return (ALLOCM_ERR_NOT_MOVED);
} }
OOM: label_oom:
if (config_xmalloc && opt_xmalloc) { if (config_xmalloc && opt_xmalloc) {
malloc_write("<jemalloc>: Error in rallocm(): " malloc_write("<jemalloc>: Error in rallocm(): "
"out of memory\n"); "out of memory\n");

View File

@ -854,7 +854,7 @@ prof_dump(bool propagate_err, const char *filename, bool leakcheck)
if (opt_abort) if (opt_abort)
abort(); abort();
} }
goto ERROR; goto label_error;
} }
/* Merge per thread profile stats, and sum them in cnt_all. */ /* Merge per thread profile stats, and sum them in cnt_all. */
@ -870,7 +870,7 @@ prof_dump(bool propagate_err, const char *filename, bool leakcheck)
" [%"PRIu64": %"PRIu64"] @ heapprofile\n", " [%"PRIu64": %"PRIu64"] @ heapprofile\n",
cnt_all.curobjs, cnt_all.curbytes, cnt_all.curobjs, cnt_all.curbytes,
cnt_all.accumobjs, cnt_all.accumbytes)) cnt_all.accumobjs, cnt_all.accumbytes))
goto ERROR; goto label_error;
} else { } else {
if (prof_printf(propagate_err, if (prof_printf(propagate_err,
"heap profile: %"PRId64": %"PRId64 "heap profile: %"PRId64": %"PRId64
@ -878,22 +878,22 @@ prof_dump(bool propagate_err, const char *filename, bool leakcheck)
cnt_all.curobjs, cnt_all.curbytes, cnt_all.curobjs, cnt_all.curbytes,
cnt_all.accumobjs, cnt_all.accumbytes, cnt_all.accumobjs, cnt_all.accumbytes,
((uint64_t)1U << opt_lg_prof_sample))) ((uint64_t)1U << opt_lg_prof_sample)))
goto ERROR; goto label_error;
} }
/* Dump per ctx profile stats. */ /* Dump per ctx profile stats. */
for (tabind = 0; ckh_iter(&bt2ctx, &tabind, &bt.v, &ctx.v) for (tabind = 0; ckh_iter(&bt2ctx, &tabind, &bt.v, &ctx.v)
== false;) { == false;) {
if (prof_dump_ctx(propagate_err, ctx.p, bt.p)) if (prof_dump_ctx(propagate_err, ctx.p, bt.p))
goto ERROR; goto label_error;
} }
/* Dump /proc/<pid>/maps if possible. */ /* Dump /proc/<pid>/maps if possible. */
if (prof_dump_maps(propagate_err)) if (prof_dump_maps(propagate_err))
goto ERROR; goto label_error;
if (prof_flush(propagate_err)) if (prof_flush(propagate_err))
goto ERROR; goto label_error;
close(prof_dump_fd); close(prof_dump_fd);
prof_leave(); prof_leave();
@ -909,7 +909,7 @@ prof_dump(bool propagate_err, const char *filename, bool leakcheck)
} }
return (false); return (false);
ERROR: label_error:
prof_leave(); prof_leave();
return (true); return (true);
} }

View File

@ -108,12 +108,12 @@ malloc_strtoumax(const char *nptr, char **endptr, int base)
p++; p++;
/* Fall through. */ /* Fall through. */
default: default:
goto PREFIX; goto label_prefix;
} }
} }
/* Get prefix, if any. */ /* Get prefix, if any. */
PREFIX: label_prefix:
/* /*
* Note where the first non-whitespace/sign character is so that it is * Note where the first non-whitespace/sign character is so that it is
* possible to tell whether any digits are consumed (e.g., " 0" vs. * possible to tell whether any digits are consumed (e.g., " 0" vs.
@ -349,7 +349,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
f = format; f = format;
while (true) { while (true) {
switch (*f) { switch (*f) {
case '\0': goto OUT; case '\0': goto label_out;
case '%': { case '%': {
bool alt_form = false; bool alt_form = false;
bool zero_pad = false; bool zero_pad = false;
@ -389,12 +389,12 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
assert(plus_plus == false); assert(plus_plus == false);
plus_plus = true; plus_plus = true;
break; break;
default: goto WIDTH; default: goto label_width;
} }
f++; f++;
} }
/* Width. */ /* Width. */
WIDTH: label_width:
switch (*f) { switch (*f) {
case '*': case '*':
width = va_arg(ap, int); width = va_arg(ap, int);
@ -410,17 +410,17 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
width = (int)uwidth; width = (int)uwidth;
if (*f == '.') { if (*f == '.') {
f++; f++;
goto PRECISION; goto label_precision;
} else } else
goto LENGTH; goto label_length;
break; break;
} case '.': } case '.':
f++; f++;
goto PRECISION; goto label_precision;
default: goto LENGTH; default: goto label_length;
} }
/* Precision. */ /* Precision. */
PRECISION: label_precision:
switch (*f) { switch (*f) {
case '*': case '*':
prec = va_arg(ap, int); prec = va_arg(ap, int);
@ -438,7 +438,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
default: break; default: break;
} }
/* Length. */ /* Length. */
LENGTH: label_length:
switch (*f) { switch (*f) {
case 'l': case 'l':
f++; f++;
@ -542,7 +542,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
break; break;
}} }}
} }
OUT: label_out:
if (i < size) if (i < size)
str[i] = '\0'; str[i] = '\0';
else else

View File

@ -25,7 +25,7 @@ thread_start(void *arg)
#ifdef JEMALLOC_STATS #ifdef JEMALLOC_STATS
assert(false); assert(false);
#endif #endif
goto RETURN; goto label_return;
} }
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
strerror(err)); strerror(err));
@ -37,7 +37,7 @@ thread_start(void *arg)
#ifdef JEMALLOC_STATS #ifdef JEMALLOC_STATS
assert(false); assert(false);
#endif #endif
goto RETURN; goto label_return;
} }
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
strerror(err)); strerror(err));
@ -51,7 +51,7 @@ thread_start(void *arg)
#ifdef JEMALLOC_STATS #ifdef JEMALLOC_STATS
assert(false); assert(false);
#endif #endif
goto RETURN; goto label_return;
} }
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
strerror(err)); strerror(err));
@ -63,7 +63,7 @@ thread_start(void *arg)
#ifdef JEMALLOC_STATS #ifdef JEMALLOC_STATS
assert(false); assert(false);
#endif #endif
goto RETURN; goto label_return;
} }
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
strerror(err)); strerror(err));
@ -98,7 +98,7 @@ thread_start(void *arg)
assert(d0 + usize <= d1); assert(d0 + usize <= d1);
RETURN: label_return:
return (NULL); return (NULL);
} }
@ -116,7 +116,7 @@ main(void)
!= 0) { != 0) {
fprintf(stderr, "%s(): Error in pthread_create()\n", __func__); fprintf(stderr, "%s(): Error in pthread_create()\n", __func__);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
pthread_join(thread, (void *)&ret); pthread_join(thread, (void *)&ret);
@ -126,13 +126,13 @@ main(void)
!= 0) { != 0) {
fprintf(stderr, "%s(): Error in pthread_create()\n", __func__); fprintf(stderr, "%s(): Error in pthread_create()\n", __func__);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
pthread_join(thread, (void *)&ret); pthread_join(thread, (void *)&ret);
thread_start(NULL); thread_start(NULL);
RETURN: label_return:
fprintf(stderr, "Test end\n"); fprintf(stderr, "Test end\n");
return (ret); return (ret);
} }

View File

@ -22,7 +22,7 @@ main(void)
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
strerror(err)); strerror(err));
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
chunksize = ((size_t)1U) << lg_chunk; chunksize = ((size_t)1U) << lg_chunk;
@ -30,7 +30,7 @@ main(void)
if (p == NULL) { if (p == NULL) {
fprintf(stderr, "malloc(%zu) --> %p\n", chunksize, p); fprintf(stderr, "malloc(%zu) --> %p\n", chunksize, p);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
memset(p, 'a', chunksize); memset(p, 'a', chunksize);
@ -39,7 +39,7 @@ main(void)
fprintf(stderr, "realloc(%p, %zu) --> %p\n", p, chunksize * 2, fprintf(stderr, "realloc(%p, %zu) --> %p\n", p, chunksize * 2,
q); q);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
for (i = 0; i < chunksize; i++) { for (i = 0; i < chunksize; i++) {
assert(q[i] == 'a'); assert(q[i] == 'a');
@ -51,7 +51,7 @@ main(void)
if (q == NULL) { if (q == NULL) {
fprintf(stderr, "realloc(%p, %zu) --> %p\n", p, chunksize, q); fprintf(stderr, "realloc(%p, %zu) --> %p\n", p, chunksize, q);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
for (i = 0; i < chunksize; i++) { for (i = 0; i < chunksize; i++) {
assert(q[i] == 'a'); assert(q[i] == 'a');
@ -60,7 +60,7 @@ main(void)
free(q); free(q);
ret = 0; ret = 0;
RETURN: label_return:
fprintf(stderr, "Test end\n"); fprintf(stderr, "Test end\n");
return (ret); return (ret);
} }

View File

@ -61,7 +61,7 @@ main(void)
if (p == NULL) { if (p == NULL) {
fprintf(stderr, "%s(): Error in malloc()\n", __func__); fprintf(stderr, "%s(): Error in malloc()\n", __func__);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
size = sizeof(arena_ind); size = sizeof(arena_ind);
@ -69,7 +69,7 @@ main(void)
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__, fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
strerror(err)); strerror(err));
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
for (i = 0; i < NTHREADS; i++) { for (i = 0; i < NTHREADS; i++) {
@ -78,14 +78,14 @@ main(void)
fprintf(stderr, "%s(): Error in pthread_create()\n", fprintf(stderr, "%s(): Error in pthread_create()\n",
__func__); __func__);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
} }
for (i = 0; i < NTHREADS; i++) for (i = 0; i < NTHREADS; i++)
pthread_join(threads[i], (void *)&ret); pthread_join(threads[i], (void *)&ret);
RETURN: label_return:
fprintf(stderr, "Test end\n"); fprintf(stderr, "Test end\n");
return (ret); return (ret);
} }

View File

@ -22,7 +22,7 @@ thread_start(void *arg)
assert(false); assert(false);
#endif #endif
} }
goto RETURN; goto label_return;
} }
if (e0) { if (e0) {
@ -69,7 +69,7 @@ thread_start(void *arg)
assert(e0 == false); assert(e0 == false);
free(malloc(1)); free(malloc(1));
RETURN: label_return:
return (NULL); return (NULL);
} }
@ -87,7 +87,7 @@ main(void)
!= 0) { != 0) {
fprintf(stderr, "%s(): Error in pthread_create()\n", __func__); fprintf(stderr, "%s(): Error in pthread_create()\n", __func__);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
pthread_join(thread, (void *)&ret); pthread_join(thread, (void *)&ret);
@ -97,13 +97,13 @@ main(void)
!= 0) { != 0) {
fprintf(stderr, "%s(): Error in pthread_create()\n", __func__); fprintf(stderr, "%s(): Error in pthread_create()\n", __func__);
ret = 1; ret = 1;
goto RETURN; goto label_return;
} }
pthread_join(thread, (void *)&ret); pthread_join(thread, (void *)&ret);
thread_start(NULL); thread_start(NULL);
RETURN: label_return:
fprintf(stderr, "Test end\n"); fprintf(stderr, "Test end\n");
return (ret); return (ret);
} }