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`.)
This commit is contained in:
parent
34e75630cc
commit
d26636d566
@ -424,7 +424,7 @@ for (i = 0; i < nbins; i++) {
|
|||||||
called repeatedly. General information that never changes during
|
called repeatedly. General information that never changes during
|
||||||
execution can be omitted by specifying <quote>g</quote> as a character
|
execution can be omitted by specifying <quote>g</quote> as a character
|
||||||
within the <parameter>opts</parameter> string. Note that
|
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
|
<function>mallctl*()</function> functions internally, so inconsistent
|
||||||
statistics can be reported if multiple threads use these functions
|
statistics can be reported if multiple threads use these functions
|
||||||
simultaneously. If <option>--enable-stats</option> is specified during
|
simultaneously. If <option>--enable-stats</option> is specified during
|
||||||
|
@ -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, ...)
|
size_t malloc_snprintf(char *str, size_t size, const char *format, ...)
|
||||||
JEMALLOC_FORMAT_PRINTF(3, 4);
|
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.
|
* je_malloc_message hook.
|
||||||
*/
|
*/
|
||||||
void malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
|
void malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||||
|
@ -632,7 +632,6 @@ malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
|
|||||||
*/
|
*/
|
||||||
write_cb = (je_malloc_message != NULL) ? je_malloc_message :
|
write_cb = (je_malloc_message != NULL) ? je_malloc_message :
|
||||||
wrtmessage;
|
wrtmessage;
|
||||||
cbopaque = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
malloc_vsnprintf(buf, sizeof(buf), format, ap);
|
malloc_vsnprintf(buf, sizeof(buf), format, ap);
|
||||||
|
Loading…
Reference in New Issue
Block a user