- Subject: [slang-devel] [PATCH 1/2] src/slkeymap.c: Removed unnecessary check in find_the_key() to avoid compiler warning
 
- From: Miroslav Lichvar <mlichvar@xxxxxxxxxx>
 
- Date: Wed,  6 Nov 2024 14:50:06 +0100
 
str is an array in the SLang_Key_Type struct. It cannot be NULL. Remove
the check for NULL to fix the following compiler warning:
slang/src/slkeymap.c:338:40: warning: the comparison will always evaluate as ‘true’ for the address
 of ‘str’ will never be NULL [-Waddress]
  338 |         if ((key != NULL) && (key->str != NULL))
      |                                        ^~
In file included from slang/src/slkeymap.c:29:
slang/src/slang.h:1531:18: note: ‘str’ declared here
 1531 |    unsigned char str[SLANG_MAX_KEYMAP_KEY_SEQ + 1];/* key sequence */
      |                  ^~~
---
 src/slkeymap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/slkeymap.c b/src/slkeymap.c
index ab9f391..0a2de96 100644
--- a/src/slkeymap.c
+++ b/src/slkeymap.c
@@ -335,7 +335,7 @@ static int find_the_key (SLFUTURE_CONST char *s, SLkeymap_Type *kml, SLang_Key_T
 	last = key;
 	key = key->next;
 
-	if ((key != NULL) && (key->str != NULL))
+	if (key != NULL)
 	  {
 	     len = key_len = key->str[0];
 	     if (len > str_len) len = str_len;
-- 
2.47.0
_______________________________________________
For list information, visit <http://jedsoft.org/slang/mailinglists.html>.
  [2024 date index]
  [2024 thread index]
  
  [Thread Prev] [Thread Next]
      
  [Date Prev] [Date Next]