@@ -43,8 +43,17 @@ struct fsck_options {
kh_oid_map_t *object_names;
};
-#define FSCK_OPTIONS_DEFAULT { NULL, fsck_error_function, 0, NULL, OIDSET_INIT }
-#define FSCK_OPTIONS_STRICT { NULL, fsck_error_function, 1, NULL, OIDSET_INIT }
+#define FSCK_OPTIONS_COMMON \
+ .walk = NULL, \
+ .msg_type = NULL, \
+ .skiplist = OIDSET_INIT, \
+ .object_names = NULL,
+#define FSCK_OPTIONS_COMMON_ERROR_FUNC \
+ FSCK_OPTIONS_COMMON \
+ .error_func = fsck_error_function
+
+#define FSCK_OPTIONS_DEFAULT { .strict = 0, FSCK_OPTIONS_COMMON_ERROR_FUNC }
+#define FSCK_OPTIONS_STRICT { .strict = 1, FSCK_OPTIONS_COMMON_ERROR_FUNC }
/* descend in all linked child objects
* the return value is:
Refactor the definitions of FSCK_OPTIONS_{DEFAULT,STRICT} to use designated initializers. While I'm at it add the "object_names" member to the initialization. This was omitted in 7b35efd734e (fsck_walk(): optionally name objects on the go, 2016-07-17) when the field was added. I'm using a new FSCK_OPTIONS_COMMON and FSCK_OPTIONS_COMMON_ERROR_FUNC helper macros to define what FSCK_OPTIONS_{DEFAULT,STRICT} have in common, and define the two in terms of those macro. The FSCK_OPTIONS_COMMON macro will be used in a subsequent commit to define other variants of common fsck initialization that wants to use a custom error function, but share the rest of the defaults. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- fsck.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)