Ignore:
Timestamp:
Jan 8, 2002, 7:29:57 PM (24 years ago)
Author:
umoeller
Message:

Executable updates, mostly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/xstring.c

    r121 r129  
    230230}
    231231
     232#ifdef __DEBUG_MALLOC_ENABLED__
     233
     234/*
     235 *@@ xstrInitCopyDebug:
     236 *
     237 *@@added V0.9.16 (2002-01-05) [umoeller]
     238 */
     239
     240void 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
    232277/*
    233278 *@@ xstrInitCopy:
     
    252297 *@@changed V0.9.7 (2000-12-31) [umoeller]: added ulExtraAllocate
    253298 *@@changed V0.9.9 (2001-03-09) [umoeller]: added ulDelta
     299 *@@changed V0.9.16 (2002-01-05) [umoeller]: use memcpy instead of strcpy
    254300 */
    255301
     
    271317                pxstr->cbAllocated = pxstr->ulLength + 1 + ulExtraAllocate;
    272318                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';
    274324
    275325                pxstr->ulDelta = pxstr->cbAllocated * 10 / 100;
Note: See TracChangeset for help on using the changeset viewer.