]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/key_defined.c
ncurses 6.5 - patch 20240504
[ncurses.git] / ncurses / base / key_defined.c
index ef987a5484d561bc87647b80852bfb710b1347de..147e5fe2db93c9bac85c0acdaa637c5eb2830e50 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 2003-2006,2009 Free Software Foundation, Inc.              *
+ * Copyright 2020,2023 Thomas E. Dickey                                     *
+ * Copyright 2003-2006,2009 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,8 +32,9 @@
  ****************************************************************************/
 
 #include <curses.priv.h>
+#include <tic.h>
 
-MODULE_ID("$Id: key_defined.c,v 1.9 2009/10/24 22:15:47 tom Exp $")
+MODULE_ID("$Id: key_defined.c,v 1.11 2023/06/24 15:36:32 tom Exp $")
 
 static int
 find_definition(TRIES * tree, const char *str)
@@ -40,7 +42,7 @@ find_definition(TRIES * tree, const char *str)
     TRIES *ptr;
     int result = OK;
 
-    if (str != 0 && *str != '\0') {
+    if (VALID_STRING(str) && *str != '\0') {
        for (ptr = tree; ptr != 0; ptr = ptr->sibling) {
            if (UChar(*str) == UChar(ptr->ch)) {
                if (str[1] == '\0' && ptr->child != 0) {