From ce2219915d36fcc4291bed6cc1e1f07c17272d25 Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 18 Nov 2008 14:09:13 -0200 Subject: [PATCH] argp: check if child_inputs is NULL Signed-off-by: Arnaldo Carvalho de Melo --- pdwtags.c | 5 ++++- pfunct.c | 5 ++++- pglobal.c | 5 ++++- syscse.c | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pdwtags.c b/pdwtags.c index 44c3fc7..b23de30 100644 --- a/pdwtags.c +++ b/pdwtags.c @@ -81,7 +81,10 @@ static error_t pdwtags__options_parser(int key, char *arg __unused, struct argp_state *state) { switch (key) { - case ARGP_KEY_INIT: state->child_inputs[0] = state->input; break; + case ARGP_KEY_INIT: + if (state->child_inputs != NULL) + state->child_inputs[0] = state->input; + break; case 'V': conf.show_decl_info = 1; break; default: return ARGP_ERR_UNKNOWN; } diff --git a/pfunct.c b/pfunct.c index 4a95680..980e34d 100644 --- a/pfunct.c +++ b/pfunct.c @@ -453,7 +453,10 @@ static error_t pfunct__options_parser(int key, char *arg, struct argp_state *state) { switch (key) { - case ARGP_KEY_INIT: state->child_inputs[0] = state->input; break; + case ARGP_KEY_INIT: + if (state->child_inputs != NULL) + state->child_inputs[0] = state->input; + break; case 'b': expand_types = true; type_emissions__init(&emissions); break; case 'c': class_name = arg; break; diff --git a/pglobal.c b/pglobal.c index 995f63e..bde1f94 100644 --- a/pglobal.c +++ b/pglobal.c @@ -291,7 +291,10 @@ static error_t pglobal__options_parser(int key, char *arg __unused, struct argp_state *state) { switch (key) { - case ARGP_KEY_INIT: state->child_inputs[0] = state->input; break; + case ARGP_KEY_INIT: + if (state->child_inputs != NULL) + state->child_inputs[0] = state->input; + break; case 'v': walk_var = 1; break; case 'f': walk_fun = 1; break; case 'V': verbose = 1; break; diff --git a/syscse.c b/syscse.c index 880453d..168e560 100644 --- a/syscse.c +++ b/syscse.c @@ -121,7 +121,8 @@ static error_t options_parser(int key, char *arg, struct argp_state *state) { switch (key) { case ARGP_KEY_INIT: - state->child_inputs[0] = state->input; + if (state->child_inputs != NULL) + state->child_inputs[0] = state->input; break; case 'p': prefix = arg;