]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - menu/m_item_new.c
ncurses 6.2 - patch 20210213
[ncurses.git] / menu / m_item_new.c
index 7f5daa9d89dc675be3a9b558bfb705b86fe4da7b..4e3f67bacdd0580de188fc5243509ecae3211380 100644 (file)
@@ -1,5 +1,6 @@
 /****************************************************************************
- * Copyright (c) 1998-2010,2012 Free Software Foundation, Inc.              *
+ * Copyright 2020,2021 Thomas E. Dickey                                     *
+ * Copyright 1998-2010,2012 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            *
@@ -44,7 +45,7 @@
 #endif
 #endif
 
-MODULE_ID("$Id: m_item_new.c,v 1.32 2012/03/10 23:41:36 tom Exp $")
+MODULE_ID("$Id: m_item_new.c,v 1.37 2021/02/13 19:40:51 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnmenu  
@@ -74,7 +75,7 @@ Is_Printable_String(const char *s)
 
       mbstowcs(temp, s, (unsigned)count);
       for (n = 0; n < count; ++n)
-       if (!iswprint((wint_t) temp[n]))
+       if (!iswprint((wint_t)temp[n]))
          {
            result = FALSE;
            break;
@@ -106,7 +107,7 @@ Is_Printable_String(const char *s)
 |
 |   Return Values :  The item pointer or NULL if creation failed.
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(ITEM *)
+MENU_EXPORT(ITEM *)
 new_item(const char *name, const char *description)
 {
   ITEM *item;
@@ -117,14 +118,16 @@ new_item(const char *name, const char *description)
 
   if (!name || (*name == '\0') || !Is_Printable_String(name))
     {
-      item = (ITEM *) 0;
+      item = (ITEM *)0;
       SET_ERROR(E_BAD_ARGUMENT);
     }
   else
     {
       item = typeCalloc(ITEM, 1);
+
       if (item)
        {
+         T((T_CREATE("item %p"), (void *)item));
          *item = _nc_Default_Item;     /* hope we have struct assignment */
 
          item->name.length = (unsigned short)strlen(name);
@@ -159,8 +162,8 @@ new_item(const char *name, const char *description)
 |                    E_BAD_ARGUMENT    - invalid value has been passed
 |                    E_CONNECTED       - item is still connected to a menu    
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
-free_item(ITEM * item)
+MENU_EXPORT(int)
+free_item(ITEM *item)
 {
   T((T_CALLED("free_item(%p)"), (void *)item));
 
@@ -192,8 +195,8 @@ free_item(ITEM * item)
 |                    E_BAD_ARGUMENT     - an invalid value has been passed
 |                    E_SYSTEM_ERROR     - no memory to store mark
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(int)
-set_menu_mark(MENU * menu, const char *mark)
+MENU_EXPORT(int)
+set_menu_mark(MENU *menu, const char *mark)
 {
   short l;
 
@@ -223,7 +226,7 @@ set_menu_mark(MENU * menu, const char *mark)
          if (menu->mark)
            {
              if (menu != &_nc_Default_Menu)
-               menu->status |= _MARK_ALLOCATED;
+               SetStatus(menu, _MARK_ALLOCATED);
            }
          else
            {
@@ -264,8 +267,8 @@ set_menu_mark(MENU * menu, const char *mark)
 |
 |   Return Values :  The marker string pointer or NULL if no marker defined
 +--------------------------------------------------------------------------*/
-NCURSES_EXPORT(const char *)
-menu_mark(const MENU * menu)
+MENU_EXPORT(const char *)
+menu_mark(const MENU *menu)
 {
   T((T_CALLED("menu_mark(%p)"), (const void *)menu));
   returnPtr(Normalize_Menu(menu)->mark);