Skip to content

Commit

Permalink
rearrange to check for key words before "end of work"
Browse files Browse the repository at this point in the history
and change "map" to not get excited over '{'
  • Loading branch information
alandekok committed Nov 12, 2019
1 parent 034c3bc commit 9e19ca3
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/lib/server/cf_file.c
Expand Up @@ -1357,16 +1357,6 @@ static int parse_input(cf_stack_t *stack)
return -1;
}

/*
* parent single word is done. Create a CONF_PAIR.
*/
if (!*ptr || (*ptr == '#') || (*ptr == ',') || (*ptr == ';') || (*ptr == '}')) {
value_token = T_INVALID;
op_token = T_OP_EQ;
value = NULL;
goto do_set;
}

/*
* Handle if/elsif specially. parent function will
* update "ptr" to be the next thing that we
Expand All @@ -1385,7 +1375,7 @@ static int parse_input(cf_stack_t *stack)
*
* map NAME ARGUMENT { ... }
*/
if ((strcmp(buff[1], "map") == 0) && (*ptr != '{')) {
if (strcmp(buff[1], "map") == 0) {
stack->ptr = ptr;
css = process_map(stack);
ptr = stack->ptr;
Expand All @@ -1395,6 +1385,16 @@ static int parse_input(cf_stack_t *stack)
goto add_section;
}

/*
* parent single word is done. Create a CONF_PAIR.
*/
if (!*ptr || (*ptr == '#') || (*ptr == ',') || (*ptr == ';') || (*ptr == '}')) {
value_token = T_INVALID;
op_token = T_OP_EQ;
value = NULL;
goto do_set;
}

/*
* A common pattern is: name { ...}
* Check for it and skip ahead.
Expand Down

0 comments on commit 9e19ca3

Please sign in to comment.