|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 1555 (0x613) Types: TextFile Notes: UNIX file Names: »uninit.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code └─⟦f4b8d8c84⟧ UNIX Filesystem └─⟦this⟧ »unimenu/src/menu/uninit.c«
static char *SCCSid = "@(#)uninit.c 1.1 15:35:33 4/6/85"; /* * Copyright (c) 1984 * * LANTECH Systems, Incoroporated * * All rights reserved */ /* * Function: deinit(mp) * * Purpose: Clear the menu data structure. * * Passed: A menu_f pointer * * Action: This guy frees up all the menory it possibly can. * * Returns: Yep. * * Called by: Execute. * * Calls: Free. * * History: Original code July 84, Robert Adams. * * Notes: This module relies on the integrity of free(3)'ed memory. * MAINTAIN THAT INTEGRITY! No malloc(3)'s, no printf's, * nothin! */ #include "defs.h" deinit (mp) struct menu_f *mp; { struct choice_f *chp; #ifdef DEBUG write(2, "uninit\n", 7); #endif if (mp == NULL) return; choice_free (&mp -> m_global); chp = mp -> m_list ; while ( chp ) { choice_free (chp); free (chp); chp = chp -> c_next; } #ifdef DEBUG write(2, "uninit: choices done\n", 21); #endif if (mp -> m_prompt) free (mp -> m_prompt); if (mp -> m_bad) free (mp -> m_bad); free (mp); #ifdef DEBUG read(0, &chp, 1); #endif return; } choice_free (chp) struct choice_f *chp; { struct line_f *lp; if ( chp == NULL ) return; #define line_free(lp) {if(lp){free((lp)->l_key);free(lp);}} line_free(chp -> c_text) line_free(chp -> c_exec) line_free(chp -> c_help) line_free(chp->c_expl) #undef line_free lp = chp -> c_list; while ( lp ) { free(lp->l_key); free(lp); lp = lp -> l_next; } return; } /*free(c)char *c;{ printf("%X from %X\n",(unsigned int)c, (unsigned int)(*(&c-1))); }*/