[glib] Cleanups after we dropped mem vtables
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Cleanups after we dropped mem vtables
- Date: Sat, 12 Sep 2015 15:14:13 +0000 (UTC)
commit 627854fee1fde93e01f27655b00a9082348ee15f
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Sep 11 18:08:33 2015 -0400
Cleanups after we dropped mem vtables
Since g_malloc is now always malloc, we can just use
strdup and strndup directly.
glib/gstrfuncs.c | 25 ++++---------------------
1 files changed, 4 insertions(+), 21 deletions(-)
---
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index dde6126..a251631 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -354,19 +354,10 @@ get_C_locale (void)
gchar*
g_strdup (const gchar *str)
{
- gchar *new_str;
- gsize length;
-
if (str)
- {
- length = strlen (str) + 1;
- new_str = g_new (char, length);
- memcpy (new_str, str, length);
- }
+ return strdup (str);
else
- new_str = NULL;
-
- return new_str;
+ return NULL;
}
/**
@@ -418,18 +409,10 @@ gchar*
g_strndup (const gchar *str,
gsize n)
{
- gchar *new_str;
-
if (str)
- {
- new_str = g_new (gchar, n + 1);
- strncpy (new_str, str, n);
- new_str[n] = '\0';
- }
+ return strndup (str, n);
else
- new_str = NULL;
-
- return new_str;
+ return NULL;
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]