From: Christian Brauner Date: Sat, 17 Feb 2018 16:06:56 +0000 (+0100) Subject: cgfsng: move cg_legacy_must_prefix_named() X-Git-Tag: lxc-2.0.10~316 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19e3ba64f08cf73040b2a685cd271fdac4b60606;p=thirdparty%2Flxc.git cgfsng: move cg_legacy_must_prefix_named() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 365ac3eee..93aca2eba 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -205,23 +205,6 @@ static void *must_alloc(size_t sz) return must_realloc(NULL, sz); } -/* Return a copy of @entry prepending "name=", i.e. turn "systemd" into - * "name=systemd". Do not fail. - */ -static char *cg_legacy_must_prefix_named(char *entry) -{ - size_t len; - char *prefixed; - - len = strlen(entry); - prefixed = must_alloc(len + 6); - - memcpy(prefixed, "name=", sizeof("name=")); - memcpy(prefixed + sizeof("name="), entry, len); - prefixed[len + 5] = '\0'; - return prefixed; -} - /* * Given a pointer to a null-terminated array of pointers, realloc to * add one entry, and point the new entry to NULL. Do not fail. Return @@ -258,6 +241,23 @@ static bool string_in_list(char **list, const char *entry) return false; } +/* Return a copy of @entry prepending "name=", i.e. turn "systemd" into + * "name=systemd". Do not fail. + */ +static char *cg_legacy_must_prefix_named(char *entry) +{ + size_t len; + char *prefixed; + + len = strlen(entry); + prefixed = must_alloc(len + 6); + + memcpy(prefixed, "name=", sizeof("name=")); + memcpy(prefixed + sizeof("name="), entry, len); + prefixed[len + 5] = '\0'; + return prefixed; +} + /* * append an entry to the clist. Do not fail. * *clist must be NULL the first time we are called.