/[ofm]/ofm/misc.c
ViewVC logotype

Diff of /ofm/misc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by eses, Sun Jan 5 23:18:06 2003 UTC revision 1.2 by MarcusvA, Sat Jan 11 10:28:47 2003 UTC
# Line 1  Line 1 
1    /************************************************************************
2     *                                                                      *
3     * Open File Manager - ncurses file manager for GNU/Linux               *
4     * (c) 2001, 2002 Slawomir Strumecki, Raphael Bugajewski                *
5     *                                                                      *
6     * This program is free software, you can redistribute it and/or modify *
7     * it under the terms of the GNU General Public License as published by *
8     * the Free Software Foundation; either version 2 of the License, or    *
9     * (at your option) any later version.                                  *
10     *                                                                      *
11     * This program is distributed in the hope that it will be useful,      *
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
14     * GNU General Public License for more details.                         *
15     *                                                                      *
16     * You should have received a copy of the GNU General Public License    *
17     * along with this program; if not, write to the Free Software          *
18     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 *
19     *                                                                      *
20     ************************************************************************
21     *                                                                      *
22     * If you want to contact us, please use the following address(es):     *
23     *                                                                      *
24     *     Raphael Bugajewski               Slawomir Strumecki              *
25     *     Kl. Mittelstr. 1                 mailto: <logospam@poczta.fm>    *
26     *     13585 Berlin / Germany                                           *
27     *     Tel.: +49 (175) 331 93 92                                        *
28     *     mailto: <born@bugajewski.de>                                     *
29     *                                                                      *
30     ************************************************************************/
31    
32  #include <stdlib.h>  #include <stdlib.h>
33  #include <stdio.h>  #include <stdio.h>
34    
# Line 8  typedef struct tmanode{ Line 39  typedef struct tmanode{
39      void *ptr;      void *ptr;
40      struct tmanode *next;      struct tmanode *next;
41      struct tmanode *prev;      struct tmanode *prev;
42  } MANode;  //memory allocation node  } MANode;  /* memory allocation node */
43    
44  static MANode *MAList_hd=NULL;    //head of list  static MANode *MAList_hd=NULL;    /* head of list */
45  static MANode *MAList_tl=NULL;    //last element in list  static MANode *MAList_tl=NULL;    /* last element in list */
46    
47  int total_malloced=0;  int total_malloced=0;
48    
# Line 53  void xfree(void *ptr) Line 84  void xfree(void *ptr)
84                  total_malloced-=p->size;                  total_malloced-=p->size;
85    
86                  if (p->prev!=NULL) p->prev->next=p->next;                  if (p->prev!=NULL) p->prev->next=p->next;
87                  else { // if the first element in the list                  else { /*  if the first element in the list */
88                      if (MAList_tl==p) MAList_tl=p->next;                      if (MAList_tl==p) MAList_tl=p->next;
89                      MAList_hd=p->next;                                MAList_hd=p->next;          
90                  }                  }
91                  if (p->next!=NULL) p->next->prev=p->prev;                  if (p->next!=NULL) p->next->prev=p->prev;
92                  else {  //if the last element in the list                  else {  /* if the last element in the list */
93                      if (MAList_hd==p) MAList_hd=p->prev;                      if (MAList_hd==p) MAList_hd=p->prev;
94                      MAList_tl=p->prev;                      MAList_tl=p->prev;
95                  }                  }
# Line 91  void xfree(void *ptr) Line 122  void xfree(void *ptr)
122      return;      return;
123  }  }
124    
125  #endif      //if deined(DEBUG)  #endif      /* if defined(DEBUG) */
126    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26