From 7abfadd7e6b6ee7bb2c767d4188ad98f28d71181 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Thu, 10 Sep 2015 13:06:39 +0200 Subject: [PATCH] Attempt to work around slightly bogus Coverity warnings. Signed-off-by: Joachim Nilsson --- src/editline.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/editline.c b/src/editline.c index 890b5aa..e9e1e67 100644 --- a/src/editline.c +++ b/src/editline.c @@ -1701,7 +1701,7 @@ static el_status_t el_bind_key_in_map(int key, el_keymap_func_t function, el_key /* Must check that pos is not the next to last array position, * otherwise we will write out-of-bounds to terminate the list. */ - if (pos >= mapsz - 1) { + if (pos + 1 >= mapsz) { errno = ENOMEM; return CSeof; } @@ -1710,8 +1710,8 @@ static el_status_t el_bind_key_in_map(int key, el_keymap_func_t function, el_key creat = map[pos].Function == NULL; /* A new key so have to add it to end */ - map[pos].Key = key; - map[pos].Function = function; + map[pos].Key = key; + map[pos].Function = function; /* Terminate list */ if (creat) {