home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / MNDLITMS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-31  |  979 b   |  47 lines

  1. /**
  2. *
  3. * Name        MNDLITMS -- Free memory used by all items in
  4. *                item list.
  5. *
  6. * Synopsis    mndlitms (pmenu);
  7. *
  8. *        BMENU *pmenu    Pointer to BMENU structure to
  9. *                discard item list from.
  10. *
  11. * Description    This function completely discards a Blaise C TOOLS
  12. *        menu item list structure.
  13. *
  14. * Returns    *pmenu->pitems      NIL.
  15. *
  16. * Version    6.00 (C)Copyright Blaise Computing Inc.  1987,1989
  17. *
  18. **/
  19.  
  20. #include <stdlib.h>
  21.  
  22. #include <bmenu.h>
  23.  
  24. int mndlitms (pmenu)
  25. BMENU *pmenu;
  26. {
  27.     BITEM *pitem, *qitem;
  28.  
  29.         /* Free memory used by item list.            */
  30.     for (pitem = pmenu->pitems;  pitem != NIL;    pitem = qitem)
  31.     {
  32.         /* Check item signature, then delete it.        */
  33.     if (pitem->signature != MN_ITEM_SIGN)
  34.         wnretern (MN_BAD_ITEM);
  35.     pitem->signature = MN_DEAD_ITEM;
  36.  
  37.     qitem = pitem->next;
  38.     if (pitem->plstring)
  39.         free (pitem->plstring);
  40.     if (pitem->pcharattr)
  41.         free (pitem->pcharattr);
  42.     free (pitem);
  43.     }
  44.  
  45.     return (WN_NO_ERROR);
  46. }
  47.