summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/jemalloc/internal/log.h3
-rw-r--r--src/ctl.c2
-rw-r--r--src/jemalloc.c3
-rw-r--r--src/malloc_io.c6
-rw-r--r--src/pages.c2
-rw-r--r--src/stats.c4
6 files changed, 7 insertions, 13 deletions
diff --git a/include/jemalloc/internal/log.h b/include/jemalloc/internal/log.h
index 64208586..f39c598a 100644
--- a/include/jemalloc/internal/log.h
+++ b/include/jemalloc/internal/log.h
@@ -96,8 +96,7 @@ log_impl_varargs(const char *name, ...) {
dst_offset += malloc_snprintf(buf, JEMALLOC_LOG_BUFSIZE, "%s: ", name);
dst_offset += malloc_vsnprintf(buf + dst_offset,
JEMALLOC_LOG_BUFSIZE - dst_offset, format, ap);
- dst_offset += malloc_snprintf(buf + dst_offset,
- JEMALLOC_LOG_BUFSIZE - dst_offset, "\n");
+ malloc_snprintf(buf + dst_offset, JEMALLOC_LOG_BUFSIZE - dst_offset, "\n");
va_end(ap);
malloc_write(buf);
diff --git a/src/ctl.c b/src/ctl.c
index c495ecf6..e597b2bb 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -2745,7 +2745,6 @@ arena_i_dss_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
int ret;
const char *dss = NULL;
unsigned arena_ind;
- dss_prec_t dss_prec_old = dss_prec_limit;
dss_prec_t dss_prec = dss_prec_limit;
malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
@@ -2773,6 +2772,7 @@ arena_i_dss_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
* Access via index narenas is deprecated, and scheduled for removal in
* 6.0.0.
*/
+ dss_prec_t dss_prec_old;
if (arena_ind == MALLCTL_ARENAS_ALL || arena_ind ==
ctl_arenas->narenas) {
if (dss_prec != dss_prec_limit &&
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 7407022f..37cd159c 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -2389,7 +2389,6 @@ imalloc_sample(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd,
* from the ind_large bucket.
*/
szind_t ind_large;
- size_t bumped_usize = usize;
dopts->alignment = prof_sample_align(dopts->alignment);
if (usize <= SC_SMALL_MAXCLASS) {
@@ -2398,7 +2397,7 @@ imalloc_sample(static_opts_t *sopts, dynamic_opts_t *dopts, tsd_t *tsd,
sz_sa2u(SC_LARGE_MINCLASS, dopts->alignment))
== SC_LARGE_MINCLASS);
ind_large = sz_size2index(SC_LARGE_MINCLASS);
- bumped_usize = sz_s2u(SC_LARGE_MINCLASS);
+ size_t bumped_usize = sz_s2u(SC_LARGE_MINCLASS);
ret = imalloc_no_sample(sopts, dopts, tsd, bumped_usize,
bumped_usize, ind_large);
if (unlikely(ret == NULL)) {
diff --git a/src/malloc_io.c b/src/malloc_io.c
index b76885cb..6de409b3 100644
--- a/src/malloc_io.c
+++ b/src/malloc_io.c
@@ -423,7 +423,6 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
unsigned char len = '?';
char *s;
size_t slen;
- bool first_width_digit = true;
bool pad_zero = false;
f++;
@@ -462,9 +461,7 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
}
break;
case '0':
- if (first_width_digit) {
- pad_zero = true;
- }
+ pad_zero = true;
JEMALLOC_FALLTHROUGH;
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9': {
@@ -474,7 +471,6 @@ malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
assert(uwidth != UINTMAX_MAX || get_errno() !=
ERANGE);
width = (int)uwidth;
- first_width_digit = false;
break;
} default:
break;
diff --git a/src/pages.c b/src/pages.c
index b672e4de..09b51b88 100644
--- a/src/pages.c
+++ b/src/pages.c
@@ -68,7 +68,6 @@ static int madvise_dont_need_zeros_is_faulty = -1;
*/
static int madvise_MADV_DONTNEED_zeroes_pages()
{
- int works = -1;
size_t size = PAGE;
void * addr = mmap(NULL, size, PROT_READ|PROT_WRITE,
@@ -83,6 +82,7 @@ static int madvise_MADV_DONTNEED_zeroes_pages()
}
memset(addr, 'A', size);
+ int works;
if (madvise(addr, size, MADV_DONTNEED) == 0) {
works = memchr(addr, 'A', size) == NULL;
} else {
diff --git a/src/stats.c b/src/stats.c
index 43360a2d..59db4f8e 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -1803,7 +1803,7 @@ stats_print_helper(emitter_t *emitter, bool merged, bool destroyed,
size_t sz;
VARIABLE_ARRAY(bool, initialized, narenas);
bool destroyed_initialized;
- unsigned i, j, ninitialized;
+ unsigned i, ninitialized;
xmallctlnametomib("arena.0.initialized", mib, &miblen);
for (i = ninitialized = 0; i < narenas; i++) {
@@ -1843,7 +1843,7 @@ stats_print_helper(emitter_t *emitter, bool merged, bool destroyed,
/* Unmerged stats. */
if (unmerged) {
- for (i = j = 0; i < narenas; i++) {
+ for (i = 0; i < narenas; i++) {
if (initialized[i]) {
char arena_ind_str[20];
malloc_snprintf(arena_ind_str,