From: Karel Zak Date: Mon, 30 Jun 2025 09:15:30 +0000 (+0200) Subject: lib/strutils: add ul_ prefix to strappend() functions X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=d42e5e4bc355277b820d98768e2fda52e2d08e76;p=thirdparty%2Futil-linux.git lib/strutils: add ul_ prefix to strappend() functions Addresses: https://github.com/util-linux/util-linux/issues/3626 Signed-off-by: Karel Zak --- diff --git a/include/strutils.h b/include/strutils.h index db95f79cb..73aba5975 100644 --- a/include/strutils.h +++ b/include/strutils.h @@ -461,10 +461,10 @@ extern char *ul_strconcat(const char *s, const char *suffix); extern char *ul_strfconcat(const char *s, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); -extern int strappend(char **a, const char *b); +extern int ul_strappend(char **a, const char *b); extern int strfappend(char **a, const char *format, ...) __attribute__ ((__format__ (__printf__, 2, 3))); -extern int strvfappend(char **a, const char *format, va_list ap) +extern int ul_strvfappend(char **a, const char *format, va_list ap) __attribute__ ((__format__ (__printf__, 2, 0))); extern const char *split(const char **state, size_t *l, const char *separator, int quoted); diff --git a/include/xalloc.h b/include/xalloc.h index 2d13d54b9..c620a4921 100644 --- a/include/xalloc.h +++ b/include/xalloc.h @@ -139,7 +139,7 @@ int xvasprintf(char **strp, const char *fmt, va_list ap) static inline void xstrappend(char **a, const char *b) { - if (strappend(a, b) < 0) + if (ul_strappend(a, b) < 0) err(XALLOC_EXIT_CODE, "cannot allocate string"); } @@ -153,7 +153,7 @@ static inline __attribute__((__format__(printf, 2, 0))) int xstrvfappend(char **a, const char *format, va_list ap) { - int ret = strvfappend(a, format, ap); + int ret = ul_strvfappend(a, format, ap); if (ret < 0) err(XALLOC_EXIT_CODE, "cannot allocate string"); diff --git a/lib/strutils.c b/lib/strutils.c index f25d8aba1..c686feafe 100644 --- a/lib/strutils.c +++ b/lib/strutils.c @@ -1019,7 +1019,7 @@ char *ul_strfconcat(const char *s, const char *format, ...) return res; } -int strappend(char **a, const char *b) +int ul_strappend(char **a, const char *b) { size_t al, bl; char *tmp; @@ -1051,13 +1051,13 @@ int strfappend(char **a, const char *format, ...) int res; va_start(ap, format); - res = strvfappend(a, format, ap); + res = ul_strvfappend(a, format, ap); va_end(ap); return res; } -extern int strvfappend(char **a, const char *format, va_list ap) +extern int ul_strvfappend(char **a, const char *format, va_list ap) { char *val; int sz; @@ -1067,7 +1067,7 @@ extern int strvfappend(char **a, const char *format, va_list ap) if (sz < 0) return -errno; - res = strappend(a, val); + res = ul_strappend(a, val); free(val); return res; } diff --git a/libmount/src/fs.c b/libmount/src/fs.c index c01c313b1..64c7ee865 100644 --- a/libmount/src/fs.c +++ b/libmount/src/fs.c @@ -1668,7 +1668,7 @@ int mnt_fs_append_comment(struct libmnt_fs *fs, const char *comm) if (!fs) return -EINVAL; - return strappend(&fs->comment, comm); + return ul_strappend(&fs->comment, comm); } /** diff --git a/libmount/src/tab.c b/libmount/src/tab.c index bde55b73d..4209d697a 100644 --- a/libmount/src/tab.c +++ b/libmount/src/tab.c @@ -318,7 +318,7 @@ int mnt_table_append_intro_comment(struct libmnt_table *tb, const char *comm) { if (!tb) return -EINVAL; - return strappend(&tb->comm_intro, comm); + return ul_strappend(&tb->comm_intro, comm); } /** @@ -359,7 +359,7 @@ int mnt_table_append_trailing_comment(struct libmnt_table *tb, const char *comm) { if (!tb) return -EINVAL; - return strappend(&tb->comm_tail, comm); + return ul_strappend(&tb->comm_tail, comm); } /**