Changeset 71 for trunk/src/helpers/xstring.c
- Timestamp:
- May 22, 2001, 7:18:41 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/xstring.c
r65 r71 285 285 *@@added V0.9.7 (2001-01-07) [umoeller] 286 286 *@@changed V0.9.9 (2001-03-09) [umoeller]: now using ulDelta 287 *@@changed V0.9.12 (2001-05-21) [umoeller]: now reporting error on realloc fail 287 288 */ 288 289 … … 318 319 // this gives the C runtime a chance to expand the 319 320 // existing block 320 pxstr->psz = (PSZ)realloc(pxstr->psz, cbAllocate);321 if (pxstr->psz = (PSZ)realloc(pxstr->psz, cbAllocate)) 321 322 // if pxstr->psz is NULL, realloc behaves like malloc 322 pxstr->cbAllocated = cbAllocate;323 pxstr->cbAllocated = cbAllocate; 323 324 // ulLength is unchanged 325 else 326 // error: V0.9.12 (2001-05-21) [umoeller] 327 pxstr->cbAllocated = 0; 324 328 } 325 329 // else: we have enough memory … … 448 452 *@@changed V0.9.9 (2001-02-16) [umoeller]: now supporting non-zero-terminated pcszSource 449 453 *@@changed V0.9.9 (2001-03-09) [umoeller]: now using xstrReserve 454 *@@changed V0.9.12 (2001-05-21) [umoeller]: added xstrReserve error checking 450 455 */ 451 456 … … 470 475 { 471 476 // we do have a source string: 472 xstrReserve(pxstr, 473 // required memory: 474 ulSourceLength + 1); 475 476 memcpy(pxstr->psz, 477 pcszSource, 478 ulSourceLength); 479 *(pxstr->psz + ulSourceLength) = '\0'; 480 // V0.9.9 (2001-02-16) [umoeller] 481 // we must do this or otherwise we require pcszSource 482 // to be zero-terminated... not a good idea 477 if (xstrReserve(pxstr, 478 // required memory: 479 ulSourceLength + 1)) 480 { 481 memcpy(pxstr->psz, 482 pcszSource, 483 ulSourceLength); 484 *(pxstr->psz + ulSourceLength) = '\0'; 485 // V0.9.9 (2001-02-16) [umoeller] 486 // we must do this or otherwise we require pcszSource 487 // to be zero-terminated... not a good idea 488 } 489 else 490 pxstr->ulLength = 0; // error V0.9.12 (2001-05-21) [umoeller] 483 491 } 484 492 else
Note:
See TracChangeset
for help on using the changeset viewer.