diff mbox series

[v5,09/19] fsck.h: re-order and re-assign "enum fsck_msg_type"

Message ID 20210317182054.5986-10-avarab@gmail.com (mailing list archive)
State Superseded
Headers show
Series fsck: API improvements | expand

Commit Message

Ævar Arnfjörð Bjarmason March 17, 2021, 6:20 p.m. UTC
Change the values in the "enum fsck_msg_type" from being manually
assigned to using default C enum values.

This means we end up with a FSCK_IGNORE=0, which was previously
defined as "2".

I'm confident that nothing relies on these values, we always compare
them explicitly. Let's not omit "0" so it won't be assumed that we're
using these as a boolean somewhere.

This also allows us to re-structure the fields to mark which are
"private" v.s. "public". See the preceding commit for a rationale for
not simply splitting these into two enums, namely that this is used
for both the private and public fsck API.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 fsck.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/fsck.h b/fsck.h
index 0fff04373e..25c456bbd3 100644
--- a/fsck.h
+++ b/fsck.h
@@ -4,11 +4,13 @@ 
 #include "oidset.h"
 
 enum fsck_msg_type {
-	FSCK_INFO  = -2,
-	FSCK_FATAL = -1,
-	FSCK_ERROR = 1,
+	/* for internal use only */
+	FSCK_IGNORE,
+	FSCK_INFO,
+	FSCK_FATAL,
+	/* "public", fed to e.g. error_func callbacks */
+	FSCK_ERROR,
 	FSCK_WARN,
-	FSCK_IGNORE
 };
 
 struct fsck_options;