-static int config_parse_output(
- const char *filename,
- unsigned line,
- const char *section,
- const char *lvalue,
- const char *rvalue,
- void *data,
- void *userdata) {
-
- ExecOutput *o = data, x;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(data);
-
- if ((x = exec_output_from_string(rvalue)) < 0) {
- log_error("[%s:%u] Failed to parse output specifier: %s", filename, line, rvalue);
- return -EBADMSG;
- }
-
- *o = x;
-
- return 0;
-}
-
-static int config_parse_input(
- const char *filename,
- unsigned line,
- const char *section,
- const char *lvalue,
- const char *rvalue,
- void *data,
- void *userdata) {
-
- ExecInput *i = data, x;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(data);
-
- if ((x = exec_input_from_string(rvalue)) < 0) {
- log_error("[%s:%u] Failed to parse input specifier: %s", filename, line, rvalue);
- return -EBADMSG;
- }
-
- *i = x;
-
- return 0;
-}
+DEFINE_CONFIG_PARSE_ENUM(config_parse_output, exec_output, ExecOutput, "Failed to parse output specifier");
+DEFINE_CONFIG_PARSE_ENUM(config_parse_input, exec_input, ExecInput, "Failed to parse input specifier");