summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYinan Zhang <zyn8950@gmail.com>2019-06-04 18:13:00 (GMT)
committerQi Wang <interwq@gmail.com>2019-07-16 21:54:23 (GMT)
commitd26636d566167a439ea18da7a234f9040668023b (patch)
tree6d1dd84085169f40b9334f7df455bee899bffc52
parent34e75630cc512423b4f227338056a2f5d7e81740 (diff)
downloadjemalloc-d26636d566167a439ea18da7a234f9040668023b.zip
jemalloc-d26636d566167a439ea18da7a234f9040668023b.tar.gz
jemalloc-d26636d566167a439ea18da7a234f9040668023b.tar.bz2
Fix logic in printing
`cbopaque` can now be overriden without overriding `write_cb` in the first place. (Otherwise there would be no need to have the `cbopaque` parameter in `malloc_message`.)
-rw-r--r--doc/jemalloc.xml.in2
-rw-r--r--include/jemalloc/internal/malloc_io.h2
-rw-r--r--src/malloc_io.c1
3 files changed, 2 insertions, 3 deletions
diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in
index 194f1ef..e23ccb7 100644
--- a/doc/jemalloc.xml.in
+++ b/doc/jemalloc.xml.in
@@ -424,7 +424,7 @@ for (i = 0; i < nbins; i++) {
called repeatedly. General information that never changes during
execution can be omitted by specifying <quote>g</quote> as a character
within the <parameter>opts</parameter> string. Note that
- <function>malloc_message()</function> uses the
+ <function>malloc_stats_print()</function> uses the
<function>mallctl*()</function> functions internally, so inconsistent
statistics can be reported if multiple threads use these functions
simultaneously. If <option>--enable-stats</option> is specified during
diff --git a/include/jemalloc/internal/malloc_io.h b/include/jemalloc/internal/malloc_io.h
index bfe556b..1d1a414 100644
--- a/include/jemalloc/internal/malloc_io.h
+++ b/include/jemalloc/internal/malloc_io.h
@@ -54,7 +54,7 @@ size_t malloc_vsnprintf(char *str, size_t size, const char *format,
size_t malloc_snprintf(char *str, size_t size, const char *format, ...)
JEMALLOC_FORMAT_PRINTF(3, 4);
/*
- * The caller can set write_cb and cbopaque to null to choose to print with the
+ * The caller can set write_cb to null to choose to print with the
* je_malloc_message hook.
*/
void malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
diff --git a/src/malloc_io.c b/src/malloc_io.c
index dd88265..d7cb0f5 100644
--- a/src/malloc_io.c
+++ b/src/malloc_io.c
@@ -632,7 +632,6 @@ malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
*/
write_cb = (je_malloc_message != NULL) ? je_malloc_message :
wrtmessage;
- cbopaque = NULL;
}
malloc_vsnprintf(buf, sizeof(buf), format, ap);