mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-11 23:16:14 +01:00
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:
parent
7401460a60
commit
519435e642
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
||||||
|
|
||||||
* testglib.c (main): Update the array tests. Reduce the number of
|
* testglib.c (main): Update the array tests. Reduce the number of
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
||||||
|
|
||||||
* testglib.c (main): Update the array tests. Reduce the number of
|
* testglib.c (main): Update the array tests. Reduce the number of
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
||||||
|
|
||||||
* testglib.c (main): Update the array tests. Reduce the number of
|
* testglib.c (main): Update the array tests. Reduce the number of
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
||||||
|
|
||||||
* testglib.c (main): Update the array tests. Reduce the number of
|
* testglib.c (main): Update the array tests. Reduce the number of
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
||||||
|
|
||||||
* testglib.c (main): Update the array tests. Reduce the number of
|
* testglib.c (main): Update the array tests. Reduce the number of
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
||||||
|
|
||||||
* testglib.c (main): Update the array tests. Reduce the number of
|
* testglib.c (main): Update the array tests. Reduce the number of
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
||||||
|
|
||||||
* testglib.c (main): Update the array tests. Reduce the number of
|
* testglib.c (main): Update the array tests. Reduce the number of
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
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.
|
||||||
|
|
||||||
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
Tue Sep 1 23:46:31 1998 Josh MacDonald <jmacd@axis.hip.berkeley.edu>
|
||||||
|
|
||||||
* testglib.c (main): Update the array tests. Reduce the number of
|
* testglib.c (main): Update the array tests. Reduce the number of
|
||||||
|
4
glib.h
4
glib.h
@ -1128,7 +1128,9 @@ gchar* g_strdup_printf (const gchar *format,
|
|||||||
gchar* g_strdup_vprintf (const gchar *format,
|
gchar* g_strdup_vprintf (const gchar *format,
|
||||||
va_list args);
|
va_list args);
|
||||||
gchar* g_strndup (const gchar *str,
|
gchar* g_strndup (const gchar *str,
|
||||||
gulong n);
|
guint n);
|
||||||
|
gchar* g_strnfill (guint length,
|
||||||
|
gchar fill_char);
|
||||||
gchar* g_strconcat (const gchar *string1,
|
gchar* g_strconcat (const gchar *string1,
|
||||||
...); /* NULL terminated */
|
...); /* NULL terminated */
|
||||||
gdouble g_strtod (const gchar *nptr,
|
gdouble g_strtod (const gchar *nptr,
|
||||||
|
@ -1128,7 +1128,9 @@ gchar* g_strdup_printf (const gchar *format,
|
|||||||
gchar* g_strdup_vprintf (const gchar *format,
|
gchar* g_strdup_vprintf (const gchar *format,
|
||||||
va_list args);
|
va_list args);
|
||||||
gchar* g_strndup (const gchar *str,
|
gchar* g_strndup (const gchar *str,
|
||||||
gulong n);
|
guint n);
|
||||||
|
gchar* g_strnfill (guint length,
|
||||||
|
gchar fill_char);
|
||||||
gchar* g_strconcat (const gchar *string1,
|
gchar* g_strconcat (const gchar *string1,
|
||||||
...); /* NULL terminated */
|
...); /* NULL terminated */
|
||||||
gdouble g_strtod (const gchar *nptr,
|
gdouble g_strtod (const gchar *nptr,
|
||||||
|
@ -32,32 +32,51 @@ g_strdup (const gchar *str)
|
|||||||
{
|
{
|
||||||
gchar *new_str;
|
gchar *new_str;
|
||||||
|
|
||||||
new_str = NULL;
|
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
new_str = g_new (char, strlen (str) + 1);
|
new_str = g_new (char, strlen (str) + 1);
|
||||||
strcpy (new_str, str);
|
strcpy (new_str, str);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
new_str = NULL;
|
||||||
|
|
||||||
return new_str;
|
return new_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar*
|
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)
|
if (str)
|
||||||
{
|
{
|
||||||
new_str = g_new (char, n + 1);
|
new_str = g_new (gchar, n + 1);
|
||||||
strncpy (new_str, str, n);
|
strncpy (new_str, str, n);
|
||||||
new_str[n] = '\0';
|
new_str[n] = '\0';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
new_str = NULL;
|
||||||
|
|
||||||
return new_str;
|
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*
|
gchar*
|
||||||
g_strdup_vprintf (const gchar *format,
|
g_strdup_vprintf (const gchar *format,
|
||||||
va_list args1)
|
va_list args1)
|
||||||
|
29
gstrfuncs.c
29
gstrfuncs.c
@ -32,32 +32,51 @@ g_strdup (const gchar *str)
|
|||||||
{
|
{
|
||||||
gchar *new_str;
|
gchar *new_str;
|
||||||
|
|
||||||
new_str = NULL;
|
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
new_str = g_new (char, strlen (str) + 1);
|
new_str = g_new (char, strlen (str) + 1);
|
||||||
strcpy (new_str, str);
|
strcpy (new_str, str);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
new_str = NULL;
|
||||||
|
|
||||||
return new_str;
|
return new_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar*
|
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)
|
if (str)
|
||||||
{
|
{
|
||||||
new_str = g_new (char, n + 1);
|
new_str = g_new (gchar, n + 1);
|
||||||
strncpy (new_str, str, n);
|
strncpy (new_str, str, n);
|
||||||
new_str[n] = '\0';
|
new_str[n] = '\0';
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
new_str = NULL;
|
||||||
|
|
||||||
return new_str;
|
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*
|
gchar*
|
||||||
g_strdup_vprintf (const gchar *format,
|
g_strdup_vprintf (const gchar *format,
|
||||||
va_list args1)
|
va_list args1)
|
||||||
|
Loading…
Reference in New Issue
Block a user