Changeset 123 for trunk/src/helpers/stringh.c
- Timestamp:
- Dec 14, 2001, 11:41:33 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/stringh.c
r122 r123 42 42 43 43 #define INCL_WINSHELLDATA 44 #define INCL_DOSERRORS 44 45 #include <os2.h> 45 46 … … 68 69 */ 69 70 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 80 APIRET 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 70 118 /* 71 119 *@@ strhStore: … … 81 129 */ 82 130 83 VOIDstrhStore(PSZ *ppszTarget,84 PCSZ pcszSource,85 PULONG pulLength) // out: length of new string (ptr can be NULL)131 APIRET strhStore(PSZ *ppszTarget, 132 PCSZ pcszSource, 133 PULONG pulLength) // out: length of new string (ptr can be NULL) 86 134 { 87 135 ULONG ulLength = 0; … … 98 146 if (*ppszTarget = (PSZ)malloc(ulLength + 1)) 99 147 memcpy(*ppszTarget, pcszSource, ulLength + 1); 148 else 149 return (ERROR_NOT_ENOUGH_MEMORY); 100 150 } 101 151 else … … 105 155 if (pulLength) 106 156 *pulLength = ulLength; 157 158 return (NO_ERROR); 107 159 } 108 160 … … 127 179 128 180 /* 129 *@@ strhdup :181 *@@ strhdupDebug: 130 182 * memory debug version of strhdup. 131 183 * … … 133 185 */ 134 186 135 PSZ strhdupDebug(const char *p szSource,187 PSZ strhdupDebug(const char *pcszSource, 136 188 unsigned long *pulLength, 137 189 const char *pcszSourceFile, … … 147 199 { 148 200 if (pszReturn = (PSZ)memdMalloc(ulLength + 1, 149 pcszSourceFile, 201 pcszSourceFile, // fixed V0.9.16 (2001-12-08) [umoeller] 150 202 ulLine, 151 203 pcszFunction))
Note:
See TracChangeset
for help on using the changeset viewer.