Skip to content

Commit 0a46ea9

Browse files
author
Kent Overstreet
committed
bcachefs: printbuf_reset() handles tabstops
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 5906dcb commit 0a46ea9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

fs/bcachefs/printbuf.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,23 @@ static inline void prt_hex_byte_upper(struct printbuf *out, u8 byte)
251251
printbuf_nul_terminate_reserved(out);
252252
}
253253

254+
static inline void printbuf_reset_keep_tabstops(struct printbuf *buf)
255+
{
256+
buf->pos = 0;
257+
buf->allocation_failure = 0;
258+
buf->last_newline = 0;
259+
buf->last_field = 0;
260+
buf->indent = 0;
261+
buf->cur_tabstop = 0;
262+
}
263+
254264
/**
255265
* printbuf_reset - re-use a printbuf without freeing and re-initializing it:
256266
*/
257267
static inline void printbuf_reset(struct printbuf *buf)
258268
{
259-
buf->pos = 0;
260-
buf->allocation_failure = 0;
261-
buf->indent = 0;
269+
printbuf_reset_keep_tabstops(buf);
262270
buf->nr_tabstops = 0;
263-
buf->cur_tabstop = 0;
264271
}
265272

266273
/**

0 commit comments

Comments
 (0)