fix: coding style

This commit is contained in:
lohhiiccc 2026-04-22 11:28:18 +02:00
parent efbae5b7d6
commit ae7fdf2f94
5 changed files with 13 additions and 11 deletions

View file

@ -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

View file

@ -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++)

View file

@ -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);

View file

@ -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;

View file

@ -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;