home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 2 / goldfish_vol2_cd1.bin / files / dev / c / curses / src / delwin.c < prev    next >
C/C++ Source or Header  |  1994-02-21  |  3KB  |  92 lines

  1. /* -*-C-*-
  2.  *
  3.  *
  4.  * Filename : delwin.c
  5.  *
  6.  * Author   : Simon J Raybould.    (sie@fulcrum.bt.co.uk).
  7.  *
  8.  * Date     : Friday 23rd August 1991.
  9.  *
  10.  * Desc     : Frees up memory used by a window.
  11.  *
  12.  *
  13.  * THIS CODE IS NOT PUBLIC DOMAIN
  14.  * ==============================
  15.  * 
  16.  * This code is copyright Simon J Raybould 1991, all rights are reserved.
  17.  * All code, ideas, data structures and algorithms remain the property of the
  18.  * author. Neither the whole nor sections of this code may be used as part
  19.  * of other code without the authors consent. If you wish to use some of this
  20.  * code then please email me at (sie@fulcrum.bt.co.uk).
  21.  *
  22.  * This source is not public domain, so you do not have any right to alter it
  23.  * or sell it for personal gain. The source is provided purely for reference
  24.  * purposes. You may re-compile the source with any compiler you choose.
  25.  * You must not distribute altered copies without the authors consent. My
  26.  * intention is that the source will help people isolate any bugs much more
  27.  * effectivly.
  28.  *
  29.  * Disclaimer
  30.  * ==========
  31.  *
  32.  * No implication is made as to this code being fit for any purpose at all.
  33.  * I (the author) shall not be held responsible for any loss of data or damage 
  34.  * to property that may result from its use or misuse.
  35.  *
  36.  *
  37.  * Revision History
  38.  * ================
  39.  *
  40.  * $Log: delwin.c,v $
  41.  * Revision 1.6  1993/05/17  23:33:10  sie
  42.  * Underscores added to names.
  43.  * Changes for version 2.10
  44.  *
  45.  * Revision 1.5  1992/06/10  23:44:34  sie
  46.  * Added serial support.
  47.  *
  48.  * Revision 1.4  91/12/30  10:30:55  sie
  49.  * Removed LRLine and LRATTRS.
  50.  * The speed increase caused by them was too insignificant.
  51.  * 
  52.  * Revision 1.3  91/12/28  13:57:24  sie
  53.  * Removed WinStat.
  54.  * Renamed LineElement as lnel.
  55.  * 
  56.  * Revision 1.2  91/12/26  14:39:45  sie
  57.  * removed use of Next and Prev in WinStat as linked list is no longer
  58.  * relevant.
  59.  * 
  60.  * Revision 1.1  91/09/07  11:40:51  sie
  61.  * Initial revision
  62.  * 
  63.  *
  64.  */
  65.  
  66. static char *rcsid = "$Header: /SRC/lib/curses/src/RCS/delwin.c,v 1.6 1993/05/17 23:33:10 sie Exp $";
  67.  
  68. #include <stdlib.h>
  69. #include "acurses.h"
  70.  
  71.  
  72. delwin(WINDOW *WinPtr)
  73. {
  74.   int LineNo;
  75.   
  76.   if(!(_CursesFlags & CFLAG_INITSCR))
  77.     return ERR;
  78.   
  79.   if(!WinPtr->ParentWin) {
  80.     /* If it's a real window, free up Line, ATTRS */
  81.     for(LineNo=0; LineNo<WinPtr->NLines; LineNo++) {
  82.       free(WinPtr->LnArry[LineNo].Line);
  83.       free(WinPtr->LnArry[LineNo].ATTRS);
  84.     }
  85.   }
  86.   /* Free up LnArry[] */
  87.   free(WinPtr->LnArry);
  88.   /* Free the WinPtr */
  89.   free(WinPtr);
  90.   return OK;
  91. }
  92.