Changeset 91 for trunk/src/helpers/xstring.c
- Timestamp:
- Aug 2, 2001, 10:36:35 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/xstring.c
r86 r91 112 112 113 113 #include "helpers\stringh.h" 114 #define DONT_REPLACE_XSTR_MALLOC 114 115 #include "helpers\xstring.h" // extended string helpers 115 116 … … 118 119 * See xstring.c. 119 120 */ 121 122 #ifdef __DEBUG_MALLOC_ENABLED__ 123 124 /* 125 *@@ xstrInitDebug: 126 * 127 *@@added V0.9.14 (2001-08-01) [umoeller] 128 */ 129 130 void XWPENTRY xstrInitDebug(PXSTRING pxstr, 131 ULONG ulPreAllocate, 132 const char *file, 133 unsigned long line, 134 const char *function) 135 { 136 memset(pxstr, 0, sizeof(XSTRING)); 137 if (ulPreAllocate) 138 { 139 pxstr->psz = (PSZ)memdMalloc(ulPreAllocate, 140 file, 141 line, 142 function); 143 pxstr->cbAllocated = ulPreAllocate; 144 // ulLength is still zero 145 *(pxstr->psz) = 0; 146 147 pxstr->ulDelta = ulPreAllocate * 10 / 100; 148 } 149 150 // else: pxstr->ulDelta is still 0 151 pxstr->file = file; 152 pxstr->line = line; 153 pxstr->function = function; 154 } 155 156 #endif // __DEBUG_MALLOC_ENABLED__ 120 157 121 158 /* … … 319 356 // this gives the C runtime a chance to expand the 320 357 // existing block 321 if (pxstr->psz = (PSZ)realloc(pxstr->psz, cbAllocate)) 358 #ifdef __DEBUG_MALLOC_ENABLED__ 359 if (pxstr->psz = (PSZ)memdRealloc(pxstr->psz, 360 cbAllocate, 361 pxstr->file, 362 pxstr->line, 363 pxstr->function)) 364 #else 365 if (pxstr->psz = (PSZ)realloc(pxstr->psz, 366 cbAllocate)) 367 #endif 322 368 // if pxstr->psz is NULL, realloc behaves like malloc 323 369 pxstr->cbAllocated = cbAllocate;
Note:
See TracChangeset
for help on using the changeset viewer.