]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
string-util: drop now unused strnappend()
authorMike Yuan <me@yhndnzj.com>
Mon, 10 Feb 2025 18:05:17 +0000 (19:05 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 10 Feb 2025 18:39:22 +0000 (19:39 +0100)
src/basic/string-util.c
src/basic/string-util.h

index dace8a606d5d87b6868c2b656c68a9008a31c7e6..196f3ff1a12829840a1be3dddf77f7eaed1b7601 100644 (file)
@@ -60,37 +60,6 @@ char* strprepend(char **x, const char *s) {
         return *x;
 }
 
-char* strnappend(const char *s, const char *suffix, size_t b) {
-        size_t a;
-        char *r;
-
-        if (!s && !suffix)
-                return strdup("");
-
-        if (!s)
-                return strndup(suffix, b);
-
-        if (!suffix)
-                return strdup(s);
-
-        assert(s);
-        assert(suffix);
-
-        a = strlen(s);
-        if (b > SIZE_MAX - a)
-                return NULL;
-
-        r = new(char, a+b+1);
-        if (!r)
-                return NULL;
-
-        memcpy(r, s, a);
-        memcpy(r+a, suffix, b);
-        r[a+b] = 0;
-
-        return r;
-}
-
 char* strstrip(char *s) {
         if (!s)
                 return NULL;
index 1b2f09706107e2f3b964812f0d813b722cf85f22..6a30193746f9d2c97d96214d69f6c1d011ddd794 100644 (file)
@@ -108,8 +108,6 @@ char* first_word(const char *s, const char *word) _pure_;
 
 char* strprepend(char **x, const char *s);
 
-char* strnappend(const char *s, const char *suffix, size_t length);
-
 #define strjoin(a, ...) strextend_with_separator_internal(NULL, NULL, a, __VA_ARGS__, NULL)
 
 #define strjoina(a, ...)                                                \