Warn if p == NULL && max != 0. (#110087)
authorMatthias Clasen <maclas@gmx.de>
Sun, 6 Apr 2003 22:16:59 +0000 (22:16 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 6 Apr 2003 22:16:59 +0000 (22:16 +0000)
2003-04-07  Matthias Clasen  <maclas@gmx.de>

* glib/gutf8.c (g_utf8_strlen): Warn if p == NULL && max != 0.
(#110087)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
glib/gutf8.c

index fbb6f35..ef65669 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-04-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gutf8.c (g_utf8_strlen): Warn if p == NULL && max != 0.
+       (#110087) 
+
 2003-04-01  Tor Lillqvist  <tml@iki.fi>
 
        * glib/glib.def: Add g_string_chunk_insert_len.
index fbb6f35..ef65669 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gutf8.c (g_utf8_strlen): Warn if p == NULL && max != 0.
+       (#110087) 
+
 2003-04-01  Tor Lillqvist  <tml@iki.fi>
 
        * glib/glib.def: Add g_string_chunk_insert_len.
index fbb6f35..ef65669 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gutf8.c (g_utf8_strlen): Warn if p == NULL && max != 0.
+       (#110087) 
+
 2003-04-01  Tor Lillqvist  <tml@iki.fi>
 
        * glib/glib.def: Add g_string_chunk_insert_len.
index fbb6f35..ef65669 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gutf8.c (g_utf8_strlen): Warn if p == NULL && max != 0.
+       (#110087) 
+
 2003-04-01  Tor Lillqvist  <tml@iki.fi>
 
        * glib/glib.def: Add g_string_chunk_insert_len.
index fbb6f35..ef65669 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gutf8.c (g_utf8_strlen): Warn if p == NULL && max != 0.
+       (#110087) 
+
 2003-04-01  Tor Lillqvist  <tml@iki.fi>
 
        * glib/glib.def: Add g_string_chunk_insert_len.
index fbb6f35..ef65669 100644 (file)
@@ -1,3 +1,8 @@
+2003-04-07  Matthias Clasen  <maclas@gmx.de>
+
+       * glib/gutf8.c (g_utf8_strlen): Warn if p == NULL && max != 0.
+       (#110087) 
+
 2003-04-01  Tor Lillqvist  <tml@iki.fi>
 
        * glib/glib.def: Add g_string_chunk_insert_len.
index 9371bf1..07b9a96 100644 (file)
@@ -202,7 +202,8 @@ g_utf8_prev_char (const gchar *p)
  * @p: pointer to the start of a UTF-8 encoded string.
  * @max: the maximum number of bytes to examine. If @max
  *       is less than 0, then the string is assumed to be
- *       nul-terminated.
+ *       nul-terminated. If @max is 0, @p will not be examined and 
+ *       may be %NULL.
  * 
  * Returns the length of the string in characters.
  *
@@ -214,6 +215,7 @@ g_utf8_strlen (const gchar *p,
 {
   glong len = 0;
   const gchar *start = p;
+  g_return_val_if_fail (p != NULL || max == 0, 0);
 
   if (max < 0)
     {