[libgnomekbd] Fixed strv comparison function



commit dd12792ee893440aa0bc31f3dc8eb2e8996715f5
Author: Sergey V. Udaltsov <svu gnome org>
Date:   Tue Oct 12 10:54:04 2010 +0100

    Fixed strv comparison function
    
    The initial implementation was just bad

 libgnomekbd/gkbd-keyboard-config.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/libgnomekbd/gkbd-keyboard-config.c b/libgnomekbd/gkbd-keyboard-config.c
index 5c48be9..6ab4885 100644
--- a/libgnomekbd/gkbd-keyboard-config.c
+++ b/libgnomekbd/gkbd-keyboard-config.c
@@ -56,7 +56,12 @@ g_strv_equal (gchar ** l1, gchar ** l2)
 {
 	if (l1 == l2)
 		return TRUE;
-	while (l1 != NULL && l2 != NULL) {
+	if (l1 == NULL)
+		return g_strv_length (l2) == 0;
+	if (l2 == NULL)
+		return g_strv_length (l1) == 0;
+
+	while ((*l1 != NULL) && (*l2 != NULL)) {
 		if (*l1 != *l2) {
 			if (*l1 && *l2) {
 				if (g_ascii_strcasecmp (*l1, *l2))
@@ -68,7 +73,7 @@ g_strv_equal (gchar ** l1, gchar ** l2)
 		l1++;
 		l2++;
 	}
-	return (*l1 && *l2);
+	return (*l1 == NULL) && (*l2 == NULL);
 }
 
 gboolean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]