From 9648189ae6d063d17f4dce22c9f2a26fe1c1409c Mon Sep 17 00:00:00 2001 From: Chris Toshok Date: Fri, 18 Jun 2010 18:43:31 +0000 Subject: [PATCH] 2010-06-18 Chris Toshok patch from Jacob Berkman: * src/glib.h (g_mkdir): #define to mkdir (g_ascii_strtoull): #define to strtoull * src/gmodule.h: add G_BEGIN/END_DECLS * src/gstr.c (g_strdupv): new function. svn path=/trunk/mono/; revision=159147 --- eglib/ChangeLog | 11 +++++++++++ eglib/src/glib.h | 3 +++ eglib/src/gmodule.h | 4 ++++ eglib/src/gstr.c | 15 +++++++++++++++ 4 files changed, 33 insertions(+) diff --git a/eglib/ChangeLog b/eglib/ChangeLog index e6d58471961..feed24ea764 100644 --- a/eglib/ChangeLog +++ b/eglib/ChangeLog @@ -1,3 +1,14 @@ +2010-06-18 Chris Toshok + + patch from Jacob Berkman: + + * src/glib.h (g_mkdir): #define to mkdir + (g_ascii_strtoull): #define to strtoull + + * src/gmodule.h: add G_BEGIN/END_DECLS + + * src/gstr.c (g_strdupv): new function. + 2010-06-18 Rolf Bjarne Kvinge * src/eglib-remap.h: Remap g_ptr_array_remove_fast too. diff --git a/eglib/src/glib.h b/eglib/src/glib.h index 9ce0e9264a8..6b70c78cbcf 100644 --- a/eglib/src/glib.h +++ b/eglib/src/glib.h @@ -137,6 +137,7 @@ static inline gpointer g_malloc0 (gsize x) {if (x) return calloc(1,x); else retu gpointer g_memdup (gconstpointer mem, guint byte_size); static inline gchar *g_strdup (const gchar *str) { if (str) {return strdup (str);} return NULL; } +gchar **g_strdupv (gchar **str_array); typedef struct { gpointer (*malloc) (gsize n_bytes); @@ -289,6 +290,7 @@ gint g_ascii_xdigit_value (gchar c); #else #define g_strcasecmp strcasecmp #define g_ascii_strcasecmp strcasecmp +#define g_ascii_strtoull strtoull #define g_strncasecmp strncasecmp #define g_strstrip(a) g_strchug (g_strchomp (a)) #endif @@ -768,6 +770,7 @@ GDir *g_dir_open (const gchar *path, guint flags, GError **error); const gchar *g_dir_read_name (GDir *dir); void g_dir_rewind (GDir *dir); void g_dir_close (GDir *dir); +#define g_mkdir mkdir /* * GMarkup diff --git a/eglib/src/gmodule.h b/eglib/src/gmodule.h index ae52dcfdd7a..ee89683f510 100644 --- a/eglib/src/gmodule.h +++ b/eglib/src/gmodule.h @@ -10,6 +10,8 @@ #define G_MODULE_EXPORT #endif +G_BEGIN_DECLS + /* * Modules */ @@ -30,4 +32,6 @@ gchar * g_module_build_path (const gchar *directory, const gchar *module_name); extern char *gmodule_libprefix; extern char *gmodule_libsuffix; +G_END_DECLS + #endif diff --git a/eglib/src/gstr.c b/eglib/src/gstr.c index 305f9480e26..424abf8d113 100644 --- a/eglib/src/gstr.c +++ b/eglib/src/gstr.c @@ -63,6 +63,21 @@ g_strfreev (gchar **str_array) g_free (orig); } +gchar ** +g_strdupv (gchar **str_array) +{ + guint length; + gchar **ret; + guint i; + length = g_strv_length(str_array); + ret = g_new0(gchar *, length + 1); + for (i = 0; str_array[i]; i++) { + ret[i] = g_strdup(str_array[i]); + } + ret[length] = NULL; + return ret; +} + guint g_strv_length(gchar **str_array) { -- 2.25.1