diff --git a/src/args.c b/src/args.c index 6e873be..0cdd152 100644 --- a/src/args.c +++ b/src/args.c @@ -71,17 +71,17 @@ static void print_help(int status_code) { exit(status_code); } -static void invalid_arg(char *arg) { +static void invalid_arg(const char *arg) { log_error("invalid argument: '%s'", arg); print_help(EXIT_FAILURE); } -static void invalid_value(char *arg, char *value) { +static void invalid_value(const char *arg, const char *value) { log_error("invalid value for argument '%s': '%s'", arg, value); print_help(EXIT_FAILURE); } -static bool is_arg(char *arg, const char *ref) { +static bool is_arg(const char *arg, const char *ref) { return strcoll(arg, ref) == 0; } @@ -93,7 +93,7 @@ static char *split_arg_value(char *arg) { return rest; } -static unsigned int parse_uint(char *arg, char *value) { +static unsigned int parse_uint(const char *arg, const char *value) { unsigned long long tmp_value; if (!string_is_number(value)) { diff --git a/src/string.c b/src/string.c index 7239526..4f52680 100644 --- a/src/string.c +++ b/src/string.c @@ -39,7 +39,7 @@ unsigned int string_trim(char *str) { static bool is_digit(char c) { return c >= '0' && c <= '9'; } -bool string_is_number(char *value) { +bool string_is_number(const char *value) { unsigned long value_len; if (value == NULL) { @@ -57,8 +57,8 @@ bool string_is_number(char *value) { return true; } -char *string_replace_at(char *src, unsigned int from, unsigned int to, - char *rpl) { +char *string_replace_at(const char *src, unsigned int from, unsigned int to, + const char *rpl) { unsigned long src_len, rpl_len; char *dst; diff --git a/src/string.h b/src/string.h index 8734b1d..df35d19 100644 --- a/src/string.h +++ b/src/string.h @@ -5,9 +5,9 @@ unsigned int string_trim(char *str); -bool string_is_number(char *value); +bool string_is_number(const char *value); -char *string_replace_at(char *src, unsigned int from, unsigned int to, - char *rpl); +char *string_replace_at(const char *src, unsigned int from, unsigned int to, + const char *rpl); #endif /* STRINGS_H */ \ No newline at end of file