IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 12, 2006, 11:17:51 AM (20 years ago)
Author:
Paul Price
Message:

No need to generate errors --- NULL input gives NULL output, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/sys/psString.c

    r7852 r7879  
    1313 *  @author David Robbins, MHPCC
    1414 *
    15  *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2006-07-10 20:15:08 $
     15 *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-07-12 21:17:51 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    223223                            const char *key)
    224224{
    225     if (input == NULL ) {
    226         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    227                 "Invalid string in psStringSubstitute.  Input cannot be NULL or empty.\n");
    228         return NULL;
    229     } else if (strlen(input) == 0) {
    230         psError(PS_ERR_BAD_PARAMETER_NULL, true,
    231                 "Invalid string in psStringSubstitute.  Input cannot be NULL or empty.\n");
    232         return NULL;
    233     }
    234     if (key == NULL || strlen(key) == 0) {
    235         return NULL;
     225    // Empty input gives empty output
     226    if (!input || strlen(input) == 0) {
     227        return input;
     228    }
     229    // No key gives the same as the input
     230    if (!key || strlen(key) == 0) {
     231        return input;
    236232    }
    237233
Note: See TracChangeset for help on using the changeset viewer.