Changeset 15523
- Timestamp:
- Nov 8, 2007, 2:47:41 PM (19 years ago)
- Location:
- trunk/psLib/src/sys
- Files:
-
- 2 edited
-
psString.c (modified) (6 diffs)
-
psString.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psString.c
r15502 r15523 13 13 * @author David Robbins, MHPCC 14 14 * 15 * @version $Revision: 1. 59$ $Name: not supported by cvs2svn $16 * @date $Date: 2007-11-0 8 04:22:23$15 * @version $Revision: 1.60 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2007-11-09 00:47:41 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 144 144 ssize_t tailLength = 0; // length of string to append 145 145 146 if (*dest && psMemGetRefCounter(*dest) > 1) { 147 psWarning("Appending to a string with multiple reference counts may corrupt memory!"); 148 } 149 146 150 if (*dest) { 147 151 oldLength = strlen(*dest); … … 218 222 char *oldDest; // copy of original string 219 223 224 if (*dest && psMemGetRefCounter(*dest) > 1) { 225 psWarning("Appending to a string with multiple reference counts may corrupt memory!"); 226 } 227 220 228 if (!*dest) { 221 229 // makes the string backup and concatination pointless … … 270 278 // NULL input string returns empty (not NULL) list 271 279 // NULL splitters is an error 272 psList *psStringSplit(const char *string, 273 const char *splitters, 274 bool multipleAreSignificant) 280 psList *p_psStringSplit(const char *file, 281 unsigned int lineno, 282 const char *func, 283 const char *string, 284 const char *splitters, 285 bool multipleAreSignificant) 275 286 { 276 287 PS_ASSERT_STRING_NON_EMPTY(splitters, NULL); 277 288 278 psList *values = p sListAlloc(NULL); // The list of values to return289 psList *values = p_psListAlloc(file, lineno, func, NULL); // The list of values to return 279 290 // An input NULL string should not generate an error: it is a valid case 280 291 if (string == NULL) { … … 293 304 294 305 // Copy the current word 295 psString word = p sStringNCopy(current, next - current);306 psString word = p_psStringNCopy(file, lineno, func, current, next - current); 296 307 psListAdd(values, PS_LIST_TAIL, word); 297 308 psFree(word); … … 302 313 if (strlen(current) > 0) { 303 314 // Copy the last word 304 psString word = p sStringCopy(current);315 psString word = p_psStringCopy(file, lineno, func, current); 305 316 (void)psListAdd(values, PS_LIST_TAIL, word); 306 317 psFree(word); -
trunk/psLib/src/sys/psString.h
r14679 r15523 11 11 * @author Joshua Hoblitt, University of Hawaii 12 12 * 13 * @version $Revision: 1.4 3$ $Name: not supported by cvs2svn $14 * @date $Date: 2007- 08-27 23:24:21 $13 * @version $Revision: 1.44 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2007-11-09 00:47:41 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 242 242 * @return psList*: The list of (split) psStrings. 243 243 */ 244 #ifdef DOXYGEN 244 245 psList *psStringSplit( 245 246 const char *string, ///< String to split … … 247 248 bool multipleAreSignificant ///< Are multiple occurences significant? 248 249 ); 249 250 #else // ifdef DOXYGEN 251 psList *p_psStringSplit( 252 const char *file, ///< File of caller 253 unsigned int lineno, ///< Line number of caller 254 const char *func, ///< Function name of caller 255 const char *string, ///< String to split 256 const char *splitters, ///< Characters on which to split 257 bool multipleAreSignificant ///< Are multiple occurences significant? 258 ); 259 #define psStringSplit(string, splitters, multiple) \ 260 p_psStringSplit(__FILE__, __LINE__, __func__, string, splitters, multiple) 261 #endif // ifdef DOXYGEN 250 262 251 263 /** Procedure to split the input string into a psArray of psStrings.
Note:
See TracChangeset
for help on using the changeset viewer.
