Ignore:
Timestamp:
Dec 14, 2001, 11:41:33 PM (24 years ago)
Author:
umoeller
Message:

Lots of changes for icons and refresh.

File:
1 edited

Legend:

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

    r122 r123  
    4242
    4343#define INCL_WINSHELLDATA
     44#define INCL_DOSERRORS
    4445#include <os2.h>
    4546
     
    6869 */
    6970
     71#ifdef __DEBUG_MALLOC_ENABLED__
     72
     73/*
     74 *@@ strhStoreDebug:
     75 *      memory debug version of strhStore.
     76 *
     77 *@@added V0.9.16 (2001-12-08) [umoeller]
     78 */
     79
     80APIRET strhStoreDebug(PSZ *ppszTarget,
     81                      PCSZ pcszSource,
     82                      PULONG pulLength,        // out: length of new string (ptr can be NULL)
     83                      const char *pcszSourceFile,
     84                      unsigned long ulLine,
     85                      const char *pcszFunction)
     86{
     87    ULONG ulLength = 0;
     88
     89    if (ppszTarget)
     90    {
     91        if (*ppszTarget)
     92            free(*ppszTarget);
     93
     94        if (    (pcszSource)
     95             && (ulLength = strlen(pcszSource))
     96           )
     97        {
     98            if (*ppszTarget = (PSZ)memdMalloc(ulLength + 1,
     99                                              pcszSourceFile,
     100                                              ulLine,
     101                                              pcszFunction))
     102                memcpy(*ppszTarget, pcszSource, ulLength + 1);
     103            else
     104                return (ERROR_NOT_ENOUGH_MEMORY);
     105        }
     106        else
     107            *ppszTarget = NULL;
     108    }
     109
     110    if (pulLength)
     111        *pulLength = ulLength;
     112
     113    return (NO_ERROR);
     114}
     115
     116#endif
     117
    70118/*
    71119 *@@ strhStore:
     
    81129 */
    82130
    83 VOID strhStore(PSZ *ppszTarget,
    84                PCSZ pcszSource,
    85                PULONG pulLength)        // out: length of new string (ptr can be NULL)
     131APIRET strhStore(PSZ *ppszTarget,
     132                 PCSZ pcszSource,
     133                 PULONG pulLength)        // out: length of new string (ptr can be NULL)
    86134{
    87135    ULONG ulLength = 0;
     
    98146            if (*ppszTarget = (PSZ)malloc(ulLength + 1))
    99147                memcpy(*ppszTarget, pcszSource, ulLength + 1);
     148            else
     149                return (ERROR_NOT_ENOUGH_MEMORY);
    100150        }
    101151        else
     
    105155    if (pulLength)
    106156        *pulLength = ulLength;
     157
     158    return (NO_ERROR);
    107159}
    108160
     
    127179
    128180/*
    129  *@@ strhdup:
     181 *@@ strhdupDebug:
    130182 *      memory debug version of strhdup.
    131183 *
     
    133185 */
    134186
    135 PSZ strhdupDebug(const char *pszSource,
     187PSZ strhdupDebug(const char *pcszSource,
    136188                 unsigned long *pulLength,
    137189                 const char *pcszSourceFile,
     
    147199    {
    148200        if (pszReturn = (PSZ)memdMalloc(ulLength + 1,
    149                                         pcszSourceFile,
     201                                        pcszSourceFile,     // fixed V0.9.16 (2001-12-08) [umoeller]
    150202                                        ulLine,
    151203                                        pcszFunction))
Note: See TracChangeset for help on using the changeset viewer.