Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/jemalloc/dist/src - add unconst
details: https://anonhg.NetBSD.org/src/rev/886835aaf671
branches: trunk
changeset: 449353:886835aaf671
user: christos <christos%NetBSD.org@localhost>
date: Mon Mar 04 17:21:31 2019 +0000
description:
- add unconst
- fixes for shadowing
diffstat:
external/bsd/jemalloc/dist/src/ckh.c | 20 ++++++++++----------
external/bsd/jemalloc/dist/src/ctl.c | 22 +++++++++++-----------
2 files changed, 21 insertions(+), 21 deletions(-)
diffs (171 lines):
diff -r 2edcdf98b5c3 -r 886835aaf671 external/bsd/jemalloc/dist/src/ckh.c
--- a/external/bsd/jemalloc/dist/src/ckh.c Mon Mar 04 17:20:07 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/ckh.c Mon Mar 04 17:21:31 2019 +0000
@@ -356,14 +356,14 @@
}
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->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 @@
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 @@
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 @@
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 @@
assert(k1 != NULL);
assert(k2 != NULL);
- return !strcmp((char *)k1, (char *)k2);
+ return !strcmp((const char *)k1, (const char *)k2);
}
void
diff -r 2edcdf98b5c3 -r 886835aaf671 external/bsd/jemalloc/dist/src/ctl.c
--- a/external/bsd/jemalloc/dist/src/ctl.c Mon Mar 04 17:20:07 2019 +0000
+++ b/external/bsd/jemalloc/dist/src/ctl.c Mon Mar 04 17:21:31 2019 +0000
@@ -234,7 +234,7 @@
#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 @@
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 @@
ret = EPERM; \
goto label_return; \
} \
-} while (0)
+} while (/*CONSTCOND*/0)
#define READ(v, t) do { \
if (oldp != NULL && oldlenp != NULL) { \
@@ -1327,7 +1327,7 @@
} \
*(t *)oldp = (v); \
} \
-} while (0)
+} while (/*CONSTCOND*/0)
#define WRITE(v, t) do { \
if (newp != NULL) { \
@@ -1337,7 +1337,7 @@
} \
(v) = *(t *)newp; \
} \
-} while (0)
+} while (/*CONSTCOND*/0)
#define MIB_UNSIGNED(v, i) do { \
if (mib[i] > UINT_MAX) { \
@@ -1345,7 +1345,7 @@
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 @@
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 @@
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 @@
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);
}
}
Home |
Main Index |
Thread Index |
Old Index