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:
parent
eae269036c
commit
a1ee7838e1
@ -38,17 +38,17 @@ chunk_alloc(size_t size, size_t alignment, bool base, bool *zero)
|
||||
if (config_dss) {
|
||||
ret = chunk_alloc_dss(size, alignment, zero);
|
||||
if (ret != NULL)
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
ret = chunk_alloc_mmap(size, alignment);
|
||||
if (ret != NULL) {
|
||||
*zero = true;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
/* All strategies for allocation failed. */
|
||||
ret = NULL;
|
||||
RETURN:
|
||||
label_return:
|
||||
if (config_ivsalloc && base == false && ret != NULL) {
|
||||
if (rtree_set(chunks_rtree, (uintptr_t)ret, ret)) {
|
||||
chunk_dealloc(ret, size, true);
|
||||
|
@ -293,11 +293,11 @@ chunk_dealloc_dss(void *chunk, size_t size)
|
||||
madvise(chunk, size, MADV_DONTNEED);
|
||||
|
||||
ret = false;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
ret = true;
|
||||
RETURN:
|
||||
label_return:
|
||||
malloc_mutex_unlock(&dss_mtx);
|
||||
return (ret);
|
||||
}
|
||||
|
16
src/ckh.c
16
src/ckh.c
@ -267,12 +267,12 @@ ckh_grow(ckh_t *ckh)
|
||||
usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE, NULL);
|
||||
if (usize == 0) {
|
||||
ret = true;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
tab = (ckhc_t *)ipalloc(usize, CACHELINE, true);
|
||||
if (tab == NULL) {
|
||||
ret = true;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
/* Swap in new table. */
|
||||
ttab = ckh->tab;
|
||||
@ -292,7 +292,7 @@ ckh_grow(ckh_t *ckh)
|
||||
}
|
||||
|
||||
ret = false;
|
||||
RETURN:
|
||||
label_return:
|
||||
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);
|
||||
if (usize == 0) {
|
||||
ret = true;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
ckh->tab = (ckhc_t *)ipalloc(usize, CACHELINE, true);
|
||||
if (ckh->tab == NULL) {
|
||||
ret = true;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
ret = false;
|
||||
RETURN:
|
||||
label_return:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -466,12 +466,12 @@ ckh_insert(ckh_t *ckh, const void *key, const void *data)
|
||||
while (ckh_try_insert(ckh, &key, &data)) {
|
||||
if (ckh_grow(ckh)) {
|
||||
ret = true;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
}
|
||||
|
||||
ret = false;
|
||||
RETURN:
|
||||
label_return:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
|
92
src/ctl.c
92
src/ctl.c
@ -546,7 +546,7 @@ ctl_init(void)
|
||||
(narenas + 1) * sizeof(ctl_arena_stats_t));
|
||||
if (ctl_stats.arenas == NULL) {
|
||||
ret = true;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
memset(ctl_stats.arenas, 0, (narenas + 1) *
|
||||
sizeof(ctl_arena_stats_t));
|
||||
@ -561,7 +561,7 @@ ctl_init(void)
|
||||
for (i = 0; i <= narenas; i++) {
|
||||
if (ctl_arena_init(&ctl_stats.arenas[i])) {
|
||||
ret = true;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -573,7 +573,7 @@ ctl_init(void)
|
||||
}
|
||||
|
||||
ret = false;
|
||||
RETURN:
|
||||
label_return:
|
||||
malloc_mutex_unlock(&ctl_mtx);
|
||||
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);
|
||||
if (elen == 0) {
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
node = super_root_node;
|
||||
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) {
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
} else {
|
||||
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);
|
||||
if (index == UINTMAX_MAX || index > SIZE_T_MAX) {
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
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);
|
||||
if (node == NULL) {
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
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.
|
||||
*/
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
/* Complete lookup successful. */
|
||||
*depthp = i + 1;
|
||||
@ -663,7 +663,7 @@ ctl_lookup(const char *name, ctl_node_t const **nodesp, size_t *mibp,
|
||||
if (*dot == '\0') {
|
||||
/* No more elements. */
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
elm = &dot[1];
|
||||
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;
|
||||
RETURN:
|
||||
label_return:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -687,22 +687,22 @@ ctl_byname(const char *name, void *oldp, size_t *oldlenp, void *newp,
|
||||
|
||||
if (ctl_initialized == false && ctl_init()) {
|
||||
ret = EAGAIN;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
depth = CTL_MAX_DEPTH;
|
||||
ret = ctl_lookup(name, nodes, mib, &depth);
|
||||
if (ret != 0)
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
|
||||
if (nodes[depth-1]->ctl == NULL) {
|
||||
/* The name refers to a partial path through the ctl tree. */
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
ret = nodes[depth-1]->ctl(mib, depth, oldp, oldlenp, newp, newlen);
|
||||
RETURN:
|
||||
label_return:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -713,11 +713,11 @@ ctl_nametomib(const char *name, size_t *mibp, size_t *miblenp)
|
||||
|
||||
if (ctl_initialized == false && ctl_init()) {
|
||||
ret = EAGAIN;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
ret = ctl_lookup(name, NULL, mibp, miblenp);
|
||||
RETURN:
|
||||
label_return:
|
||||
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()) {
|
||||
ret = EAGAIN;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
/* 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. */
|
||||
if (node->u.named.nchildren <= mib[i]) {
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
node = &node->u.named.children[mib[i]];
|
||||
} 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]);
|
||||
if (node == NULL) {
|
||||
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) {
|
||||
/* Partial MIB. */
|
||||
ret = ENOENT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
ret = node->ctl(mib, miblen, oldp, oldlenp, newp, newlen);
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -787,14 +787,14 @@ ctl_boot(void)
|
||||
#define READONLY() do { \
|
||||
if (newp != NULL || newlen != 0) { \
|
||||
ret = EPERM; \
|
||||
goto RETURN; \
|
||||
goto label_return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define WRITEONLY() do { \
|
||||
if (oldp != NULL || oldlenp != NULL) { \
|
||||
ret = EPERM; \
|
||||
goto RETURN; \
|
||||
goto label_return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@ -810,7 +810,7 @@ ctl_boot(void)
|
||||
? sizeof(t) : *oldlenp; \
|
||||
memcpy(oldp, (void *)&v, copylen); \
|
||||
ret = EINVAL; \
|
||||
goto RETURN; \
|
||||
goto label_return; \
|
||||
} else \
|
||||
*(t *)oldp = v; \
|
||||
} \
|
||||
@ -820,7 +820,7 @@ ctl_boot(void)
|
||||
if (newp != NULL) { \
|
||||
if (newlen != sizeof(t)) { \
|
||||
ret = EINVAL; \
|
||||
goto RETURN; \
|
||||
goto label_return; \
|
||||
} \
|
||||
v = *(t *)newp; \
|
||||
} \
|
||||
@ -847,7 +847,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
|
||||
READ(oldval, t); \
|
||||
\
|
||||
ret = 0; \
|
||||
RETURN: \
|
||||
label_return: \
|
||||
if (l) \
|
||||
malloc_mutex_unlock(&ctl_mtx); \
|
||||
return (ret); \
|
||||
@ -869,7 +869,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
|
||||
READ(oldval, t); \
|
||||
\
|
||||
ret = 0; \
|
||||
RETURN: \
|
||||
label_return: \
|
||||
malloc_mutex_unlock(&ctl_mtx); \
|
||||
return (ret); \
|
||||
}
|
||||
@ -888,7 +888,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
|
||||
READ(oldval, t); \
|
||||
\
|
||||
ret = 0; \
|
||||
RETURN: \
|
||||
label_return: \
|
||||
malloc_mutex_unlock(&ctl_mtx); \
|
||||
return (ret); \
|
||||
}
|
||||
@ -912,7 +912,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
|
||||
READ(oldval, t); \
|
||||
\
|
||||
ret = 0; \
|
||||
RETURN: \
|
||||
label_return: \
|
||||
return (ret); \
|
||||
}
|
||||
|
||||
@ -929,7 +929,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
|
||||
READ(oldval, t); \
|
||||
\
|
||||
ret = 0; \
|
||||
RETURN: \
|
||||
label_return: \
|
||||
return (ret); \
|
||||
}
|
||||
|
||||
@ -946,7 +946,7 @@ n##_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, \
|
||||
READ(oldval, bool); \
|
||||
\
|
||||
ret = 0; \
|
||||
RETURN: \
|
||||
label_return: \
|
||||
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);
|
||||
|
||||
ret = 0;
|
||||
RETURN:
|
||||
label_return:
|
||||
malloc_mutex_unlock(&ctl_mtx);
|
||||
return (ret);
|
||||
}
|
||||
@ -986,13 +986,13 @@ thread_tcache_enabled_ctl(const size_t *mib, size_t miblen, void *oldp,
|
||||
if (newp != NULL) {
|
||||
if (newlen != sizeof(bool)) {
|
||||
ret = EINVAL;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
tcache_enabled_set(*(bool *)newp);
|
||||
}
|
||||
READ(oldval, bool);
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
ret = 0;
|
||||
return (ret);
|
||||
}
|
||||
@ -1011,7 +1011,7 @@ thread_tcache_flush_ctl(const size_t *mib, size_t miblen, void *oldp,
|
||||
tcache_flush();
|
||||
|
||||
ret = 0;
|
||||
RETURN:
|
||||
label_return:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -1031,7 +1031,7 @@ thread_arena_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
|
||||
if (newind >= narenas) {
|
||||
/* New arena index is out of range. */
|
||||
ret = EFAULT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
malloc_mutex_unlock(&arenas_lock);
|
||||
ret = EAGAIN;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
assert(arena == arenas[newind]);
|
||||
arenas[oldind]->nthreads--;
|
||||
@ -1059,7 +1059,7 @@ thread_arena_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
RETURN:
|
||||
label_return:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -1156,7 +1156,7 @@ arenas_initialized_ctl(const size_t *mib, size_t miblen, void *oldp,
|
||||
for (i = 0; i < nread; i++)
|
||||
((bool *)oldp)[i] = ctl_stats.arenas[i].initialized;
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
malloc_mutex_unlock(&ctl_mtx);
|
||||
return (ret);
|
||||
}
|
||||
@ -1180,7 +1180,7 @@ arenas_purge_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
|
||||
WRITE(arena, unsigned);
|
||||
if (newp != NULL && arena >= narenas) {
|
||||
ret = EFAULT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
} else {
|
||||
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;
|
||||
RETURN:
|
||||
label_return:
|
||||
return (ret);
|
||||
}
|
||||
|
||||
@ -1232,7 +1232,7 @@ prof_active_ctl(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
|
||||
READ(oldval, bool);
|
||||
|
||||
ret = 0;
|
||||
RETURN:
|
||||
label_return:
|
||||
malloc_mutex_unlock(&ctl_mtx);
|
||||
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)) {
|
||||
ret = EFAULT;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
RETURN:
|
||||
label_return:
|
||||
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);
|
||||
if (ctl_stats.arenas[i].initialized == false) {
|
||||
ret = NULL;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
ret = super_stats_arenas_i_node;
|
||||
RETURN:
|
||||
label_return:
|
||||
malloc_mutex_unlock(&ctl_mtx);
|
||||
return (ret);
|
||||
}
|
||||
|
@ -742,7 +742,7 @@ je_malloc(size_t size)
|
||||
|
||||
if (malloc_init()) {
|
||||
ret = NULL;
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
@ -753,7 +753,7 @@ je_malloc(size_t size)
|
||||
PROF_ALLOC_PREP(1, usize, cnt);
|
||||
if (cnt == NULL) {
|
||||
ret = NULL;
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
}
|
||||
if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <=
|
||||
SMALL_MAXCLASS) {
|
||||
@ -768,7 +768,7 @@ je_malloc(size_t size)
|
||||
ret = imalloc(size);
|
||||
}
|
||||
|
||||
OOM:
|
||||
label_oom:
|
||||
if (ret == NULL) {
|
||||
if (config_xmalloc && opt_xmalloc) {
|
||||
malloc_write("<jemalloc>: Error in malloc(): "
|
||||
@ -822,14 +822,14 @@ imemalign(void **memptr, size_t alignment, size_t size,
|
||||
}
|
||||
result = NULL;
|
||||
ret = EINVAL;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
usize = sa2u(size, alignment, NULL);
|
||||
if (usize == 0) {
|
||||
result = NULL;
|
||||
ret = ENOMEM;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
if (config_prof && opt_prof) {
|
||||
@ -864,13 +864,13 @@ imemalign(void **memptr, size_t alignment, size_t size,
|
||||
abort();
|
||||
}
|
||||
ret = ENOMEM;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
*memptr = result;
|
||||
ret = 0;
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
if (config_stats && result != NULL) {
|
||||
assert(usize == isalloc(result));
|
||||
thread_allocated_tsd_get()->allocated += usize;
|
||||
@ -918,7 +918,7 @@ je_calloc(size_t num, size_t size)
|
||||
if (malloc_init()) {
|
||||
num_size = 0;
|
||||
ret = NULL;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
num_size = num * size;
|
||||
@ -927,7 +927,7 @@ je_calloc(size_t num, size_t size)
|
||||
num_size = 1;
|
||||
else {
|
||||
ret = NULL;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
/*
|
||||
* 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)) {
|
||||
/* size_t overflow. */
|
||||
ret = NULL;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
if (config_prof && opt_prof) {
|
||||
@ -946,7 +946,7 @@ je_calloc(size_t num, size_t size)
|
||||
PROF_ALLOC_PREP(1, usize, cnt);
|
||||
if (cnt == NULL) {
|
||||
ret = NULL;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize
|
||||
<= SMALL_MAXCLASS) {
|
||||
@ -961,7 +961,7 @@ je_calloc(size_t num, size_t size)
|
||||
ret = icalloc(num_size);
|
||||
}
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
if (ret == NULL) {
|
||||
if (config_xmalloc && opt_xmalloc) {
|
||||
malloc_write("<jemalloc>: Error in calloc(): out of "
|
||||
@ -1002,7 +1002,7 @@ je_realloc(void *ptr, size_t size)
|
||||
}
|
||||
idalloc(ptr);
|
||||
ret = NULL;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
} else
|
||||
size = 1;
|
||||
}
|
||||
@ -1019,7 +1019,7 @@ je_realloc(void *ptr, size_t size)
|
||||
if (cnt == NULL) {
|
||||
old_ctx = NULL;
|
||||
ret = NULL;
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
}
|
||||
if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U &&
|
||||
usize <= SMALL_MAXCLASS) {
|
||||
@ -1040,7 +1040,7 @@ je_realloc(void *ptr, size_t size)
|
||||
ret = iralloc(ptr, size, 0, 0, false, false);
|
||||
}
|
||||
|
||||
OOM:
|
||||
label_oom:
|
||||
if (ret == NULL) {
|
||||
if (config_xmalloc && opt_xmalloc) {
|
||||
malloc_write("<jemalloc>: Error in realloc(): "
|
||||
@ -1092,7 +1092,7 @@ OOM:
|
||||
}
|
||||
}
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
if (config_prof && opt_prof)
|
||||
prof_realloc(ret, usize, cnt, old_size, old_ctx);
|
||||
if (config_stats && ret != NULL) {
|
||||
@ -1300,16 +1300,16 @@ je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
|
||||
assert(size != 0);
|
||||
|
||||
if (malloc_init())
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
|
||||
usize = (alignment == 0) ? s2u(size) : sa2u(size, alignment, NULL);
|
||||
if (usize == 0)
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
|
||||
if (config_prof && opt_prof) {
|
||||
PROF_ALLOC_PREP(1, usize, cnt);
|
||||
if (cnt == NULL)
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U && usize <=
|
||||
SMALL_MAXCLASS) {
|
||||
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);
|
||||
p = iallocm(usize_promoted, alignment, zero);
|
||||
if (p == NULL)
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
arena_prof_promoted(p, usize);
|
||||
} else {
|
||||
p = iallocm(usize, alignment, zero);
|
||||
if (p == NULL)
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
}
|
||||
prof_malloc(p, usize, cnt);
|
||||
} else {
|
||||
p = iallocm(usize, alignment, zero);
|
||||
if (p == NULL)
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
}
|
||||
if (rsize != NULL)
|
||||
*rsize = usize;
|
||||
@ -1341,7 +1341,7 @@ je_allocm(void **ptr, size_t *rsize, size_t size, int flags)
|
||||
}
|
||||
UTRACE(0, size, p);
|
||||
return (ALLOCM_SUCCESS);
|
||||
OOM:
|
||||
label_oom:
|
||||
if (config_xmalloc && opt_xmalloc) {
|
||||
malloc_write("<jemalloc>: Error in allocm(): "
|
||||
"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);
|
||||
PROF_ALLOC_PREP(1, max_usize, cnt);
|
||||
if (cnt == NULL)
|
||||
goto OOM;
|
||||
goto label_oom;
|
||||
/*
|
||||
* 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),
|
||||
alignment, zero, no_move);
|
||||
if (q == NULL)
|
||||
goto ERR;
|
||||
goto label_err;
|
||||
if (max_usize < PAGE) {
|
||||
usize = max_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 {
|
||||
q = iralloc(p, size, extra, alignment, zero, no_move);
|
||||
if (q == NULL)
|
||||
goto ERR;
|
||||
goto label_err;
|
||||
usize = isalloc(q);
|
||||
}
|
||||
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);
|
||||
q = iralloc(p, size, extra, alignment, zero, no_move);
|
||||
if (q == NULL)
|
||||
goto ERR;
|
||||
goto label_err;
|
||||
if (config_stats)
|
||||
usize = isalloc(q);
|
||||
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);
|
||||
return (ALLOCM_SUCCESS);
|
||||
ERR:
|
||||
label_err:
|
||||
if (no_move) {
|
||||
UTRACE(p, size, q);
|
||||
return (ALLOCM_ERR_NOT_MOVED);
|
||||
}
|
||||
OOM:
|
||||
label_oom:
|
||||
if (config_xmalloc && opt_xmalloc) {
|
||||
malloc_write("<jemalloc>: Error in rallocm(): "
|
||||
"out of memory\n");
|
||||
|
14
src/prof.c
14
src/prof.c
@ -854,7 +854,7 @@ prof_dump(bool propagate_err, const char *filename, bool leakcheck)
|
||||
if (opt_abort)
|
||||
abort();
|
||||
}
|
||||
goto ERROR;
|
||||
goto label_error;
|
||||
}
|
||||
|
||||
/* 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",
|
||||
cnt_all.curobjs, cnt_all.curbytes,
|
||||
cnt_all.accumobjs, cnt_all.accumbytes))
|
||||
goto ERROR;
|
||||
goto label_error;
|
||||
} else {
|
||||
if (prof_printf(propagate_err,
|
||||
"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.accumobjs, cnt_all.accumbytes,
|
||||
((uint64_t)1U << opt_lg_prof_sample)))
|
||||
goto ERROR;
|
||||
goto label_error;
|
||||
}
|
||||
|
||||
/* Dump per ctx profile stats. */
|
||||
for (tabind = 0; ckh_iter(&bt2ctx, &tabind, &bt.v, &ctx.v)
|
||||
== false;) {
|
||||
if (prof_dump_ctx(propagate_err, ctx.p, bt.p))
|
||||
goto ERROR;
|
||||
goto label_error;
|
||||
}
|
||||
|
||||
/* Dump /proc/<pid>/maps if possible. */
|
||||
if (prof_dump_maps(propagate_err))
|
||||
goto ERROR;
|
||||
goto label_error;
|
||||
|
||||
if (prof_flush(propagate_err))
|
||||
goto ERROR;
|
||||
goto label_error;
|
||||
close(prof_dump_fd);
|
||||
prof_leave();
|
||||
|
||||
@ -909,7 +909,7 @@ prof_dump(bool propagate_err, const char *filename, bool leakcheck)
|
||||
}
|
||||
|
||||
return (false);
|
||||
ERROR:
|
||||
label_error:
|
||||
prof_leave();
|
||||
return (true);
|
||||
}
|
||||
|
24
src/util.c
24
src/util.c
@ -108,12 +108,12 @@ malloc_strtoumax(const char *nptr, char **endptr, int base)
|
||||
p++;
|
||||
/* Fall through. */
|
||||
default:
|
||||
goto PREFIX;
|
||||
goto label_prefix;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get prefix, if any. */
|
||||
PREFIX:
|
||||
label_prefix:
|
||||
/*
|
||||
* 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.
|
||||
@ -349,7 +349,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
f = format;
|
||||
while (true) {
|
||||
switch (*f) {
|
||||
case '\0': goto OUT;
|
||||
case '\0': goto label_out;
|
||||
case '%': {
|
||||
bool alt_form = 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);
|
||||
plus_plus = true;
|
||||
break;
|
||||
default: goto WIDTH;
|
||||
default: goto label_width;
|
||||
}
|
||||
f++;
|
||||
}
|
||||
/* Width. */
|
||||
WIDTH:
|
||||
label_width:
|
||||
switch (*f) {
|
||||
case '*':
|
||||
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;
|
||||
if (*f == '.') {
|
||||
f++;
|
||||
goto PRECISION;
|
||||
goto label_precision;
|
||||
} else
|
||||
goto LENGTH;
|
||||
goto label_length;
|
||||
break;
|
||||
} case '.':
|
||||
f++;
|
||||
goto PRECISION;
|
||||
default: goto LENGTH;
|
||||
goto label_precision;
|
||||
default: goto label_length;
|
||||
}
|
||||
/* Precision. */
|
||||
PRECISION:
|
||||
label_precision:
|
||||
switch (*f) {
|
||||
case '*':
|
||||
prec = va_arg(ap, int);
|
||||
@ -438,7 +438,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
default: break;
|
||||
}
|
||||
/* Length. */
|
||||
LENGTH:
|
||||
label_length:
|
||||
switch (*f) {
|
||||
case 'l':
|
||||
f++;
|
||||
@ -542,7 +542,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
break;
|
||||
}}
|
||||
}
|
||||
OUT:
|
||||
label_out:
|
||||
if (i < size)
|
||||
str[i] = '\0';
|
||||
else
|
||||
|
@ -25,7 +25,7 @@ thread_start(void *arg)
|
||||
#ifdef JEMALLOC_STATS
|
||||
assert(false);
|
||||
#endif
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
|
||||
strerror(err));
|
||||
@ -37,7 +37,7 @@ thread_start(void *arg)
|
||||
#ifdef JEMALLOC_STATS
|
||||
assert(false);
|
||||
#endif
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
|
||||
strerror(err));
|
||||
@ -51,7 +51,7 @@ thread_start(void *arg)
|
||||
#ifdef JEMALLOC_STATS
|
||||
assert(false);
|
||||
#endif
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
|
||||
strerror(err));
|
||||
@ -63,7 +63,7 @@ thread_start(void *arg)
|
||||
#ifdef JEMALLOC_STATS
|
||||
assert(false);
|
||||
#endif
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
|
||||
strerror(err));
|
||||
@ -98,7 +98,7 @@ thread_start(void *arg)
|
||||
|
||||
assert(d0 + usize <= d1);
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ main(void)
|
||||
!= 0) {
|
||||
fprintf(stderr, "%s(): Error in pthread_create()\n", __func__);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
pthread_join(thread, (void *)&ret);
|
||||
|
||||
@ -126,13 +126,13 @@ main(void)
|
||||
!= 0) {
|
||||
fprintf(stderr, "%s(): Error in pthread_create()\n", __func__);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
pthread_join(thread, (void *)&ret);
|
||||
|
||||
thread_start(NULL);
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
fprintf(stderr, "Test end\n");
|
||||
return (ret);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ main(void)
|
||||
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
|
||||
strerror(err));
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
chunksize = ((size_t)1U) << lg_chunk;
|
||||
|
||||
@ -30,7 +30,7 @@ main(void)
|
||||
if (p == NULL) {
|
||||
fprintf(stderr, "malloc(%zu) --> %p\n", chunksize, p);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
memset(p, 'a', chunksize);
|
||||
|
||||
@ -39,7 +39,7 @@ main(void)
|
||||
fprintf(stderr, "realloc(%p, %zu) --> %p\n", p, chunksize * 2,
|
||||
q);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
for (i = 0; i < chunksize; i++) {
|
||||
assert(q[i] == 'a');
|
||||
@ -51,7 +51,7 @@ main(void)
|
||||
if (q == NULL) {
|
||||
fprintf(stderr, "realloc(%p, %zu) --> %p\n", p, chunksize, q);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
for (i = 0; i < chunksize; i++) {
|
||||
assert(q[i] == 'a');
|
||||
@ -60,7 +60,7 @@ main(void)
|
||||
free(q);
|
||||
|
||||
ret = 0;
|
||||
RETURN:
|
||||
label_return:
|
||||
fprintf(stderr, "Test end\n");
|
||||
return (ret);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ main(void)
|
||||
if (p == NULL) {
|
||||
fprintf(stderr, "%s(): Error in malloc()\n", __func__);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
size = sizeof(arena_ind);
|
||||
@ -69,7 +69,7 @@ main(void)
|
||||
fprintf(stderr, "%s(): Error in mallctl(): %s\n", __func__,
|
||||
strerror(err));
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
for (i = 0; i < NTHREADS; i++) {
|
||||
@ -78,14 +78,14 @@ main(void)
|
||||
fprintf(stderr, "%s(): Error in pthread_create()\n",
|
||||
__func__);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < NTHREADS; i++)
|
||||
pthread_join(threads[i], (void *)&ret);
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
fprintf(stderr, "Test end\n");
|
||||
return (ret);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ thread_start(void *arg)
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
|
||||
if (e0) {
|
||||
@ -69,7 +69,7 @@ thread_start(void *arg)
|
||||
assert(e0 == false);
|
||||
|
||||
free(malloc(1));
|
||||
RETURN:
|
||||
label_return:
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ main(void)
|
||||
!= 0) {
|
||||
fprintf(stderr, "%s(): Error in pthread_create()\n", __func__);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
pthread_join(thread, (void *)&ret);
|
||||
|
||||
@ -97,13 +97,13 @@ main(void)
|
||||
!= 0) {
|
||||
fprintf(stderr, "%s(): Error in pthread_create()\n", __func__);
|
||||
ret = 1;
|
||||
goto RETURN;
|
||||
goto label_return;
|
||||
}
|
||||
pthread_join(thread, (void *)&ret);
|
||||
|
||||
thread_start(NULL);
|
||||
|
||||
RETURN:
|
||||
label_return:
|
||||
fprintf(stderr, "Test end\n");
|
||||
return (ret);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user