+static const struct ec_config_schema ec_node_str_schema[] = {
+ {
+ .key = "string",
+ .desc = "The string to match.",
+ .type = EC_CONFIG_TYPE_STRING,
+ },
+};
+
+static int ec_node_str_set_config(struct ec_node *gen_node,
+ const struct ec_config *config)
+{
+ struct ec_node_str *node = (struct ec_node_str *)gen_node;
+ const struct ec_config *value = NULL;
+ char *s = NULL;
+
+ value = ec_config_dict_get(config, "string");
+ if (value == NULL) {
+ errno = EINVAL;
+ goto fail;
+ }
+
+ s = ec_strdup(value->string);
+ if (s == NULL)
+ goto fail;
+
+ ec_free(node->string);
+ node->string = s;
+ node->len = strlen(node->string);
+
+ return 0;
+
+fail:
+ ec_free(s);
+ return -1;
+}
+