- /* We'll only escape the obvious characters here, to play
- * safe. */
-
- valid_chars = allow_globs == MANGLE_GLOB ? "@" VALID_CHARS "[]!-*?" : "@" VALID_CHARS;
-
- r = new(char, strlen(name) * 4 + strlen(".service") + 1);
- if (!r)
- return NULL;
-
- for (f = name, t = r; *f; f++) {
- if (*f == '/')
- *(t++) = '-';
- else if (!strchr(valid_chars, *f))
- t = do_escape_char(*f, t);
- else
- *(t++) = *f;
- }
-
- if (unit_name_to_type(name) < 0)
- strcpy(t, ".service");
- else
- *t = 0;
-
- return r;
-}
-
-/**
- * Similar to unit_name_mangle(), but is called when we know
- * that this is about a specific unit type.
- */
-char *unit_name_mangle_with_suffix(const char *name, enum unit_name_mangle allow_globs, const char *suffix) {
- char *r, *t;
- const char *f;
-
- assert(name);
- assert(IN_SET(allow_globs, MANGLE_GLOB, MANGLE_NOGLOB));
- assert(suffix);
- assert(suffix[0] == '.');
-