1 //------------------------------------------------------------------------- 2 /* 3 Copyright (C) 2010-2019 EDuke32 developers and contributors 4 Copyright (C) 2019 Nuke.YKT 5 6 This file is part of NBlood. 7 8 NBlood is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License version 2 10 as published by the Free Software Foundation. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 16 See the GNU General Public License for more details. 17 18 You should have received a copy of the GNU General Public License 19 along with this program; if not, write to the Free Software 20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 */ 22 //------------------------------------------------------------------------- 23 #pragma once 24 25 #ifdef USE_QHEAP 26 27 struct HEAPNODE 28 { 29 HEAPNODE *prev; 30 HEAPNODE *next; 31 int size; 32 bool isFree; 33 HEAPNODE *freePrev; 34 HEAPNODE *freeNext; 35 }; 36 37 class QHeap 38 { 39 public: 40 QHeap(int heapSize); 41 ~QHeap(void); 42 43 void Check(void); 44 void Debug(void); 45 void *Alloc(int); 46 int Free(void *p); 47 48 void *heapPtr; 49 HEAPNODE heap; 50 HEAPNODE freeHeap; 51 int size; 52 }; 53 54 #endif 55