]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - menu/m_req_name.c
ncurses 6.2 - patch 20210522
[ncurses.git] / menu / m_req_name.c
index d3f04c1d35a278558eb6fe50216973461e44a9d7..3bc0995624174eac2a0b4c21283d6ac970f81b11 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright 2020 Thomas E. Dickey                                          *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
  * Copyright 1998-2012,2015 Free Software Foundation, Inc.                  *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
@@ -38,7 +38,7 @@
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_req_name.c,v 1.24 2020/02/02 23:34:34 tom Exp $")
+MODULE_ID("$Id: m_req_name.c,v 1.26 2021/03/27 23:46:29 tom Exp $")
 
 #define DATA(s) { s }
 
@@ -74,7 +74,7 @@ static const char request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1][14] =
 |   Return Values :  Pointer to name      - on success
 |                    NULL                 - on invalid request code
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
+MENU_EXPORT(const char *)
 menu_request_name(int request)
 {
   T((T_CALLED("menu_request_name(%d)"), request));
@@ -96,19 +96,20 @@ menu_request_name(int request)
 |   Return Values :  Request Id       - on success
 |                    E_NO_MATCH       - request not found
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
+MENU_EXPORT(int)
 menu_request_by_name(const char *str)
 {
   /* because the table is so small, it doesn't really hurt
      to run sequentially through it.
    */
   size_t i = 0;
-  char buf[16];
 
   T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str)));
 
   if (str != 0 && (i = strlen(str)) != 0)
     {
+      char buf[16];
+
       if (i > sizeof(buf) - 2)
        i = sizeof(buf) - 2;
       memcpy(buf, str, i);