Changeset 6278 for trunk/psLib/src/sys/psString.c
- Timestamp:
- Feb 1, 2006, 10:40:56 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/sys/psString.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/sys/psString.c
r6218 r6278 13 13 * @author David Robbins, MHPCC 14 14 * 15 * @version $Revision: 1.2 3$ $Name: not supported by cvs2svn $16 * @date $Date: 2006-0 1-27 01:49:05$15 * @version $Revision: 1.24 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2006-02-01 20:40:56 $ 17 17 * 18 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 31 31 psString psStringCopy(const char *string) 32 32 { 33 PS_ASSERT_PTR_NON_NULL(string, NULL); 33 34 // Allocate memory using psAlloc function 34 35 // Copy input string to memory just allocated 35 36 // Return the copy 36 return strcpy(psAlloc(strlen(string) + 1), string); 37 // Pass through NULL values 38 return string ? strcpy(psAlloc(strlen(string) + 1), string) : NULL; 37 39 } 38 40 … … 40 42 unsigned int nChar) 41 43 { 44 PS_ASSERT_PTR_NON_NULL(string, NULL); 42 45 char *returnValue = NULL; 43 46 … … 53 56 // Copy input string to memory allocated up to nChar characters 54 57 // Return the copy 55 returnValue = strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar); 58 // Pass through NULL values 59 returnValue = 60 string ? strncpy(psAlloc((size_t) nChar + 1), string, (size_t) nChar) 61 : NULL; 56 62 57 63 // Ensure the last byte is NULL character … … 66 72 ...) 67 73 { 74 PS_ASSERT_PTR_NON_NULL(format, 0); 68 75 va_list args; 69 76 size_t length; // complete string length (sans \0) … … 113 120 ...) 114 121 { 122 PS_ASSERT_PTR_NON_NULL(format, 0); 115 123 va_list args; 116 124 size_t length; // complete string length (sans \0)
Note:
See TracChangeset
for help on using the changeset viewer.
