new function g_strnfill() to return a new string of specified length,

Wed Aug 26 06:32:40 1998  Tim Janik  <timj@gtk.org>

        * glib.h:
        * gstrfuncs.c: new function g_strnfill() to return a new string
        of specified length, filled with a specific character.
This commit is contained in:
Tim Janik
1998-09-02 14:57:10 +00:00
committed by Tim Janik
parent 7401460a60
commit 519435e642
12 changed files with 102 additions and 12 deletions

View File

@@ -32,32 +32,51 @@ g_strdup (const gchar *str)
{
gchar *new_str;
new_str = NULL;
if (str)
{
new_str = g_new (char, strlen (str) + 1);
strcpy (new_str, str);
}
else
new_str = NULL;
return new_str;
}
gchar*
g_strndup (const gchar *str, gulong n)
g_strndup (const gchar *str,
guint n)
{
char *new_str;
gchar *new_str;
new_str = NULL;
if (str)
{
new_str = g_new (char, n + 1);
new_str = g_new (gchar, n + 1);
strncpy (new_str, str, n);
new_str[n] = '\0';
}
else
new_str = NULL;
return new_str;
}
gchar*
g_strnfill (guint length,
gchar fill_char)
{
register gchar *str, *s, *end;
str = g_new (gchar, length + 1);
s = str;
end = str + length;
while (s < end)
*(s++) = fill_char;
*s = 0;
return str;
}
gchar*
g_strdup_vprintf (const gchar *format,
va_list args1)