diff mbox series

[v4,04/22] fsck.h: add a FSCK_OPTIONS_COMMON_ERROR_FUNC macro

Message ID 20210316161738.30254-5-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series fsck: API improvements | expand

Commit Message

Ævar Arnfjörð Bjarmason March 16, 2021, 4:17 p.m. UTC
Add a FSCK_OPTIONS_COMMON_ERROR_FUNC macro for those that would like
to use FSCK_OPTIONS_COMMON in their own initialization, but supply
their own error functions.

Nothing is being changed to use this yet, but in some subsequent
commits we'll make use of this macro.

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

Comments

Derrick Stolee March 16, 2021, 7:06 p.m. UTC | #1
On 3/16/2021 12:17 PM, Ævar Arnfjörð Bjarmason wrote:
> Add a FSCK_OPTIONS_COMMON_ERROR_FUNC macro for those that would like
> to use FSCK_OPTIONS_COMMON in their own initialization, but supply
> their own error functions.
> 
> Nothing is being changed to use this yet, but in some subsequent
> commits we'll make use of this macro.
> 
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>  fsck.h | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/fsck.h b/fsck.h
> index ea3a907ec3..dc35924cbf 100644
> --- a/fsck.h
> +++ b/fsck.h
> @@ -45,12 +45,15 @@ struct fsck_options {
>  
>  #define FSCK_OPTIONS_COMMON \
>  	.walk = NULL, \
> -	.error_func = fsck_error_function, \
>  	.msg_type = NULL, \
>  	.skiplist = OIDSET_INIT, \
>  	.object_names = NULL,
> -#define FSCK_OPTIONS_DEFAULT	{ .strict = 0, FSCK_OPTIONS_COMMON }
> -#define FSCK_OPTIONS_STRICT	{ .strict = 1, FSCK_OPTIONS_COMMON }
> +#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 }

OK. It seems like you are converging on your final definitions
for these macros. At first glance, this seems like unnecessary
split to demonstrate the tiny changes between, but it could
just be done with one change and a description of why you want
the four different entry points as macros.

Thanks,
-Stolee
diff mbox series

Patch

diff --git a/fsck.h b/fsck.h
index ea3a907ec3..dc35924cbf 100644
--- a/fsck.h
+++ b/fsck.h
@@ -45,12 +45,15 @@  struct fsck_options {
 
 #define FSCK_OPTIONS_COMMON \
 	.walk = NULL, \
-	.error_func = fsck_error_function, \
 	.msg_type = NULL, \
 	.skiplist = OIDSET_INIT, \
 	.object_names = NULL,
-#define FSCK_OPTIONS_DEFAULT	{ .strict = 0, FSCK_OPTIONS_COMMON }
-#define FSCK_OPTIONS_STRICT	{ .strict = 1, FSCK_OPTIONS_COMMON }
+#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: