Thread (159 messages) 159 messages, 9 authors, 2021-03-28
STALE1931d
Revisions (4)
  1. v1 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]
  4. v6 [diff vs current]

[PATCH v2 04/10] fsck.c: move definition of msg_id into append_msg_id()

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-02-18 12:37:11
Subsystem: the rest · Maintainer: Linus Torvalds

Refactor code added in 71ab8fa840f (fsck: report the ID of the
error/warning, 2015-06-22) to resolve the msg_id to a string in the
function that wants it, instead of doing it in report().

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 fsck.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fsck.c b/fsck.c
index acccad243ec..1070071ffec 100644
--- a/fsck.c
+++ b/fsck.c
@@ -264,8 +264,9 @@ void fsck_set_msg_types(struct fsck_options *options, const char *values)
 	free(to_free);
 }
 
-static void append_msg_id(struct strbuf *sb, const char *msg_id)
+static void append_msg_id(struct strbuf *sb, enum fsck_msg_id id)
 {
+	const char *msg_id = msg_id_info[id].id_string;
 	for (;;) {
 		char c = *(msg_id)++;
 
@@ -308,7 +309,7 @@ static int report(struct fsck_options *options,
 	else if (msg_type == FSCK_INFO)
 		msg_type = FSCK_WARN;
 
-	append_msg_id(&sb, msg_id_info[id].id_string);
+	append_msg_id(&sb, id);
 
 	va_start(ap, fmt);
 	strbuf_vaddf(&sb, fmt, ap);
-- 
2.30.0.284.gd98b1dd5eaa7
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help