argp: check if child_inputs is NULL

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2008-11-18 14:09:13 -02:00
parent bcf1c15d8b
commit ce2219915d
4 changed files with 14 additions and 4 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;