| 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 |
|
|
| 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 |
|
|
| 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 |
} |
} |
| 122 |
return; |
return; |
| 123 |
} |
} |
| 124 |
|
|
| 125 |
#endif //if deined(DEBUG) |
#endif /* if defined(DEBUG) */ |
| 126 |
|
|