Browse Source

fix: add the "const" qualifier to the api

Resolves #95
pull/100/head
Tom Huang 6 months ago
parent
commit
3634526b10
  1. 4
      src/arg_cmd.c
  2. 4
      src/argtable3.h

4
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
*/

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

Loading…
Cancel
Save