Changeset 8415 for trunk/psLib/src/sys/psString.c
- Timestamp:
- Aug 17, 2006, 3:59:13 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psString.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psString.c
r8232 r8415 13 13 * @author David Robbins, MHPCC 14 14 * 15 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $16 * @date $Date: 2006-08- 08 23:32:23 $15 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2006-08-18 01:59:13 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 108 108 } 109 109 110 if (!*dest) { 111 *dest = psStringCopy(""); 110 if (*dest) { 111 oldLength = strlen(*dest); 112 } else { 112 113 oldLength = 0; 113 } else {114 // size of existing string115 oldLength = strlen(*dest);116 114 } 117 115 … … 128 126 } 129 127 130 // new string length (sans \0)131 length = oldLength + tailLength;132 133 128 // realloc string to string + tail + \0 134 *dest = psRealloc(*dest, length + 1); 129 if (*dest) { 130 *dest = psRealloc(*dest, oldLength + tailLength + 1); 131 } else { 132 *dest = psStringAlloc(oldLength + tailLength + 1); 133 } 135 134 136 135 // append tail + \0
Note:
See TracChangeset
for help on using the changeset viewer.
