bcachefs: printbuf_reset() handles tabstops
authorKent Overstreet <kent.overstreet@linux.dev>
Mon, 30 Dec 2024 20:31:14 +0000 (15:31 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 10 Jan 2025 04:38:42 +0000 (23:38 -0500)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/printbuf.h

index 1d570387b77f19f03d4fc4b1e39d8276c9b85860..d0dd398baa2b6c9e56292f216eeedf939e9300a9 100644 (file)
@@ -251,16 +251,23 @@ static inline void prt_hex_byte_upper(struct printbuf *out, u8 byte)
        printbuf_nul_terminate_reserved(out);
 }
 
+static inline void printbuf_reset_keep_tabstops(struct printbuf *buf)
+{
+       buf->pos                = 0;
+       buf->allocation_failure = 0;
+       buf->last_newline       = 0;
+       buf->last_field         = 0;
+       buf->indent             = 0;
+       buf->cur_tabstop        = 0;
+}
+
 /**
  * printbuf_reset - re-use a printbuf without freeing and re-initializing it:
  */
 static inline void printbuf_reset(struct printbuf *buf)
 {
-       buf->pos                = 0;
-       buf->allocation_failure = 0;
-       buf->indent             = 0;
+       printbuf_reset_keep_tabstops(buf);
        buf->nr_tabstops        = 0;
-       buf->cur_tabstop        = 0;
 }
 
 /**