Unify buffered writer naming

This commit is contained in:
Yinan Zhang
2020-01-09 09:59:17 -08:00
parent 9a60cf54ec
commit 6b6b4709b3
6 changed files with 21 additions and 21 deletions

View File

@@ -3696,10 +3696,10 @@ je_malloc_stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
char *stats_print_buf = (char *)iallocztm(tsdn,
STATS_PRINT_BUFSIZE, sz_size2index(STATS_PRINT_BUFSIZE),
false, NULL, true, arena_get(TSDN_NULL, 0, true), true);
buf_writer_arg_t stats_print_buf_arg = {write_cb, cbopaque,
buf_write_arg_t stats_print_buf_arg = {write_cb, cbopaque,
stats_print_buf, STATS_PRINT_BUFSIZE - 1, 0};
stats_print(buffered_write_cb, &stats_print_buf_arg, opts);
buf_writer_flush(&stats_print_buf_arg);
stats_print(buf_write_cb, &stats_print_buf_arg, opts);
buf_write_flush(&stats_print_buf_arg);
idalloctm(tsdn, stats_print_buf, NULL, NULL, true, true);
}

View File

@@ -665,7 +665,7 @@ malloc_printf(const char *format, ...) {
}
void
buf_writer_flush(buf_writer_arg_t *arg) {
buf_write_flush(buf_write_arg_t *arg) {
assert(arg->buf_end <= arg->buf_size);
arg->buf[arg->buf_end] = '\0';
if (arg->write_cb == NULL) {
@@ -677,13 +677,13 @@ buf_writer_flush(buf_writer_arg_t *arg) {
}
void
buffered_write_cb(void *buf_writer_arg, const char *s) {
buf_writer_arg_t *arg = (buf_writer_arg_t *)buf_writer_arg;
buf_write_cb(void *buf_write_arg, const char *s) {
buf_write_arg_t *arg = (buf_write_arg_t *)buf_write_arg;
size_t i, slen, n, s_remain, buf_remain;
assert(arg->buf_end <= arg->buf_size);
for (i = 0, slen = strlen(s); i < slen; i += n) {
if (arg->buf_end == arg->buf_size) {
buf_writer_flush(arg);
buf_write_flush(arg);
}
s_remain = slen - i;
buf_remain = arg->buf_size - arg->buf_end;

View File

@@ -631,12 +631,12 @@ prof_log_stop(tsdn_t *tsdn) {
char *prof_log_stop_buf = (char *)iallocztm(tsdn,
PROF_LOG_STOP_BUFSIZE, sz_size2index(PROF_LOG_STOP_BUFSIZE),
false, NULL, true, arena_get(TSDN_NULL, 0, true), true);
buf_writer_arg_t prof_log_stop_buf_arg = {prof_emitter_write_cb, &arg,
buf_write_arg_t prof_log_stop_buf_arg = {prof_emitter_write_cb, &arg,
prof_log_stop_buf, PROF_LOG_STOP_BUFSIZE - 1, 0};
/* Emit to json. */
emitter_init(&emitter, emitter_output_json_compact,
buffered_write_cb, &prof_log_stop_buf_arg);
emitter_init(&emitter, emitter_output_json_compact, buf_write_cb,
&prof_log_stop_buf_arg);
emitter_begin(&emitter);
prof_log_emit_metadata(&emitter);
@@ -645,7 +645,7 @@ prof_log_stop(tsdn_t *tsdn) {
prof_log_emit_allocs(tsd, &emitter);
emitter_end(&emitter);
buf_writer_flush(&prof_log_stop_buf_arg);
buf_write_flush(&prof_log_stop_buf_arg);
idalloctm(tsdn, prof_log_stop_buf, NULL, NULL, true, true);
/* Reset global state. */

View File

@@ -461,10 +461,10 @@ prof_recent_alloc_dump(tsd_t *tsd, void (*write_cb)(void *, const char *),
char *buf = (char *)iallocztm(tsd_tsdn(tsd), PROF_RECENT_PRINT_BUFSIZE,
sz_size2index(PROF_RECENT_PRINT_BUFSIZE), false, NULL, true,
arena_get(tsd_tsdn(tsd), 0, false), true);
buf_writer_arg_t buf_arg = {write_cb, cbopaque, buf,
buf_write_arg_t buf_arg = {write_cb, cbopaque, buf,
PROF_RECENT_PRINT_BUFSIZE - 1, 0};
emitter_t emitter;
emitter_init(&emitter, emitter_output_json_compact, buffered_write_cb,
emitter_init(&emitter, emitter_output_json_compact, buf_write_cb,
&buf_arg);
emitter_begin(&emitter);
@@ -524,7 +524,7 @@ prof_recent_alloc_dump(tsd_t *tsd, void (*write_cb)(void *, const char *),
malloc_mutex_unlock(tsd_tsdn(tsd), &prof_recent_alloc_mtx);
emitter_end(&emitter);
buf_writer_flush(&buf_arg);
buf_write_flush(&buf_arg);
idalloctm(tsd_tsdn(tsd), buf, NULL, NULL, true, true);
}
#undef PROF_RECENT_PRINT_BUFSIZE