Skip to content

Commit

Permalink
config_format: yaml: Remove STATE_GROUP_{KEY,VAL}
Browse files Browse the repository at this point in the history
These states are no longer used.

Signed-off-by: Thiago Padilha <[email protected]>
  • Loading branch information
tchrono committed May 26, 2024
1 parent dc49a51 commit 3be2531
Showing 1 changed file with 0 additions and 74 deletions.
74 changes: 0 additions & 74 deletions src/config_format/flb_cf_yaml.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ enum state {
STATE_PLUGIN_VAL_LIST,
STATE_PLUGIN_VARIANT,

STATE_GROUP_KEY,
STATE_GROUP_VAL,

STATE_INPUT_PROCESSORS,
STATE_INPUT_PROCESSOR,

Expand Down Expand Up @@ -242,10 +239,6 @@ static char *state_str(enum state val)
return "plugin-values";
case STATE_PLUGIN_VARIANT:
return "plugin-variant";
case STATE_GROUP_KEY:
return "group-key";
case STATE_GROUP_VAL:
return "group-val";
case STATE_INPUT_PROCESSORS:
return "processors";
case STATE_INPUT_PROCESSOR:
Expand Down Expand Up @@ -1625,73 +1618,6 @@ static int consume_event(struct flb_cf *conf, struct local_ctx *ctx,
};
break;

/* groups: a group is a sub-section and here we handle the key/value pairs. */
case STATE_GROUP_KEY:
switch(event->type) {
case YAML_SCALAR_EVENT:
/* grab current value (key) */
value = (char *) event->data.scalar.value;

state = state_push_key(ctx, STATE_GROUP_VAL, value);

if (state == NULL) {
flb_error("unable to allocate state");
return YAML_FAILURE;
}
break;
case YAML_MAPPING_START_EVENT:
break;
case YAML_MAPPING_END_EVENT:

state = state_pop(ctx);

if (state == NULL) {
flb_error("no state left");
return YAML_FAILURE;
}

/* This is also the end of the plugin values mapping.
* So we pop an additional state off the stack.
*/
state = state_pop(ctx);

if (state == NULL) {
flb_error("no state left");
return YAML_FAILURE;
}
break;
default:
yaml_error_event(ctx, state, event);
return YAML_FAILURE;
}
break;

case STATE_GROUP_VAL:
switch(event->type) {
case YAML_SCALAR_EVENT:
value = (char *) event->data.scalar.value;

/* add the kv pair to the active group properties */
if (flb_cf_section_property_add(conf, state->cf_group->properties,
state->key, flb_sds_len(state->key),
value, strlen(value)) == NULL) {
flb_error("unable to add property");
return YAML_FAILURE;
}

state = state_pop(ctx);

if (state == NULL) {
flb_error("no state left");
return YAML_FAILURE;
}
break;
default:
yaml_error_event(ctx, state, event);
return YAML_FAILURE;
}
break;

case STATE_STOP:
break;
}
Expand Down

0 comments on commit 3be2531

Please sign in to comment.