summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2007-07-30 18:14:03 +0000
committerBrian Cameron <bcameron@src.gnome.org>2007-07-30 18:14:03 +0000
commitae14dc68a151eb1e48f640302f3cbbaf2990dabd (patch)
treebf8a4ca8b23778ab838e7773986cc03d97166658
parentae412aef849f2a0aae744c752f8c807b8fcc1732 (diff)
downloadgdm-ae14dc68a151eb1e48f640302f3cbbaf2990dabd.tar.gz
Now use g_strv_length to calculate the array size. Use an assert to check
2007-07-30 Brian Cameron <brian.cameron@sun.com> * common/gdm-common.c: Now use g_strv_length to calculate the array size. * gui/gdmsetup.c: Use an assert to check that the array is not NULL before the loop rather than in the loop. svn path=/trunk/; revision=5095
-rw-r--r--ChangeLog7
-rw-r--r--common/gdm-common.c14
-rw-r--r--gui/gdmsetup.c3
3 files changed, 17 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 5df5a2d4..6a9debae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2007-07-30 Brian Cameron <brian.cameron@sun.com>
+ * common/gdm-common.c: Now use g_strv_length to calculate the
+ array size.
+ * gui/gdmsetup.c: Use an assert to check that the array is not
+ NULL before the loop rather than in the loop.
+
+2007-07-30 Brian Cameron <brian.cameron@sun.com>
+
* daemon/slave.c: Rename login to login_user to avoid problem
on FreeBSD with symbol conflict since their utmp code needs
to call a function called login. Partially fixes #456697.
diff --git a/common/gdm-common.c b/common/gdm-common.c
index 0032ef5d..ab4c94f1 100644
--- a/common/gdm-common.c
+++ b/common/gdm-common.c
@@ -292,11 +292,13 @@ ve_locale_exists (const char *loc)
int
gdm_vector_len (char * const *v)
{
- int i;
- if (v == NULL)
- return 0;
- for (i = 0; v[i] != NULL; i++)
- ;
- return i;
+ int i;
+
+ if (v == NULL)
+ return 0;
+
+ i = g_strv_length (v);
+
+ return i;
}
diff --git a/gui/gdmsetup.c b/gui/gdmsetup.c
index 7922dbc1..46fbf206 100644
--- a/gui/gdmsetup.c
+++ b/gui/gdmsetup.c
@@ -4203,7 +4203,8 @@ strings_list_remove (char *strings_list, const char *string, const char *sep)
msg = g_string_new ("");
actions = g_strsplit (strings_list, sep, -1);
- for (i = 0; actions != NULL && actions[i] != NULL; i++) {
+ g_assert (actions != NULL);
+ for (i = 0; actions[i] != NULL; i++) {
if (strncmp (actions[i], string, strlen (string)) == 0)
continue;
g_string_append_printf (msg, "%s%s", separator, actions[i]);