+Thu Sep 9 00:10:40 2004 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gstrfuncs.h:
+ * glib/gstrfuncs.c (g_strv_length): Add a function to
+ calculate the length of a NULL-terminated string
+ array. (#150455, Tim-Philipp Müller)
+
+ * tests/strfunc-test.c (main): Add a test for g_strv_length().
+
2004-09-08 Tor Lillqvist <tml@iki.fi>
* glib/gutils.c (guess_category_value): On Win32, as last resort
+Thu Sep 9 00:10:40 2004 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gstrfuncs.h:
+ * glib/gstrfuncs.c (g_strv_length): Add a function to
+ calculate the length of a NULL-terminated string
+ array. (#150455, Tim-Philipp Müller)
+
+ * tests/strfunc-test.c (main): Add a test for g_strv_length().
+
2004-09-08 Tor Lillqvist <tml@iki.fi>
* glib/gutils.c (guess_category_value): On Win32, as last resort
+Thu Sep 9 00:10:40 2004 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gstrfuncs.h:
+ * glib/gstrfuncs.c (g_strv_length): Add a function to
+ calculate the length of a NULL-terminated string
+ array. (#150455, Tim-Philipp Müller)
+
+ * tests/strfunc-test.c (main): Add a test for g_strv_length().
+
2004-09-08 Tor Lillqvist <tml@iki.fi>
* glib/gutils.c (guess_category_value): On Win32, as last resort
+Thu Sep 9 00:10:40 2004 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gstrfuncs.h:
+ * glib/gstrfuncs.c (g_strv_length): Add a function to
+ calculate the length of a NULL-terminated string
+ array. (#150455, Tim-Philipp Müller)
+
+ * tests/strfunc-test.c (main): Add a test for g_strv_length().
+
2004-09-08 Tor Lillqvist <tml@iki.fi>
* glib/gutils.c (guess_category_value): On Win32, as last resort
+Thu Sep 9 00:10:40 2004 Matthias Clasen <maclas@gmx.de>
+
+ * glib/gstrfuncs.h:
+ * glib/gstrfuncs.c (g_strv_length): Add a function to
+ calculate the length of a NULL-terminated string
+ array. (#150455, Tim-Philipp Müller)
+
+ * tests/strfunc-test.c (main): Add a test for g_strv_length().
+
2004-09-08 Tor Lillqvist <tml@iki.fi>
* glib/gutils.c (guess_category_value): On Win32, as last resort
+Thu Sep 9 00:11:19 2004 Matthias Clasen <maclas@gmx.de>
+
+ * glib/glib-sections.txt: Add g_strv_length().
+
2004-09-07 Matthias Clasen <mclasen@redhat.com>
* glib/glib-sections.txt: Add g_get_language_names().
g_strconcat
g_strjoin
g_strjoinv
+g_strv_length
<SUBSECTION>
g_strerror
return msgval;
}
+
+
+/**
+ * g_strv_length:
+ * @str_array: a %NULL-terminated array of strings.
+ *
+ * Returns the length of the given %NULL-terminated
+ * string array @str_array.
+ *
+ * Return value: length of @str_array.
+ *
+ * Since: 2.6
+ **/
+guint
+g_strv_length (gchar **str_array)
+{
+ guint i = 0;
+
+ g_return_val_if_fail (str_array != NULL, 0);
+
+ while (str_array[i])
+ ++i;
+
+ return i;
+}
* optional separator, the returned string is newly allocated.
* g_strfreev() frees the array itself and all of its strings.
* g_strdupv() copies a NULL-terminated array of strings
+ * g_strv_length() returns the length of a NULL-terminated array of strings
*/
gchar** g_strsplit (const gchar *string,
const gchar *delimiter,
gchar **str_array);
void g_strfreev (gchar **str_array);
gchar** g_strdupv (gchar **str_array);
+guint g_strv_length (gchar **str_array);
gchar* g_stpcpy (gchar *dest,
const char *src);
TEST (NULL, 9 == g_snprintf (buf, 5, "%s", "abcdefghi"));
}
+ TEST (NULL, g_strv_length (g_strsplit ("1,2,3,4", ",", -1)) == 4);
+
return any_failed;
}