From ae7fdf2f94a7c3c759d449ee1c4d3439473c6e42 Mon Sep 17 00:00:00 2001 From: lohhiiccc Date: Wed, 22 Apr 2026 11:28:18 +0200 Subject: [PATCH] fix: coding style --- include/cli.h | 6 +++--- src/help.c | 2 +- src/parse.c | 10 +++++----- src/parse_utils/parse_int.c | 3 ++- src/parse_utils/parse_ufloat.c | 3 ++- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/cli.h b/include/cli.h index cc42337..b27d22e 100644 --- a/include/cli.h +++ b/include/cli.h @@ -37,12 +37,12 @@ enum { CLI_OPT_ARG_TYPES }; void cli_set_prog_name(const char *name); void cli_print_options(const struct option_descriptor *opts, size_t nb_opts, - t_arg_type_to_str to_str); + t_arg_type_to_str to_str); const char *cli_arg_type_to_str(int type); enum cli_code cli_parse(int argc, char **argv, void *config, - const struct option_descriptor *opts, size_t nb_opts, - char *opt_str, struct option *long_opts); + const struct option_descriptor *opts, size_t nb_opts, + char *opt_str, struct option *long_opts); #endif diff --git a/src/help.c b/src/help.c index 3d1ef96..9fe202c 100644 --- a/src/help.c +++ b/src/help.c @@ -19,7 +19,7 @@ cli_arg_type_to_str(int type) void cli_print_options(const struct option_descriptor *opts, size_t nb_opts, - t_arg_type_to_str to_str) + t_arg_type_to_str to_str) { printf("Options:\n"); for (size_t i = 0; i < nb_opts; i++) diff --git a/src/parse.c b/src/parse.c index bdb94d7..dd4406c 100644 --- a/src/parse.c +++ b/src/parse.c @@ -17,14 +17,14 @@ /* Forward declarations */ static void build_long_options(struct option *long_opts, size_t nb_opts, - const struct option_descriptor *src); + const struct option_descriptor *src); static void build_optstr(char *dest, const struct option_descriptor *opts, - size_t nb_opts); + size_t nb_opts); static const struct option_descriptor *find_option_handler(int opt, - const struct option_descriptor *opts, size_t nb_opts); + const struct option_descriptor *opts, size_t nb_opts); static int handle_one_option(int opt, char **argv, void *config, - uint64_t *opt_tracker, - const struct option_descriptor *opts, size_t nb_opts); + uint64_t *opt_tracker, + const struct option_descriptor *opts, size_t nb_opts); static enum cli_code error_unknown_opt(const char *current_opt); static enum cli_code error_invalid_opt(const char *current_opt); static enum cli_code error_duplicate_opt(const char *current_opt); diff --git a/src/parse_utils/parse_int.c b/src/parse_utils/parse_int.c index 4be858e..b6f9fa8 100644 --- a/src/parse_utils/parse_int.c +++ b/src/parse_utils/parse_int.c @@ -14,7 +14,8 @@ cli_parse_int64(const char *s, int64_t *out) errno = 0; const intmax_t v = strtoimax(s, &end, 10); - if (s == end || ERANGE == errno || '\0' != *end || v < INT64_MIN || v > INT64_MAX) + if (s == end || ERANGE == errno || '\0' != *end || v < INT64_MIN + || v > INT64_MAX) return 1; *out = (int64_t)v; diff --git a/src/parse_utils/parse_ufloat.c b/src/parse_utils/parse_ufloat.c index 8f2d373..5667bc4 100644 --- a/src/parse_utils/parse_ufloat.c +++ b/src/parse_utils/parse_ufloat.c @@ -13,7 +13,8 @@ cli_parse_ufloat(const char *s, float *out) errno = 0; float v = strtof(s, &end); - if (s == end || ERANGE == errno || '\0' != *end || 0 == isfinite(v) || v < 0.0f) + if (s == end || ERANGE == errno || '\0' != *end || 0 == isfinite(v) + || v < 0.0f) return 1; *out = v;