mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-29 17:06:15 +01:00
Cleanups after we dropped mem vtables
Since g_malloc is now always malloc, we can just use strdup and strndup directly.
This commit is contained in:
parent
97a25d1203
commit
627854fee1
@ -354,19 +354,10 @@ get_C_locale (void)
|
|||||||
gchar*
|
gchar*
|
||||||
g_strdup (const gchar *str)
|
g_strdup (const gchar *str)
|
||||||
{
|
{
|
||||||
gchar *new_str;
|
|
||||||
gsize length;
|
|
||||||
|
|
||||||
if (str)
|
if (str)
|
||||||
{
|
return strdup (str);
|
||||||
length = strlen (str) + 1;
|
|
||||||
new_str = g_new (char, length);
|
|
||||||
memcpy (new_str, str, length);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
new_str = NULL;
|
return NULL;
|
||||||
|
|
||||||
return new_str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -418,18 +409,10 @@ gchar*
|
|||||||
g_strndup (const gchar *str,
|
g_strndup (const gchar *str,
|
||||||
gsize n)
|
gsize n)
|
||||||
{
|
{
|
||||||
gchar *new_str;
|
|
||||||
|
|
||||||
if (str)
|
if (str)
|
||||||
{
|
return strndup (str, n);
|
||||||
new_str = g_new (gchar, n + 1);
|
|
||||||
strncpy (new_str, str, n);
|
|
||||||
new_str[n] = '\0';
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
new_str = NULL;
|
return NULL;
|
||||||
|
|
||||||
return new_str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user