*** empty log message ***

This commit is contained in:
Owen Taylor 2001-03-26 18:35:34 +00:00
parent aa6cf573d9
commit b8d7add377
19 changed files with 219 additions and 30 deletions

View File

@ -1,3 +1,14 @@
Mon Mar 26 13:34:50 2001 Owen Taylor <otaylor@redhat.com>
[ Patch from DindinX <David.Odin@bigfoot.com>, added docs ]
* gstrfuncs.c, gstrfuncs.h: Add g_stpcpy () for platform that don't
have stpcpy ().
* gstrfuncs.c (g_strjoin, g_strjoinv and g_strconcat): use
g_stpcpy () so these functions run much faster.
* config.h.win32.in, glib.def: add reference to g_stpcpy ()
* configure.in: Add a test for the stpcpy () function.
2001-03-20 Havoc Pennington <hp@redhat.com>
* gutf8.c (g_utf8_strlen): rewrite, based on bug #52328 from

View File

@ -1,3 +1,14 @@
Mon Mar 26 13:34:50 2001 Owen Taylor <otaylor@redhat.com>
[ Patch from DindinX <David.Odin@bigfoot.com>, added docs ]
* gstrfuncs.c, gstrfuncs.h: Add g_stpcpy () for platform that don't
have stpcpy ().
* gstrfuncs.c (g_strjoin, g_strjoinv and g_strconcat): use
g_stpcpy () so these functions run much faster.
* config.h.win32.in, glib.def: add reference to g_stpcpy ()
* configure.in: Add a test for the stpcpy () function.
2001-03-20 Havoc Pennington <hp@redhat.com>
* gutf8.c (g_utf8_strlen): rewrite, based on bug #52328 from

View File

@ -1,3 +1,14 @@
Mon Mar 26 13:34:50 2001 Owen Taylor <otaylor@redhat.com>
[ Patch from DindinX <David.Odin@bigfoot.com>, added docs ]
* gstrfuncs.c, gstrfuncs.h: Add g_stpcpy () for platform that don't
have stpcpy ().
* gstrfuncs.c (g_strjoin, g_strjoinv and g_strconcat): use
g_stpcpy () so these functions run much faster.
* config.h.win32.in, glib.def: add reference to g_stpcpy ()
* configure.in: Add a test for the stpcpy () function.
2001-03-20 Havoc Pennington <hp@redhat.com>
* gutf8.c (g_utf8_strlen): rewrite, based on bug #52328 from

View File

@ -1,3 +1,14 @@
Mon Mar 26 13:34:50 2001 Owen Taylor <otaylor@redhat.com>
[ Patch from DindinX <David.Odin@bigfoot.com>, added docs ]
* gstrfuncs.c, gstrfuncs.h: Add g_stpcpy () for platform that don't
have stpcpy ().
* gstrfuncs.c (g_strjoin, g_strjoinv and g_strconcat): use
g_stpcpy () so these functions run much faster.
* config.h.win32.in, glib.def: add reference to g_stpcpy ()
* configure.in: Add a test for the stpcpy () function.
2001-03-20 Havoc Pennington <hp@redhat.com>
* gutf8.c (g_utf8_strlen): rewrite, based on bug #52328 from

View File

@ -1,3 +1,14 @@
Mon Mar 26 13:34:50 2001 Owen Taylor <otaylor@redhat.com>
[ Patch from DindinX <David.Odin@bigfoot.com>, added docs ]
* gstrfuncs.c, gstrfuncs.h: Add g_stpcpy () for platform that don't
have stpcpy ().
* gstrfuncs.c (g_strjoin, g_strjoinv and g_strconcat): use
g_stpcpy () so these functions run much faster.
* config.h.win32.in, glib.def: add reference to g_stpcpy ()
* configure.in: Add a test for the stpcpy () function.
2001-03-20 Havoc Pennington <hp@redhat.com>
* gutf8.c (g_utf8_strlen): rewrite, based on bug #52328 from

View File

@ -1,3 +1,14 @@
Mon Mar 26 13:34:50 2001 Owen Taylor <otaylor@redhat.com>
[ Patch from DindinX <David.Odin@bigfoot.com>, added docs ]
* gstrfuncs.c, gstrfuncs.h: Add g_stpcpy () for platform that don't
have stpcpy ().
* gstrfuncs.c (g_strjoin, g_strjoinv and g_strconcat): use
g_stpcpy () so these functions run much faster.
* config.h.win32.in, glib.def: add reference to g_stpcpy ()
* configure.in: Add a test for the stpcpy () function.
2001-03-20 Havoc Pennington <hp@redhat.com>
* gutf8.c (g_utf8_strlen): rewrite, based on bug #52328 from

View File

@ -1,3 +1,14 @@
Mon Mar 26 13:34:50 2001 Owen Taylor <otaylor@redhat.com>
[ Patch from DindinX <David.Odin@bigfoot.com>, added docs ]
* gstrfuncs.c, gstrfuncs.h: Add g_stpcpy () for platform that don't
have stpcpy ().
* gstrfuncs.c (g_strjoin, g_strjoinv and g_strconcat): use
g_stpcpy () so these functions run much faster.
* config.h.win32.in, glib.def: add reference to g_stpcpy ()
* configure.in: Add a test for the stpcpy () function.
2001-03-20 Havoc Pennington <hp@redhat.com>
* gutf8.c (g_utf8_strlen): rewrite, based on bug #52328 from

View File

@ -1,3 +1,14 @@
Mon Mar 26 13:34:50 2001 Owen Taylor <otaylor@redhat.com>
[ Patch from DindinX <David.Odin@bigfoot.com>, added docs ]
* gstrfuncs.c, gstrfuncs.h: Add g_stpcpy () for platform that don't
have stpcpy ().
* gstrfuncs.c (g_strjoin, g_strjoinv and g_strconcat): use
g_stpcpy () so these functions run much faster.
* config.h.win32.in, glib.def: add reference to g_stpcpy ()
* configure.in: Add a test for the stpcpy () function.
2001-03-20 Havoc Pennington <hp@redhat.com>
* gutf8.c (g_utf8_strlen): rewrite, based on bug #52328 from

View File

@ -102,6 +102,9 @@
/* Define if you have the on_exit function. */
/* #undef HAVE_ON_EXIT */
/* Define if you have the stpcpy function. */
/* #undef HAVE_STPCPY */
/* Define if you have the strcasecmp function. */
/* #undef HAVE_STRCASECMP */

View File

@ -412,7 +412,7 @@ GLIB_SIZEOF([$size_includes], ptrdiff_t, ptrdiff_t)
GLIB_SIZEOF([$size_includes], intmax_t, intmax_t)
# Check for some functions
AC_CHECK_FUNCS(lstat strerror strsignal memmove mkstemp vsnprintf strcasecmp strncasecmp poll getcwd)
AC_CHECK_FUNCS(lstat strerror strsignal memmove mkstemp vsnprintf stpcpy strcasecmp strncasecmp poll getcwd)
# Check if bcopy can be used for overlapping copies, if memmove isn't found.
# The check is borrowed from the PERL Configure script.

View File

@ -804,6 +804,7 @@ g_strdup
g_strndup
g_strdupv
g_strnfill
g_stpcpy
<SUBSECTION>
g_strlcpy

View File

@ -66,7 +66,6 @@ only one statement is expected by the compiler.
Portable way to copy <type>va_list</type> variables.
</para>
<!-- # Unused Parameters # -->
@ap1: the <type>va_list</type> variable to place a copy of @ap2 in.
@ap2: a <type>va_list</type>.

View File

@ -59,6 +59,16 @@ The returned string should be freed when no longer needed.
@Returns: a newly-allocated string filled the @fill_char.
<!-- ##### FUNCTION g_stpcpy ##### -->
<para>
</para>
@dest:
@src:
@Returns:
<!-- ##### FUNCTION g_strlcpy ##### -->
<para>

View File

@ -475,6 +475,7 @@ EXPORTS
g_static_rw_lock_writer_lock
g_static_rw_lock_writer_trylock
g_static_rw_lock_writer_unlock
g_strcpy
g_str_equal
g_str_hash
g_strcanon

View File

@ -475,6 +475,7 @@ EXPORTS
g_static_rw_lock_writer_lock
g_static_rw_lock_writer_trylock
g_static_rw_lock_writer_unlock
g_strcpy
g_str_equal
g_str_hash
g_strcanon

View File

@ -118,6 +118,40 @@ g_strnfill (guint length,
return str;
}
/**
* g_stpcpy:
* @dest: destination buffer
* @src: source string
*
* Copies a nul-terminated string into the dest buffer, include the
* trailing nul, and return a pointer to the trailing nul byte.
* This is useful for concatenating multiple strings together
* without having to repeatedly scan for the end.
*
* Return value: a pointer to trailing nul byte.
**/
gchar *
g_stpcpy (gchar *dest,
const gchar *src)
{
#ifdef HAVE_STPCPY
g_return_val_if_fail (dest != NULL, NULL);
g_return_val_if_fail (src != NULL, NULL);
return stpcpy (dest, src);
#else
register gchar *d = dest;
register const gchar *s = src;
g_return_val_if_fail (dest != NULL, NULL);
g_return_val_if_fail (src != NULL, NULL);
do
*d++ = *s;
while (*s++ != '\0');
return d - 1;
#endif
}
gchar*
g_strdup_vprintf (const gchar *format,
va_list args1)
@ -156,6 +190,7 @@ g_strconcat (const gchar *string1, ...)
va_list args;
gchar *s;
gchar *concat;
gchar *ptr;
g_return_val_if_fail (string1 != NULL, NULL);
@ -170,9 +205,9 @@ g_strconcat (const gchar *string1, ...)
va_end (args);
concat = g_new (gchar, l);
concat[0] = 0;
ptr = concat;
strcat (concat, string1);
ptr = g_stpcpy (ptr, string1);
va_start (args, string1);
s = va_arg (args, gchar*);
while (s)
@ -1369,6 +1404,7 @@ g_strjoinv (const gchar *separator,
gchar **str_array)
{
gchar *string;
gchar *ptr;
g_return_val_if_fail (str_array != NULL, NULL);
@ -1381,17 +1417,19 @@ g_strjoinv (const gchar *separator,
guint separator_len;
separator_len = strlen (separator);
/* First part, getting length */
len = 1 + strlen (str_array[0]);
for(i = 1; str_array[i] != NULL; i++)
len += separator_len + strlen(str_array[i]);
for (i = 1; str_array[i] != NULL; i++)
len += strlen (str_array[i]);
len += separator_len * (i - 1);
/* Second part, building string */
string = g_new (gchar, len);
*string = 0;
strcat (string, *str_array);
ptr = g_stpcpy (string, *str_array);
for (i = 1; str_array[i] != NULL; i++)
{
strcat (string, separator);
strcat (string, str_array[i]);
ptr = g_stpcpy (ptr, separator);
ptr = g_stpcpy (ptr, str_array[i]);
}
}
else
@ -1408,6 +1446,7 @@ g_strjoin (const gchar *separator,
va_list args;
guint len;
guint separator_len;
gchar *ptr;
if (separator == NULL)
separator = "";
@ -1420,7 +1459,8 @@ g_strjoin (const gchar *separator,
if (s)
{
len = strlen (s);
/* First part, getting length */
len = 1 + strlen (s);
s = va_arg (args, gchar*);
while (s)
@ -1430,19 +1470,19 @@ g_strjoin (const gchar *separator,
}
va_end (args);
string = g_new (gchar, len + 1);
*string = 0;
/* Second part, building string */
string = g_new (gchar, len);
va_start (args, separator);
s = va_arg (args, gchar*);
strcat (string, s);
ptr = g_stpcpy (string, s);
s = va_arg (args, gchar*);
while (s)
{
strcat (string, separator);
strcat (string, s);
ptr = g_stpcpy (ptr, separator);
ptr = g_stpcpy (ptr, s);
s = va_arg (args, gchar*);
}
}

View File

@ -119,6 +119,9 @@ gchar* g_strjoinv (const gchar *separator,
void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array);
gchar* g_stpcpy (gchar *dest,
const char *src);
G_END_DECLS
#endif /* __G_STRFUNCS_H__ */

View File

@ -118,6 +118,40 @@ g_strnfill (guint length,
return str;
}
/**
* g_stpcpy:
* @dest: destination buffer
* @src: source string
*
* Copies a nul-terminated string into the dest buffer, include the
* trailing nul, and return a pointer to the trailing nul byte.
* This is useful for concatenating multiple strings together
* without having to repeatedly scan for the end.
*
* Return value: a pointer to trailing nul byte.
**/
gchar *
g_stpcpy (gchar *dest,
const gchar *src)
{
#ifdef HAVE_STPCPY
g_return_val_if_fail (dest != NULL, NULL);
g_return_val_if_fail (src != NULL, NULL);
return stpcpy (dest, src);
#else
register gchar *d = dest;
register const gchar *s = src;
g_return_val_if_fail (dest != NULL, NULL);
g_return_val_if_fail (src != NULL, NULL);
do
*d++ = *s;
while (*s++ != '\0');
return d - 1;
#endif
}
gchar*
g_strdup_vprintf (const gchar *format,
va_list args1)
@ -156,6 +190,7 @@ g_strconcat (const gchar *string1, ...)
va_list args;
gchar *s;
gchar *concat;
gchar *ptr;
g_return_val_if_fail (string1 != NULL, NULL);
@ -170,9 +205,9 @@ g_strconcat (const gchar *string1, ...)
va_end (args);
concat = g_new (gchar, l);
concat[0] = 0;
ptr = concat;
strcat (concat, string1);
ptr = g_stpcpy (ptr, string1);
va_start (args, string1);
s = va_arg (args, gchar*);
while (s)
@ -1369,6 +1404,7 @@ g_strjoinv (const gchar *separator,
gchar **str_array)
{
gchar *string;
gchar *ptr;
g_return_val_if_fail (str_array != NULL, NULL);
@ -1381,17 +1417,19 @@ g_strjoinv (const gchar *separator,
guint separator_len;
separator_len = strlen (separator);
/* First part, getting length */
len = 1 + strlen (str_array[0]);
for(i = 1; str_array[i] != NULL; i++)
len += separator_len + strlen(str_array[i]);
for (i = 1; str_array[i] != NULL; i++)
len += strlen (str_array[i]);
len += separator_len * (i - 1);
/* Second part, building string */
string = g_new (gchar, len);
*string = 0;
strcat (string, *str_array);
ptr = g_stpcpy (string, *str_array);
for (i = 1; str_array[i] != NULL; i++)
{
strcat (string, separator);
strcat (string, str_array[i]);
ptr = g_stpcpy (ptr, separator);
ptr = g_stpcpy (ptr, str_array[i]);
}
}
else
@ -1408,6 +1446,7 @@ g_strjoin (const gchar *separator,
va_list args;
guint len;
guint separator_len;
gchar *ptr;
if (separator == NULL)
separator = "";
@ -1420,7 +1459,8 @@ g_strjoin (const gchar *separator,
if (s)
{
len = strlen (s);
/* First part, getting length */
len = 1 + strlen (s);
s = va_arg (args, gchar*);
while (s)
@ -1430,19 +1470,19 @@ g_strjoin (const gchar *separator,
}
va_end (args);
string = g_new (gchar, len + 1);
*string = 0;
/* Second part, building string */
string = g_new (gchar, len);
va_start (args, separator);
s = va_arg (args, gchar*);
strcat (string, s);
ptr = g_stpcpy (string, s);
s = va_arg (args, gchar*);
while (s)
{
strcat (string, separator);
strcat (string, s);
ptr = g_stpcpy (ptr, separator);
ptr = g_stpcpy (ptr, s);
s = va_arg (args, gchar*);
}
}

View File

@ -119,6 +119,9 @@ gchar* g_strjoinv (const gchar *separator,
void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array);
gchar* g_stpcpy (gchar *dest,
const char *src);
G_END_DECLS
#endif /* __G_STRFUNCS_H__ */