From 3be2531817f0bd72218d2404ca5a3a09d7772ab9 Mon Sep 17 00:00:00 2001 From: Thiago Padilha Date: Sun, 26 May 2024 12:02:58 -0300 Subject: [PATCH] config_format: yaml: Remove STATE_GROUP_{KEY,VAL} These states are no longer used. Signed-off-by: Thiago Padilha --- src/config_format/flb_cf_yaml.c | 74 --------------------------------- 1 file changed, 74 deletions(-) diff --git a/src/config_format/flb_cf_yaml.c b/src/config_format/flb_cf_yaml.c index acb7fcb06ec..b2d8f707526 100644 --- a/src/config_format/flb_cf_yaml.c +++ b/src/config_format/flb_cf_yaml.c @@ -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, @@ -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: @@ -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; }