From 3634526b10295bb96421e5f2f00193b2bc3ecf03 Mon Sep 17 00:00:00 2001 From: Tom Huang Date: Sun, 5 May 2024 11:37:57 -0700 Subject: [PATCH] fix: add the "const" qualifier to the api Resolves #95 --- src/arg_cmd.c | 4 ++-- src/argtable3.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/arg_cmd.c b/src/arg_cmd.c index 39664cc..455407e 100644 --- a/src/arg_cmd.c +++ b/src/arg_cmd.c @@ -236,7 +236,7 @@ void arg_make_get_help_msg(arg_dstr_t res) { arg_dstr_catf(res, "Please type '%s help' to get more information.\n", module_name()); } -void arg_make_help_msg(arg_dstr_t ds, char* cmd_name, void** argtable) { +void arg_make_help_msg(arg_dstr_t ds, const char* cmd_name, void** argtable) { arg_cmd_info_t* cmd_info = (arg_cmd_info_t*)arg_hashtable_search(s_hashtable, cmd_name); if (cmd_info) { arg_dstr_catf(ds, "%s: %s\n", cmd_name, cmd_info->description); @@ -259,7 +259,7 @@ void arg_make_syntax_err_msg(arg_dstr_t ds, void** argtable, struct arg_end* end arg_dstr_cat(ds, "\n"); } -int arg_make_syntax_err_help_msg(arg_dstr_t ds, char* name, int help, int nerrors, void** argtable, struct arg_end* end, int* exitcode) { +int arg_make_syntax_err_help_msg(arg_dstr_t ds, const char* name, int help, int nerrors, void** argtable, struct arg_end* end, int* exitcode) { /* help handling * note: '-h|--help' takes precedence over error reporting */ diff --git a/src/argtable3.h b/src/argtable3.h index ae076ee..d2479c4 100644 --- a/src/argtable3.h +++ b/src/argtable3.h @@ -262,9 +262,9 @@ ARG_EXTERN arg_cmd_info_t* arg_cmd_itr_value(arg_cmd_itr_t itr); ARG_EXTERN int arg_cmd_itr_search(arg_cmd_itr_t itr, void* k); ARG_EXTERN void arg_mgsort(void* data, int size, int esize, int i, int k, arg_comparefn* comparefn); ARG_EXTERN void arg_make_get_help_msg(arg_dstr_t res); -ARG_EXTERN void arg_make_help_msg(arg_dstr_t ds, char* cmd_name, void** argtable); +ARG_EXTERN void arg_make_help_msg(arg_dstr_t ds, const char* cmd_name, void** argtable); ARG_EXTERN void arg_make_syntax_err_msg(arg_dstr_t ds, void** argtable, struct arg_end* end); -ARG_EXTERN int arg_make_syntax_err_help_msg(arg_dstr_t ds, char* name, int help, int nerrors, void** argtable, struct arg_end* end, int* exitcode); +ARG_EXTERN int arg_make_syntax_err_help_msg(arg_dstr_t ds, const char* name, int help, int nerrors, void** argtable, struct arg_end* end, int* exitcode); ARG_EXTERN void arg_set_module_name(const char* name); ARG_EXTERN void arg_set_module_version(int major, int minor, int patch, const char* tag);