Changeset 1314 for cpp/frams/util/list.h
- Timestamp:
- 07/11/24 17:22:23 (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified cpp/frams/util/list.h ¶
r793 r1314 1 1 // This file is a part of Framsticks SDK. http://www.framsticks.com/ 2 // Copyright (C) 1999-20 18Maciej Komosinski and Szymon Ulatowski.2 // Copyright (C) 1999-2024 Maciej Komosinski and Szymon Ulatowski. 3 3 // See LICENSE.txt for details. 4 4 … … 9 9 #include <string.h> 10 10 #include <common/nonstd.h> 11 #include <common/realloc-free0size.h> 11 12 12 13 //#define SLISTSTATS … … 44 45 if (mem || x) 45 46 { 46 mem = (T*)realloc (mem, x*sizeof(T));47 mem = (T*)realloc_free0size(mem, x*sizeof(T)); 47 48 #ifdef SLISTSTATS 48 49 SListStats::stats.allocations++; 49 50 SListStats::stats.copied += sizeof(T)*min(x, have); 50 #endif 51 #endif 51 52 } 52 53 have = x; … … 150 151 { 151 152 setSize(src.size()); 152 memcpy(mem, src.mem, src.size()*sizeof(T)); 153 if (mem != NULL) 154 memcpy(mem, src.mem, src.size()*sizeof(T)); 153 155 } 154 156 void operator+=(const SListTempl<T>&src) ///< append src contents
Note: See TracChangeset
for help on using the changeset viewer.