Unify write callback signature
This commit is contained in:
parent
fef9abdcc0
commit
2097e1945b
@ -10,8 +10,6 @@
|
||||
* some "option like" content for the write_cb, so it doesn't matter.
|
||||
*/
|
||||
|
||||
typedef void (write_cb_t)(void *, const char *);
|
||||
|
||||
typedef struct {
|
||||
write_cb_t *write_cb;
|
||||
void *cbopaque;
|
||||
|
@ -68,7 +68,7 @@ typedef struct emitter_s emitter_t;
|
||||
struct emitter_s {
|
||||
emitter_output_t output;
|
||||
/* The output information. */
|
||||
void (*write_cb)(void *, const char *);
|
||||
write_cb_t *write_cb;
|
||||
void *cbopaque;
|
||||
int nesting_depth;
|
||||
/* True if we've already emitted a value at the given depth. */
|
||||
@ -240,7 +240,7 @@ emitter_json_key_prefix(emitter_t *emitter) {
|
||||
|
||||
static inline void
|
||||
emitter_init(emitter_t *emitter, emitter_output_t emitter_output,
|
||||
void (*write_cb)(void *, const char *), void *cbopaque) {
|
||||
write_cb_t *write_cb, void *cbopaque) {
|
||||
emitter->output = emitter_output;
|
||||
emitter->write_cb = write_cb;
|
||||
emitter->cbopaque = cbopaque;
|
||||
|
@ -17,6 +17,9 @@ enum zero_realloc_action_e {
|
||||
};
|
||||
typedef enum zero_realloc_action_e zero_realloc_action_t;
|
||||
|
||||
/* Signature of write callback. */
|
||||
typedef void (write_cb_t)(void *, const char *);
|
||||
|
||||
/*
|
||||
* Flags bits:
|
||||
*
|
||||
|
@ -1,6 +1,8 @@
|
||||
#ifndef JEMALLOC_INTERNAL_MALLOC_IO_H
|
||||
#define JEMALLOC_INTERNAL_MALLOC_IO_H
|
||||
|
||||
#include "jemalloc/internal/jemalloc_internal_types.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef _WIN64
|
||||
# define FMT64_PREFIX "ll"
|
||||
@ -40,7 +42,7 @@
|
||||
*/
|
||||
#define MALLOC_PRINTF_BUFSIZE 4096
|
||||
|
||||
void wrtmessage(void *cbopaque, const char *s);
|
||||
write_cb_t wrtmessage;
|
||||
int buferror(int err, char *buf, size_t buflen);
|
||||
uintmax_t malloc_strtoumax(const char *restrict nptr, char **restrict endptr,
|
||||
int base);
|
||||
@ -58,10 +60,10 @@ size_t malloc_snprintf(char *str, size_t size, const char *format, ...)
|
||||
* 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,
|
||||
const char *format, va_list ap);
|
||||
void malloc_cprintf(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
const char *format, ...) JEMALLOC_FORMAT_PRINTF(3, 4);
|
||||
void malloc_vcprintf(write_cb_t *write_cb, void *cbopaque, const char *format,
|
||||
va_list ap);
|
||||
void malloc_cprintf(write_cb_t *write_cb, void *cbopaque, const char *format,
|
||||
...) JEMALLOC_FORMAT_PRINTF(3, 4);
|
||||
void malloc_printf(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2);
|
||||
|
||||
static inline ssize_t
|
||||
|
@ -106,7 +106,6 @@ bool prof_log_stop(tsdn_t *tsdn);
|
||||
|
||||
ssize_t prof_recent_alloc_max_ctl_read();
|
||||
ssize_t prof_recent_alloc_max_ctl_write(tsd_t *tsd, ssize_t max);
|
||||
void prof_recent_alloc_dump(tsd_t *tsd, void (*write_cb)(void *, const char *),
|
||||
void *cbopaque);
|
||||
void prof_recent_alloc_dump(tsd_t *tsd, write_cb_t *write_cb, void *cbopaque);
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_PROF_EXTERNS_H */
|
||||
|
@ -41,8 +41,7 @@ uint64_t stats_interval_accum_batch_size(void);
|
||||
bool stats_interval_accum(tsd_t *tsd, uint64_t bytes);
|
||||
|
||||
/* Implements je_malloc_stats_print. */
|
||||
void stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
const char *opts);
|
||||
void stats_print(write_cb_t *write_cb, void *cbopaque, const char *opts);
|
||||
|
||||
bool stats_boot(void);
|
||||
|
||||
|
@ -3522,7 +3522,7 @@ label_return:
|
||||
|
||||
typedef struct write_cb_packet_s write_cb_packet_t;
|
||||
struct write_cb_packet_s {
|
||||
void (*write_cb)(void *, const char *);
|
||||
write_cb_t *write_cb;
|
||||
void *cbopaque;
|
||||
};
|
||||
|
||||
|
@ -619,8 +619,8 @@ malloc_snprintf(char *str, size_t size, const char *format, ...) {
|
||||
}
|
||||
|
||||
void
|
||||
malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
const char *format, va_list ap) {
|
||||
malloc_vcprintf(write_cb_t *write_cb, void *cbopaque, const char *format,
|
||||
va_list ap) {
|
||||
char buf[MALLOC_PRINTF_BUFSIZE];
|
||||
|
||||
if (write_cb == NULL) {
|
||||
@ -643,8 +643,7 @@ malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
*/
|
||||
JEMALLOC_FORMAT_PRINTF(3, 4)
|
||||
void
|
||||
malloc_cprintf(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
const char *format, ...) {
|
||||
malloc_cprintf(write_cb_t *write_cb, void *cbopaque, const char *format, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
|
@ -444,8 +444,7 @@ dump_bt(emitter_t *emitter, prof_tctx_t *tctx) {
|
||||
|
||||
#define PROF_RECENT_PRINT_BUFSIZE 4096
|
||||
void
|
||||
prof_recent_alloc_dump(tsd_t *tsd, void (*write_cb)(void *, const char *),
|
||||
void *cbopaque) {
|
||||
prof_recent_alloc_dump(tsd_t *tsd, write_cb_t *write_cb, void *cbopaque) {
|
||||
buf_writer_t buf_writer;
|
||||
buf_writer_init(tsd_tsdn(tsd), &buf_writer, write_cb, cbopaque, NULL,
|
||||
PROF_RECENT_PRINT_BUFSIZE);
|
||||
|
@ -1431,8 +1431,7 @@ stats_print_helper(emitter_t *emitter, bool merged, bool destroyed,
|
||||
}
|
||||
|
||||
void
|
||||
stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
|
||||
const char *opts) {
|
||||
stats_print(write_cb_t *write_cb, void *cbopaque, const char *opts) {
|
||||
int err;
|
||||
uint64_t epoch;
|
||||
size_t u64sz;
|
||||
|
Loading…
Reference in New Issue
Block a user