summaryrefslogtreecommitdiff
path: root/src/shared/conf-parser.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-03-03 21:26:53 +0100
committerLennart Poettering <lennart@poettering.net>2014-03-03 21:26:53 +0100
commit3af00fb85a26a1d812363fbf88c045311fd05376 (patch)
treec3ff78e112edd00e6f590dd6e9491ecec630a416 /src/shared/conf-parser.c
parent4d7213b2747ddd87002f970ccc60b1a9ab637136 (diff)
core: move config_parse_set_status() into load-fragment.c
Let's keep specific config parsers close to where they are needed. Only the really generic ones should be defined in conf-parser.[ch].
Diffstat (limited to 'src/shared/conf-parser.c')
-rw-r--r--src/shared/conf-parser.c85
1 files changed, 0 insertions, 85 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index accbdac6b1..161f6ad65a 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -867,88 +867,3 @@ int config_parse_log_level(
*o = (*o & LOG_FACMASK) | x;
return 0;
}
-
-int config_parse_set_status(const char *unit,
- const char *filename,
- unsigned line,
- const char *section,
- unsigned section_line,
- const char *lvalue,
- int ltype,
- const char *rvalue,
- void *data,
- void *userdata) {
-
- char *w;
- size_t l;
- char *state;
- int r;
- ExitStatusSet *status_set = data;
-
- assert(filename);
- assert(lvalue);
- assert(rvalue);
- assert(data);
-
- if (isempty(rvalue)) {
- /* Empty assignment resets the list */
-
- set_free(status_set->signal);
- set_free(status_set->code);
-
- status_set->signal = status_set->code = NULL;
- return 0;
- }
-
- FOREACH_WORD(w, l, rvalue, state) {
- int val;
- char *temp;
-
- temp = strndup(w, l);
- if (!temp)
- return log_oom();
-
- r = safe_atoi(temp, &val);
- if (r < 0) {
- val = signal_from_string_try_harder(temp);
- free(temp);
-
- if (val > 0) {
- r = set_ensure_allocated(&status_set->signal, trivial_hash_func, trivial_compare_func);
- if (r < 0)
- return log_oom();
-
- r = set_put(status_set->signal, INT_TO_PTR(val));
- if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, -r,
- "Unable to store: %s", w);
- return r;
- }
- } else {
- log_syntax(unit, LOG_ERR, filename, line, -val,
- "Failed to parse value, ignoring: %s", w);
- return 0;
- }
- } else {
- free(temp);
-
- if (val < 0 || val > 255)
- log_syntax(unit, LOG_ERR, filename, line, ERANGE,
- "Value %d is outside range 0-255, ignoring", val);
- else {
- r = set_ensure_allocated(&status_set->code, trivial_hash_func, trivial_compare_func);
- if (r < 0)
- return log_oom();
-
- r = set_put(status_set->code, INT_TO_PTR(val));
- if (r < 0) {
- log_syntax(unit, LOG_ERR, filename, line, -r,
- "Unable to store: %s", w);
- return r;
- }
- }
- }
- }
-
- return 0;
-}