Changeset 54 for trunk/src/helpers/stringh.c
- Timestamp:
- Apr 4, 2001, 4:39:06 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/stringh.c
r52 r54 233 233 + strhSubstr(p1, p2) 234 234 * would return a new string containing "2345678". 235 */ 236 237 PSZ strhSubstr(const char *pBegin, const char *pEnd) 238 { 239 ULONG cbSubstr = (pEnd - pBegin); 240 PSZ pszSubstr = (PSZ)malloc(cbSubstr + 1); 241 strhncpy0(pszSubstr, pBegin, cbSubstr); 235 * 236 *@@changed V0.9.9 (2001-04-04) [umoeller]: fixed crashes with invalid pointers 237 *@@changed V0.9.9 (2001-04-04) [umoeller]: now using memcpy for speed 238 */ 239 240 PSZ strhSubstr(const char *pBegin, // in: first char 241 const char *pEnd) // in: last char (not included) 242 { 243 PSZ pszSubstr = NULL; 244 245 if (pEnd > pBegin) // V0.9.9 (2001-04-04) [umoeller] 246 { 247 ULONG cbSubstr = (pEnd - pBegin); 248 pszSubstr = (PSZ)malloc(cbSubstr + 1); 249 if (pszSubstr) 250 { 251 // strhncpy0(pszSubstr, pBegin, cbSubstr); 252 memcpy(pszSubstr, pBegin, cbSubstr); // V0.9.9 (2001-04-04) [umoeller] 253 *(pszSubstr + cbSubstr) = '\0'; 254 } 255 } 256 242 257 return (pszSubstr); 243 258 }
Note:
See TracChangeset
for help on using the changeset viewer.