summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Goldblatt <davidgoldblatt@fb.com>2017-07-21 20:34:45 (GMT)
committerDavid Goldblatt <davidtgoldblatt@gmail.com>2017-07-22 16:38:19 (GMT)
commita9f7732d45c22ca7d22bed6ff2eaeb702356884e (patch)
tree0472fe6cc282a7fd82b0debe36a1ced5fb2d2e89 /src
parentaa6c2821374f6dd6ed2e628c06bc08b0c4bc485c (diff)
downloadjemalloc-a9f7732d45c22ca7d22bed6ff2eaeb702356884e.zip
jemalloc-a9f7732d45c22ca7d22bed6ff2eaeb702356884e.tar.gz
jemalloc-a9f7732d45c22ca7d22bed6ff2eaeb702356884e.tar.bz2
Logging: allow logging with empty varargs.
Currently, the log macro requires at least one argument after the format string, because of the way the preprocessor handles varargs macros. We can hide some of that irritation by pushing the extra arguments into a varargs function.
Diffstat (limited to 'src')
-rw-r--r--src/jemalloc.c14
-rw-r--r--src/log.c4
2 files changed, 9 insertions, 9 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c
index 48a268f..1dc6682 100644
--- a/src/jemalloc.c
+++ b/src/jemalloc.c
@@ -2364,7 +2364,7 @@ je_free(void *ptr) {
}
check_entry_exit_locking(tsd_tsdn(tsd));
}
- log(log_core_free_exit, "%s", "");
+ log(log_core_free_exit, "");
}
/*
@@ -2957,7 +2957,7 @@ je_dallocx(void *ptr, int flags) {
}
check_entry_exit_locking(tsd_tsdn(tsd));
- log(log_core_dallocx_exit, "%s", "");
+ log(log_core_dallocx_exit, "");
}
JEMALLOC_ALWAYS_INLINE size_t
@@ -3024,7 +3024,7 @@ je_sdallocx(void *ptr, size_t size, int flags) {
}
check_entry_exit_locking(tsd_tsdn(tsd));
- log(log_core_sdallocx_exit, "%s", "");
+ log(log_core_sdallocx_exit, "");
}
JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW
@@ -3083,7 +3083,7 @@ je_mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp,
check_entry_exit_locking(tsd_tsdn(tsd));
ret = ctl_byname(tsd, name, oldp, oldlenp, newp, newlen);
check_entry_exit_locking(tsd_tsdn(tsd));
-
+
log(log_core_mallctl_exit, "result: %d", ret);
return ret;
}
@@ -3124,7 +3124,7 @@ je_mallctlbymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
static log_var_t log_core_mallctlbymib_exit = LOG_VAR_INIT(
"core.mallctlbymib.exit");
- log(log_core_mallctlbymib_entry, "%s", "");
+ log(log_core_mallctlbymib_entry, "");
if (unlikely(malloc_init())) {
@@ -3150,13 +3150,13 @@ je_malloc_stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
static log_var_t log_core_malloc_stats_print_exit = LOG_VAR_INIT(
"core.malloc_stats_print.exit");
- log(log_core_malloc_stats_print_entry, "%s", "");
+ log(log_core_malloc_stats_print_entry, "");
tsdn = tsdn_fetch();
check_entry_exit_locking(tsdn);
stats_print(write_cb, cbopaque, opts);
check_entry_exit_locking(tsdn);
- log(log_core_malloc_stats_print_exit, "%s", "");
+ log(log_core_malloc_stats_print_exit, "");
}
JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW
diff --git a/src/log.c b/src/log.c
index 022dc58..778902f 100644
--- a/src/log.c
+++ b/src/log.c
@@ -3,7 +3,7 @@
#include "jemalloc/internal/log.h"
-char log_var_names[JEMALLOC_LOG_BUFSIZE];
+char log_var_names[JEMALLOC_LOG_VAR_BUFSIZE];
atomic_b_t log_init_done = ATOMIC_INIT(false);
/*
@@ -59,7 +59,7 @@ log_var_update_state(log_var_t *log_var) {
while (true) {
const char *segment_end = log_var_extract_segment(
segment_begin);
- assert(segment_end < log_var_names + JEMALLOC_LOG_BUFSIZE);
+ assert(segment_end < log_var_names + JEMALLOC_LOG_VAR_BUFSIZE);
if (log_var_matches_segment(segment_begin, segment_end,
log_var_begin, log_var_end)) {
atomic_store_u(&log_var->state, LOG_ENABLED,