Changeset 129 for trunk/src/helpers/xstring.c
- Timestamp:
- Jan 8, 2002, 7:29:57 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/xstring.c
r121 r129 230 230 } 231 231 232 #ifdef __DEBUG_MALLOC_ENABLED__ 233 234 /* 235 *@@ xstrInitCopyDebug: 236 * 237 *@@added V0.9.16 (2002-01-05) [umoeller] 238 */ 239 240 void XWPENTRY xstrInitCopyDebug(PXSTRING pxstr, 241 const char *pcszSource, 242 ULONG ulExtraAllocate, 243 const char *file, 244 unsigned long line, 245 const char *function) 246 { 247 if (pxstr) 248 { 249 memset(pxstr, 0, sizeof(XSTRING)); 250 251 if (pcszSource) 252 { 253 pxstr->ulLength = strlen(pcszSource); 254 255 if (pxstr->ulLength) 256 { 257 // we do have a source string: 258 pxstr->cbAllocated = pxstr->ulLength + 1 + ulExtraAllocate; 259 pxstr->psz = (PSZ)memdMalloc(pxstr->cbAllocated, 260 file, 261 line, 262 function); 263 // V0.9.16 (2002-01-05) [umoeller] 264 memcpy(pxstr->psz, 265 pcszSource, 266 pxstr->ulLength); 267 pxstr->psz[pxstr->ulLength] = '\0'; 268 269 pxstr->ulDelta = pxstr->cbAllocated * 10 / 100; 270 } 271 } 272 } 273 } 274 275 #endif 276 232 277 /* 233 278 *@@ xstrInitCopy: … … 252 297 *@@changed V0.9.7 (2000-12-31) [umoeller]: added ulExtraAllocate 253 298 *@@changed V0.9.9 (2001-03-09) [umoeller]: added ulDelta 299 *@@changed V0.9.16 (2002-01-05) [umoeller]: use memcpy instead of strcpy 254 300 */ 255 301 … … 271 317 pxstr->cbAllocated = pxstr->ulLength + 1 + ulExtraAllocate; 272 318 pxstr->psz = (PSZ)malloc(pxstr->cbAllocated); 273 strcpy(pxstr->psz, pcszSource); 319 // V0.9.16 (2002-01-05) [umoeller] 320 memcpy(pxstr->psz, 321 pcszSource, 322 pxstr->ulLength); 323 pxstr->psz[pxstr->ulLength] = '\0'; 274 324 275 325 pxstr->ulDelta = pxstr->cbAllocated * 10 / 100;
Note:
See TracChangeset
for help on using the changeset viewer.