diff mbox series

[v6,02/19] fsck.h: use designed initializers for FSCK_OPTIONS_{DEFAULT,STRICT}

Message ID patch-02.20-b17c982293e-20210328T130947Z-avarab@gmail.com (mailing list archive)
State Accepted
Commit d385784f89b3350db16380441bc8a18ebe54179a
Headers show
Series fsck: API improvements | expand

Commit Message

Ævar Arnfjörð Bjarmason March 28, 2021, 1:15 p.m. UTC
Refactor the definitions of FSCK_OPTIONS_{DEFAULT,STRICT} to use
designated initializers. This allows us to omit those fields that
aren't initialized to zero or NULL.

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

Comments

Ramsay Jones March 28, 2021, 5:15 p.m. UTC | #1
On Sun, Mar 28, 2021 at 03:15:34PM +0200, Ævar Arnfjörð Bjarmason wrote:
> Refactor the definitions of FSCK_OPTIONS_{DEFAULT,STRICT} to use
> designated initializers. This allows us to omit those fields that
> aren't initialized to zero or NULL.

s/aren't/are/

[I apologize in advance - I am using mutt for the first time to reply
to a ML post and I don't know if I should be using L-ist-reply or a
g-roup-reply! :D ]

ATB,
Ramsay Jones
Junio C Hamano March 29, 2021, 2:04 a.m. UTC | #2
Ramsay Jones <ramsay@ramsayjones.plus.com> writes:

> On Sun, Mar 28, 2021 at 03:15:34PM +0200, Ævar Arnfjörð Bjarmason wrote:
>> Refactor the definitions of FSCK_OPTIONS_{DEFAULT,STRICT} to use
>> designated initializers. This allows us to omit those fields that
>> aren't initialized to zero or NULL.
>
> s/aren't/are/

Thanks; tweak applied while queuing.

> [I apologize in advance - I am using mutt for the first time to reply
> to a ML post and I don't know if I should be using L-ist-reply or a
> g-roup-reply! :D ]

FWIW, on lore (reading via nntp), the message I am responding to
looks just fine.
diff mbox series

Patch

diff --git a/fsck.h b/fsck.h
index f70d11c5594..73e8b9f3e4e 100644
--- a/fsck.h
+++ b/fsck.h
@@ -43,8 +43,14 @@  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_DEFAULT { \
+	.skiplist = OIDSET_INIT, \
+	.error_func = fsck_error_function \
+}
+#define FSCK_OPTIONS_STRICT { \
+	.strict = 1, \
+	.error_func = fsck_error_function, \
+}
 
 /* descend in all linked child objects
  * the return value is: