diff options
author | Daniel Boles <dboles.src@gmail.com> | 2017-10-04 22:58:48 +0100 |
---|---|---|
committer | Daniel Boles <dboles.src@gmail.com> | 2017-10-04 22:59:11 +0100 |
commit | 88b15beb0a3c67544984099694619653545fba8a (patch) | |
tree | e281cc61067ab5e6c736aee03f5dd13910e4f72b /gtk/updateiconcache.c | |
parent | e4754a007b70a9a69cdd468c6ad4b9e560d6fa83 (diff) | |
download | gtk+-88b15beb0a3c67544984099694619653545fba8a.tar.gz |
updateiconcache: Avoid confusing loop construct
n_attach_points is the result of g_strv_length(): the index at which the
string vector ends in NULL. So by definition, when i == n_attach_points,
string[i] == NULL, and there is no need to check for the latter. The
fact that we did appears to confuse static analysers, as the dereference
and index check were inverted from what would normally be safe. We could
reverse them, but we may as well just remove the unnecessary NULL check.
https://bugzilla.gnome.org/show_bug.cgi?id=788458
Diffstat (limited to 'gtk/updateiconcache.c')
-rw-r--r-- | gtk/updateiconcache.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/gtk/updateiconcache.c b/gtk/updateiconcache.c index 1bcbbe2271..fe2eb8fc64 100644 --- a/gtk/updateiconcache.c +++ b/gtk/updateiconcache.c @@ -283,8 +283,7 @@ load_icon_data (const char *path) data->n_attach_points = g_strv_length (split); data->attach_points = g_new (int, 2 * data->n_attach_points); - i = 0; - while (split[i] != NULL && i < data->n_attach_points) + for (i = 0; i < data->n_attach_points; ++i) { split_point = strchr (split[i], ','); if (split_point) @@ -294,7 +293,6 @@ load_icon_data (const char *path) data->attach_points[2 * i] = atoi (split[i]); data->attach_points[2 * i + 1] = atoi (split_point); } - i++; } g_strfreev (split); |