]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - menu/m_new.c
ncurses 5.6 - patch 20081004
[ncurses.git] / menu / m_new.c
index 20490d5f1728e552db313bf1b9a0a4000c6b41c1..c20c6651779058b8b3ce2b6a7b7b49cf10c46ce5 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
 /****************************************************************************
- * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2004,2006 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            *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -37,7 +37,7 @@
 
 #include "menu.priv.h"
 
 
 #include "menu.priv.h"
 
-MODULE_ID("$Id: m_new.c,v 1.16 2004/12/25 21:57:53 tom Exp $")
+MODULE_ID("$Id: m_new.c,v 1.18 2006/11/04 19:04:06 tom Exp $")
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnmenu  
 
 /*---------------------------------------------------------------------------
 |   Facility      :  libnmenu  
@@ -53,6 +53,7 @@ MODULE_ID("$Id: m_new.c,v 1.16 2004/12/25 21:57:53 tom Exp $")
 NCURSES_EXPORT(MENU *)
 new_menu(ITEM ** items)
 {
 NCURSES_EXPORT(MENU *)
 new_menu(ITEM ** items)
 {
+  int err = E_SYSTEM_ERROR;
   MENU *menu = (MENU *) calloc(1, sizeof(MENU));
 
   T((T_CALLED("new_menu(%p)"), items));
   MENU *menu = (MENU *) calloc(1, sizeof(MENU));
 
   T((T_CALLED("new_menu(%p)"), items));
@@ -66,6 +67,7 @@ new_menu(ITEM ** items)
        {
          if (!_nc_Connect_Items(menu, items))
            {
        {
          if (!_nc_Connect_Items(menu, items))
            {
+             err = E_NOT_CONNECTED;
              free(menu);
              menu = (MENU *) 0;
            }
              free(menu);
              menu = (MENU *) 0;
            }
@@ -73,7 +75,7 @@ new_menu(ITEM ** items)
     }
 
   if (!menu)
     }
 
   if (!menu)
-    SET_ERROR(E_SYSTEM_ERROR);
+    SET_ERROR(err);
 
   returnMenu(menu);
 }
 
   returnMenu(menu);
 }