added g_strndup

-Yosh
This commit is contained in:
Manish Singh 1998-08-19 01:24:13 +00:00
parent e1f0fb0c1e
commit 47074edbbd
12 changed files with 76 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
* gstrfuncs.c: added g_strndup
Tue Aug 18 04:40:17 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,8 @@
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
* gstrfuncs.c: added g_strndup
Tue Aug 18 04:40:17 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,8 @@
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
* gstrfuncs.c: added g_strndup
Tue Aug 18 04:40:17 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,8 @@
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
* gstrfuncs.c: added g_strndup
Tue Aug 18 04:40:17 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,8 @@
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
* gstrfuncs.c: added g_strndup
Tue Aug 18 04:40:17 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,8 @@
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
* gstrfuncs.c: added g_strndup
Tue Aug 18 04:40:17 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,8 @@
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
* gstrfuncs.c: added g_strndup
Tue Aug 18 04:40:17 1998 Tim Janik <timj@gtk.org>
* glib.h:

View File

@ -1,3 +1,8 @@
Tue Aug 18 18:23:09 PDT 1998 Manish Singh <yosh@gimp.org>
* glib.h
* gstrfuncs.c: added g_strndup
Tue Aug 18 04:40:17 1998 Tim Janik <timj@gtk.org>
* glib.h:

2
glib.h
View File

@ -1106,6 +1106,8 @@ void g_strdelimit (gchar *string,
const gchar *delimiters,
gchar new_delimiter);
gchar* g_strdup (const gchar *str);
gchar* g_strndup (const gchar *str,
gulong n);
gchar* g_strconcat (const gchar *string1,
...); /* NULL terminated */
gdouble g_strtod (const gchar *nptr,

View File

@ -1106,6 +1106,8 @@ void g_strdelimit (gchar *string,
const gchar *delimiters,
gchar new_delimiter);
gchar* g_strdup (const gchar *str);
gchar* g_strndup (const gchar *str,
gulong n);
gchar* g_strconcat (const gchar *string1,
...); /* NULL terminated */
gdouble g_strtod (const gchar *nptr,

View File

@ -42,6 +42,22 @@ g_strdup (const gchar *str)
return new_str;
}
gchar*
g_strndup (const gchar *str, gulong n)
{
char *new_str;
new_str = NULL;
if (str)
{
new_str = g_new (char, n + 1);
strncpy (new_str, str, n);
new_str[n] = '\0';
}
return new_str;
}
gchar*
g_strconcat (const gchar *string1, ...)
{

View File

@ -42,6 +42,22 @@ g_strdup (const gchar *str)
return new_str;
}
gchar*
g_strndup (const gchar *str, gulong n)
{
char *new_str;
new_str = NULL;
if (str)
{
new_str = g_new (char, n + 1);
strncpy (new_str, str, n);
new_str[n] = '\0';
}
return new_str;
}
gchar*
g_strconcat (const gchar *string1, ...)
{