summaryrefslogtreecommitdiff
path: root/mate-panel
diff options
context:
space:
mode:
authorColomban Wendling <[email protected]>2023-11-15 14:34:16 +0100
committerLuke from DC <[email protected]>2023-11-21 20:19:58 +0000
commit074e5d0136beb84dec62e0a40209c42dab793d87 (patch)
tree5fbe13ffd79886aa5476e5719c1563e5a6d98fec /mate-panel
parentd87c912ce8c09bd64263c6296314b6f17de3ad73 (diff)
downloadmate-panel-074e5d0136beb84dec62e0a40209c42dab793d87.tar.bz2
mate-panel-074e5d0136beb84dec62e0a40209c42dab793d87.tar.xz
Reorder array index limit check
This is *not* an issue, as it's not really a bounds check but a mere limit, and the array is NULL-terminated. However, it looks odd and cppcheck (unsurprisingly) doesn't understand the details well enough and reports this as a misordered bounds check. > mate-panel/panel-run-dialog.c:166:12: style: Array index 'i' is used before limits check. [arrayIndexThenCheck] > items[i] && i < history_max_size; > ^
Diffstat (limited to 'mate-panel')
-rw-r--r--mate-panel/panel-run-dialog.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/mate-panel/panel-run-dialog.c b/mate-panel/panel-run-dialog.c
index 73f1c2db..a469e6ed 100644
--- a/mate-panel/panel-run-dialog.c
+++ b/mate-panel/panel-run-dialog.c
@@ -162,9 +162,7 @@ _panel_run_get_recent_programs_list (PanelRunDialog *dialog)
history_max_size = g_settings_get_uint (dialog->settings, PANEL_RUN_HISTORY_MAX_SIZE_KEY);
history_reverse = g_settings_get_boolean (dialog->settings, PANEL_RUN_HISTORY_REVERSE_KEY);
items = g_settings_get_strv (dialog->settings, PANEL_RUN_HISTORY_KEY);
- for (i = 0;
- items[i] && i < history_max_size;
- i++) {
+ for (i = 0; i < history_max_size && items[i]; i++) {
GtkTreeIter iter;
/* add history in reverse */
if (history_reverse)