cli: mark argv argument for command line parsing as const

It's bad style to pass the argv argument around and mutate it.
We shouldn't mutate it, and not assume that it stays around after
the function returns to the caller (meaning, we should clone the
array if we intend to use it later).

Add const specifier.
This commit is contained in:
Thomas Haller
2020-04-05 13:05:58 +02:00
parent 3a451141bd
commit c5d45848dd
11 changed files with 171 additions and 151 deletions

View File

@@ -19,10 +19,10 @@ typedef struct {
} nmc_arg_t;
/* === Functions === */
int next_arg (NmCli *nmc, int *argc, char ***argv, ...);
int next_arg (NmCli *nmc, int *argc, const char *const**argv, ...);
gboolean nmc_arg_is_help (const char *arg);
gboolean nmc_arg_is_option (const char *arg, const char *opt_name);
gboolean nmc_parse_args (nmc_arg_t *arg_arr, gboolean last, int *argc, char ***argv, GError **error);
gboolean nmc_parse_args (nmc_arg_t *arg_arr, gboolean last, int *argc, const char *const**argv, GError **error);
char *ssid_to_hex (const char *str, gsize len);
void nmc_terminal_erase_line (void);
void nmc_terminal_show_progress (const char *str);