Blob Blame History Raw
From dd12792ee893440aa0bc31f3dc8eb2e8996715f5 Mon Sep 17 00:00:00 2001
From: Sergey V. Udaltsov <svu@gnome.org>
Date: Tue, 12 Oct 2010 09:54:04 +0000
Subject: Fixed strv comparison function

The initial implementation was just bad
---
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
--
cgit v0.8.3.1