*p = '\0';
}
-extern char *strnappend(const char *s, const char *suffix, size_t b);
-extern char *strappend(const char *s, const char *suffix);
-extern char *strfappend(const char *s, const char *format, ...)
+extern char *strnconcat(const char *s, const char *suffix, size_t b);
+extern char *strconcat(const char *s, const char *suffix);
+extern char *strfconcat(const char *s, const char *format, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
extern const char *split(const char **state, size_t *l, const char *separator, int quoted);
return 0;
}
-char *strnappend(const char *s, const char *suffix, size_t b)
+/* concatenate two strings to a new string, the size of the second string is limited by @b */
+char *strnconcat(const char *s, const char *suffix, size_t b)
{
size_t a;
char *r;
return r;
}
-char *strappend(const char *s, const char *suffix)
+/* concatenate two strings to a new string */
+char *strconcat(const char *s, const char *suffix)
{
- return strnappend(s, suffix, suffix ? strlen(suffix) : 0);
+ return strnconcat(s, suffix, suffix ? strlen(suffix) : 0);
}
-char *strfappend(const char *s, const char *format, ...)
+/* concatenate @s and string defined by @format to a new string */
+char *strfconcat(const char *s, const char *format, ...)
{
va_list ap;
char *val, *res;
if (sz < 0)
return NULL;
- res = strnappend(s, val, sz);
+ res = strnconcat(s, val, sz);
free(val);
return res;
}
STRV_FOREACH(s, b) {
char *v;
- v = strappend(*s, suffix);
+ v = strconcat(*s, suffix);
if (!v)
return -ENOMEM;
src = mnt_fs_get_srcpath(rootfs);
if (fstype && strncmp(fstype, "nfs", 3) == 0 && root) {
/* NFS stores the root at the end of the source */
- src = src2 = strappend(src, root);
+ src = src2 = strconcat(src, root);
free(root);
root = NULL;
}
{
free(ctl->optstr);
if (*options != '+' && getenv("POSIXLY_CORRECT"))
- ctl->optstr = strappend("+", options);
+ ctl->optstr = strconcat("+", options);
else
ctl->optstr = xstrdup(options);
if (!ctl->optstr)
if (!one)
continue;
- res = strappend(tmp, one);
+ res = strconcat(tmp, one);
free(tmp);
free(one);
}
usr = strdup_structured_data_list(&ctl->user_sds);
if (sys && usr) {
- res = strappend(sys, usr);
+ res = strconcat(sys, usr);
free(sys);
free(usr);
} else