cliparser updates

This commit is contained in:
iceman1001 2020-01-09 14:26:52 +01:00
commit 68eb66052a

View file

@ -3484,8 +3484,12 @@ TRexBool trex_getsubexp(TRex *exp, int n, TRexMatch *subexp) {
static void arg_str_resetfn(struct arg_str *parent) { static void arg_str_resetfn(struct arg_str *parent) {
int i;
ARG_TRACE(("%s:resetfn(%p)\n", __FILE__, parent)); ARG_TRACE(("%s:resetfn(%p)\n", __FILE__, parent));
parent->count = 0; parent->count = 0;
for (i = 0; i < parent->count; i++) {
parent->sval[i] = "";
}
} }
@ -3671,8 +3675,7 @@ void arg_register_error(struct arg_end *end,
* Return index of first table entry with a matching short option * Return index of first table entry with a matching short option
* or -1 if no match was found. * or -1 if no match was found.
*/ */
static static int find_shortoption(struct arg_hdr** table, char shortopt) {
int find_shortoption(struct arg_hdr * *table, char shortopt) {
int tabindex; int tabindex;
for (tabindex = 0; !(table[tabindex]->flag & ARG_TERMINATOR); tabindex++) { for (tabindex = 0; !(table[tabindex]->flag & ARG_TERMINATOR); tabindex++) {
if (table[tabindex]->shortopts && if (table[tabindex]->shortopts &&
@ -3682,7 +3685,6 @@ int find_shortoption(struct arg_hdr * *table, char shortopt) {
return -1; return -1;
} }
struct longoptions { struct longoptions {
int getoptval; int getoptval;
int noptions; int noptions;
@ -3706,8 +3708,7 @@ void dump_longoptions(struct longoptions *longoptions) {
} }
#endif #endif
static static struct longoptions* alloc_longoptions(struct arg_hdr** table) {
struct longoptions *alloc_longoptions(struct arg_hdr * *table) {
struct longoptions *result; struct longoptions *result;
size_t nbytes; size_t nbytes;
int noptions = 1; int noptions = 1;
@ -3789,8 +3790,7 @@ struct longoptions *alloc_longoptions(struct arg_hdr * *table) {
return result; return result;
} }
static static char* alloc_shortoptions(struct arg_hdr** table) {
char *alloc_shortoptions(struct arg_hdr * *table) {
char *result; char *result;
size_t len = 2; size_t len = 2;
int tabindex; int tabindex;
@ -3830,8 +3830,7 @@ char *alloc_shortoptions(struct arg_hdr * *table) {
/* return index of the table terminator entry */ /* return index of the table terminator entry */
static static int arg_endindex(struct arg_hdr** table) {
int arg_endindex(struct arg_hdr * *table) {
int tabindex = 0; int tabindex = 0;
while (!(table[tabindex]->flag & ARG_TERMINATOR)) while (!(table[tabindex]->flag & ARG_TERMINATOR))
tabindex++; tabindex++;
@ -3839,8 +3838,7 @@ int arg_endindex(struct arg_hdr * *table) {
} }
static static void arg_parse_tagged(int argc,
void arg_parse_tagged(int argc,
char **argv, char **argv,
struct arg_hdr **table, struct arg_hdr **table,
struct arg_end *endtable) { struct arg_end *endtable) {
@ -3953,8 +3951,7 @@ void arg_parse_tagged(int argc,
} }
static static void arg_parse_untagged(int argc,
void arg_parse_untagged(int argc,
char **argv, char **argv,
struct arg_hdr **table, struct arg_hdr **table,
struct arg_end *endtable) { struct arg_end *endtable) {
@ -4010,7 +4007,6 @@ void arg_parse_untagged(int argc,
optarglast = argv[optind]; optarglast = argv[optind];
parentlast = parent; parentlast = parent;
} }
} }
/* if a tenative error still remains at this point then register it as a proper error */ /* if a tenative error still remains at this point then register it as a proper error */
@ -4030,8 +4026,7 @@ void arg_parse_untagged(int argc,
} }
static static void arg_parse_check(struct arg_hdr **table, struct arg_end *endtable) {
void arg_parse_check(struct arg_hdr * *table, struct arg_end *endtable) {
int tabindex = 0; int tabindex = 0;
/* printf("arg_parse_check()\n"); */ /* printf("arg_parse_check()\n"); */
do { do {
@ -4045,8 +4040,7 @@ void arg_parse_check(struct arg_hdr * *table, struct arg_end *endtable) {
} }
static static void arg_reset(void **argtable) {
void arg_reset(void * *argtable) {
struct arg_hdr * *table = (struct arg_hdr * *)argtable; struct arg_hdr * *table = (struct arg_hdr * *)argtable;
int tabindex = 0; int tabindex = 0;
/*printf("arg_reset(%p)\n",argtable);*/ /*printf("arg_reset(%p)\n",argtable);*/
@ -4138,8 +4132,7 @@ int arg_parse(int argc, char * *argv, void * *argtable) {
* dest[] == "goodbye cruel world!" * dest[] == "goodbye cruel world!"
* ndest == 10 * ndest == 10
*/ */
static static void arg_cat(char **pdest, const char *src, size_t *pndest) {
void arg_cat(char * *pdest, const char *src, size_t *pndest) {
char *dest = *pdest; char *dest = *pdest;
char *end = dest + *pndest; char *end = dest + *pndest;
@ -4160,8 +4153,7 @@ void arg_cat(char * *pdest, const char *src, size_t *pndest) {
} }
static static void arg_cat_option(char *dest,
void arg_cat_option(char *dest,
size_t ndest, size_t ndest,
const char *shortopts, const char *shortopts,
const char *longopts, const char *longopts,
@ -4219,8 +4211,7 @@ void arg_cat_option(char *dest,
} }
} }
static static void arg_cat_optionv(char *dest,
void arg_cat_optionv(char *dest,
size_t ndest, size_t ndest,
const char *shortopts, const char *shortopts,
const char *longopts, const char *longopts,
@ -4666,7 +4657,6 @@ int arg_nullcheck(void * *argtable) {
return 0; return 0;
} }
/* /*
* arg_free() is deprecated in favour of arg_freetable() due to a flaw in its design. * arg_free() is deprecated in favour of arg_freetable() due to a flaw in its design.
* The flaw results in memory leak in the (very rare) case that an intermediate * The flaw results in memory leak in the (very rare) case that an intermediate