Module Name: src
Committed By: christos
Date: Mon Mar 4 17:21:31 UTC 2019
Modified Files:
src/external/bsd/jemalloc/dist/src: ckh.c ctl.c
Log Message:
- add unconst
- fixes for shadowing
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/jemalloc/dist/src/ckh.c \
src/external/bsd/jemalloc/dist/src/ctl.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/jemalloc/dist/src/ckh.c
diff -u src/external/bsd/jemalloc/dist/src/ckh.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/ckh.c:1.2
--- src/external/bsd/jemalloc/dist/src/ckh.c:1.1.1.1 Mon Mar 4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/ckh.c Mon Mar 4 12:21:31 2019
@@ -356,14 +356,14 @@ ckh_shrink(tsd_t *tsd, ckh_t *ckh) {
}
bool
-ckh_new(tsd_t *tsd, ckh_t *ckh, size_t minitems, ckh_hash_t *hash,
+ckh_new(tsd_t *tsd, ckh_t *ckh, size_t minitems, ckh_hash_t *hashp,
ckh_keycomp_t *keycomp) {
bool ret;
size_t mincells, usize;
unsigned lg_mincells;
assert(minitems > 0);
- assert(hash != NULL);
+ assert(hashp != NULL);
assert(keycomp != NULL);
#ifdef CKH_COUNT
@@ -392,7 +392,7 @@ ckh_new(tsd_t *tsd, ckh_t *ckh, size_t m
}
ckh->lg_minbuckets = lg_mincells - LG_CKH_BUCKET_CELLS;
ckh->lg_curbuckets = lg_mincells - LG_CKH_BUCKET_CELLS;
- ckh->hash = hash;
+ ckh->hash = hashp;
ckh->keycomp = keycomp;
usize = sz_sa2u(sizeof(ckhc_t) << lg_mincells, CACHELINE);
@@ -449,10 +449,10 @@ ckh_iter(ckh_t *ckh, size_t *tabind, voi
LG_CKH_BUCKET_CELLS)); i < ncells; i++) {
if (ckh->tab[i].key != NULL) {
if (key != NULL) {
- *key = (void *)ckh->tab[i].key;
+ *key = (void *)__UNCONST(ckh->tab[i].key);
}
if (data != NULL) {
- *data = (void *)ckh->tab[i].data;
+ *data = (void *)__UNCONST(ckh->tab[i].data);
}
*tabind = i + 1;
return false;
@@ -495,10 +495,10 @@ ckh_remove(tsd_t *tsd, ckh_t *ckh, const
cell = ckh_isearch(ckh, searchkey);
if (cell != SIZE_T_MAX) {
if (key != NULL) {
- *key = (void *)ckh->tab[cell].key;
+ *key = (void *)__UNCONST(ckh->tab[cell].key);
}
if (data != NULL) {
- *data = (void *)ckh->tab[cell].data;
+ *data = (void *)__UNCONST(ckh->tab[cell].data);
}
ckh->tab[cell].key = NULL;
ckh->tab[cell].data = NULL; /* Not necessary. */
@@ -527,10 +527,10 @@ ckh_search(ckh_t *ckh, const void *searc
cell = ckh_isearch(ckh, searchkey);
if (cell != SIZE_T_MAX) {
if (key != NULL) {
- *key = (void *)ckh->tab[cell].key;
+ *key = (void *)__UNCONST(ckh->tab[cell].key);
}
if (data != NULL) {
- *data = (void *)ckh->tab[cell].data;
+ *data = (void *)__UNCONST(ckh->tab[cell].data);
}
return false;
}
@@ -548,7 +548,7 @@ ckh_string_keycomp(const void *k1, const
assert(k1 != NULL);
assert(k2 != NULL);
- return !strcmp((char *)k1, (char *)k2);
+ return !strcmp((const char *)k1, (const char *)k2);
}
void
Index: src/external/bsd/jemalloc/dist/src/ctl.c
diff -u src/external/bsd/jemalloc/dist/src/ctl.c:1.1.1.1 src/external/bsd/jemalloc/dist/src/ctl.c:1.2
--- src/external/bsd/jemalloc/dist/src/ctl.c:1.1.1.1 Mon Mar 4 12:10:23 2019
+++ src/external/bsd/jemalloc/dist/src/ctl.c Mon Mar 4 12:21:31 2019
@@ -234,7 +234,7 @@ CTL_PROTO(stats_mutexes_reset)
#define NAME(n) {true}, n
#define CHILD(t, c) \
sizeof(c##_node) / sizeof(ctl_##t##_node_t), \
- (ctl_node_t *)c##_node, \
+ (const ctl_node_t *)c##_node, \
NULL
#define CTL(c) 0, NULL, c##_ctl
@@ -1299,14 +1299,14 @@ ctl_postfork_child(tsdn_t *tsdn) {
ret = EPERM; \
goto label_return; \
} \
-} while (0)
+} while (/*CONSTCOND*/0)
#define WRITEONLY() do { \
if (oldp != NULL || oldlenp != NULL) { \
ret = EPERM; \
goto label_return; \
} \
-} while (0)
+} while (/*CONSTCOND*/0)
#define READ_XOR_WRITE() do { \
if ((oldp != NULL && oldlenp != NULL) && (newp != NULL || \
@@ -1314,7 +1314,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
ret = EPERM; \
goto label_return; \
} \
-} while (0)
+} while (/*CONSTCOND*/0)
#define READ(v, t) do { \
if (oldp != NULL && oldlenp != NULL) { \
@@ -1327,7 +1327,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
} \
*(t *)oldp = (v); \
} \
-} while (0)
+} while (/*CONSTCOND*/0)
#define WRITE(v, t) do { \
if (newp != NULL) { \
@@ -1337,7 +1337,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
} \
(v) = *(t *)newp; \
} \
-} while (0)
+} while (/*CONSTCOND*/0)
#define MIB_UNSIGNED(v, i) do { \
if (mib[i] > UINT_MAX) { \
@@ -1345,7 +1345,7 @@ ctl_postfork_child(tsdn_t *tsdn) {
goto label_return; \
} \
v = (unsigned)mib[i]; \
-} while (0)
+} while (/*CONSTCOND*/0)
/*
* There's a lot of code duplication in the following macros due to limitations
@@ -2262,7 +2262,7 @@ arena_i_extent_hooks_ctl(tsd_t *tsd, con
goto label_return;
}
old_extent_hooks =
- (extent_hooks_t *)&extent_hooks_default;
+ (extent_hooks_t *)__UNCONST(&extent_hooks_default);
READ(old_extent_hooks, extent_hooks_t *);
if (newp != NULL) {
/* Initialize a new arena as a side effect. */
@@ -2459,7 +2459,7 @@ arenas_create_ctl(tsd_t *tsd, const size
malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- extent_hooks = (extent_hooks_t *)&extent_hooks_default;
+ extent_hooks = (extent_hooks_t *)__UNCONST(&extent_hooks_default);
WRITE(extent_hooks, extent_hooks_t *);
if ((arena_ind = ctl_arena_init(tsd, extent_hooks)) == UINT_MAX) {
ret = EAGAIN;
@@ -2806,8 +2806,8 @@ stats_mutexes_reset_ctl(tsd_t *tsd, cons
MUTEX_PROF_RESET(arena->tcache_ql_mtx);
MUTEX_PROF_RESET(arena->base->mtx);
- for (szind_t i = 0; i < NBINS; i++) {
- bin_t *bin = &arena->bins[i];
+ for (szind_t j = 0; j < NBINS; j++) {
+ bin_t *bin = &arena->bins[j];
MUTEX_PROF_RESET(bin->lock);
}
}