Make passing NULL for new_prefix work as documented. (#338845, Yevgen
authorMatthias Clasen <mclasen@redhat.com>
Tue, 18 Apr 2006 02:21:43 +0000 (02:21 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Tue, 18 Apr 2006 02:21:43 +0000 (02:21 +0000)
2006-04-17  Matthias Clasen  <mclasen@redhat.com>

* glib/gcompletion.c (g_completion_complete_utf8): Make passing
NULL for new_prefix work as documented.  (#338845, Yevgen Muntyan)

* tests/completion-test.c: Test that passing NULL for
new_prefix in g_completion_complete_utf8 works.

ChangeLog
ChangeLog.pre-2-12
glib/gcompletion.c
tests/completion-test.c

index 7bf5b51..ec3256f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-04-17  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gcompletion.c (g_completion_complete_utf8): Make passing
+       NULL for new_prefix work as documented.  (#338845, Yevgen Muntyan)
+
+       * tests/completion-test.c: Test that passing NULL for 
+       new_prefix in g_completion_complete_utf8 works.
+
 2006-04-17  Kjartan Maraas  <kmaraas@gnome.org>
 
        * configure.in: Remove obsolete entry for no_NO.
index 7bf5b51..ec3256f 100644 (file)
@@ -1,3 +1,11 @@
+2006-04-17  Matthias Clasen  <mclasen@redhat.com>
+
+       * glib/gcompletion.c (g_completion_complete_utf8): Make passing
+       NULL for new_prefix work as documented.  (#338845, Yevgen Muntyan)
+
+       * tests/completion-test.c: Test that passing NULL for 
+       new_prefix in g_completion_complete_utf8 works.
+
 2006-04-17  Kjartan Maraas  <kmaraas@gnome.org>
 
        * configure.in: Remove obsolete entry for no_NO.
index ac24979..5d26078 100644 (file)
@@ -194,7 +194,7 @@ g_completion_complete_utf8 (GCompletion  *cmp,
 
   list = g_completion_complete (cmp, prefix, new_prefix);
 
-  if (*new_prefix)
+  if (new_prefix && *new_prefix)
     {
       p = *new_prefix + strlen (*new_prefix);
       q = g_utf8_find_prev_char (*new_prefix, p);
index 88d2986..bece9c3 100644 (file)
@@ -44,20 +44,30 @@ int main (int argc, char *argv[])
 
   items = g_completion_complete (cmp, "a", &prefix);
   g_assert (!strcmp ("a\302", prefix));
+  g_assert (g_list_length (items) == 2);
   g_free (prefix);
   
   items = g_completion_complete_utf8 (cmp, "a", &prefix);
   g_assert (!strcmp ("a", prefix));
+  g_assert (g_list_length (items) == 2);
   g_free (prefix);
 
   items = g_completion_complete (cmp, "b", &prefix);
   g_assert (!strcmp ("b", prefix));
+  g_assert (g_list_length (items) == 2);
   g_free (prefix);
   
   items = g_completion_complete_utf8 (cmp, "b", &prefix);
   g_assert (!strcmp ("b", prefix));
+  g_assert (g_list_length (items) == 2);
   g_free (prefix);
 
+  items = g_completion_complete (cmp, "a", NULL);
+  g_assert (g_list_length (items) == 2);
+
+  items = g_completion_complete_utf8 (cmp, "a", NULL);
+  g_assert (g_list_length (items) == 2);
+
   g_completion_free (cmp);
 
   return 0;