I swear I'll get it right someday.

I swear I'll get it right someday.
This commit is contained in:
Elliot Lee 1998-10-20 22:28:17 +00:00
parent 46ec86252b
commit 88a22179ac
4 changed files with 30 additions and 20 deletions

3
glib.h
View File

@ -1379,7 +1379,8 @@ gchar * g_str_chomp (gchar *astring,
gchar ** g_str_split (const gchar *string, gchar ** g_str_split (const gchar *string,
const gchar *delim, const gchar *delim,
gint max_tokens); gint max_tokens);
gchar* g_strconcatv (const gchar **strarray); gchar* g_strconcatv (const gchar *separator,
const gchar **strarray);
#define g_str_joinv g_strconcatv #define g_str_joinv g_strconcatv
void g_str_array_free (gchar **strarray); void g_str_array_free (gchar **strarray);

View File

@ -1379,7 +1379,8 @@ gchar * g_str_chomp (gchar *astring,
gchar ** g_str_split (const gchar *string, gchar ** g_str_split (const gchar *string,
const gchar *delim, const gchar *delim,
gint max_tokens); gint max_tokens);
gchar* g_strconcatv (const gchar **strarray); gchar* g_strconcatv (const gchar *separator,
const gchar **strarray);
#define g_str_joinv g_strconcatv #define g_str_joinv g_strconcatv
void g_str_array_free (gchar **strarray); void g_str_array_free (gchar **strarray);

View File

@ -1039,12 +1039,11 @@ g_str_split(const gchar *string, const gchar *delim, gint max_tokens)
gchar * gchar *
g_str_chug(gchar *astring, gboolean in_place) g_str_chug(gchar *astring, gboolean in_place)
{ {
int i;
gchar *retval, *start; gchar *retval, *start;
g_return_val_if_fail(astring != NULL, NULL); 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) { if(in_place) {
@ -1094,25 +1093,30 @@ g_str_array_free(gchar **strarray)
g_free(strarray); g_free(strarray);
} }
gchar* gchar* g_strconcatv (const gchar *separator,
g_strconcatv (const gchar **strarray) const gchar **strarray)
{ {
guint l; guint l, sepl;
va_list args;
gchar *s;
gchar *concat; gchar *concat;
int i; int i;
g_return_val_if_fail (strarray != NULL, NULL); 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]); l += strlen(strarray[i]);
}
concat = g_new (gchar, l); concat = g_new (gchar, l);
*concat = '\0'; *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]); strcat (concat, strarray[i]);
}
return concat; return concat;
} }

View File

@ -1039,12 +1039,11 @@ g_str_split(const gchar *string, const gchar *delim, gint max_tokens)
gchar * gchar *
g_str_chug(gchar *astring, gboolean in_place) g_str_chug(gchar *astring, gboolean in_place)
{ {
int i;
gchar *retval, *start; gchar *retval, *start;
g_return_val_if_fail(astring != NULL, NULL); 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) { if(in_place) {
@ -1094,25 +1093,30 @@ g_str_array_free(gchar **strarray)
g_free(strarray); g_free(strarray);
} }
gchar* gchar* g_strconcatv (const gchar *separator,
g_strconcatv (const gchar **strarray) const gchar **strarray)
{ {
guint l; guint l, sepl;
va_list args;
gchar *s;
gchar *concat; gchar *concat;
int i; int i;
g_return_val_if_fail (strarray != NULL, NULL); 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]); l += strlen(strarray[i]);
}
concat = g_new (gchar, l); concat = g_new (gchar, l);
*concat = '\0'; *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]); strcat (concat, strarray[i]);
}
return concat; return concat;
} }