diff options
author | Elliot Lee <sopwith@src.gnome.org> | 1998-10-20 22:28:17 +0000 |
---|---|---|
committer | Elliot Lee <sopwith@src.gnome.org> | 1998-10-20 22:28:17 +0000 |
commit | 88a22179aceede0c10de97e427e29096e3db5ac2 (patch) | |
tree | 26cf85012680fc927a7757ed9581cddd131b9566 /gstrfuncs.c | |
parent | 46ec86252b330feb485c448a4e1d8a33c0820d43 (diff) |
I swear I'll get it right someday.
I swear I'll get it right someday.
Diffstat (limited to 'gstrfuncs.c')
-rw-r--r-- | gstrfuncs.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/gstrfuncs.c b/gstrfuncs.c index 60fd28b49..31283ce87 100644 --- a/gstrfuncs.c +++ b/gstrfuncs.c @@ -1039,12 +1039,11 @@ g_str_split(const gchar *string, const gchar *delim, gint max_tokens) gchar * g_str_chug(gchar *astring, gboolean in_place) { - int i; gchar *retval, *start; g_return_val_if_fail(astring != NULL, NULL); - for(start = retval; *start && isspace(*start); start++) + for(start = astring; *start && isspace(*start); start++) /* */; if(in_place) { @@ -1094,25 +1093,30 @@ g_str_array_free(gchar **strarray) g_free(strarray); } -gchar* -g_strconcatv (const gchar **strarray) +gchar* g_strconcatv (const gchar *separator, + const gchar **strarray) { - guint l; - va_list args; - gchar *s; + guint l, sepl; gchar *concat; int i; g_return_val_if_fail (strarray != NULL, NULL); - for(i = 0, l = 1; strarray[i]; i++) + l = strlen(strarray[0]) + 1; + sepl = strlen(separator); + for(i = 1; strarray[i]; i++) { + l += sepl; l += strlen(strarray[i]); + } concat = g_new (gchar, l); *concat = '\0'; - for(i = 0; strarray[i]; i++) + strcat (concat, strarray[0]); + for(i = 1; strarray[i]; i++) { + strcat (concat, separator); strcat (concat, strarray[i]); + } return concat; } |