IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3207


Ignore:
Timestamp:
Feb 13, 2005, 9:55:53 AM (21 years ago)
Author:
jhoblitt
Message:

change psStringAppend() & psStringPrepend() to alloc a string when passed NULL

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/psdb/psDB.c

    r3205 r3207  
    88 *  @author Joshua Hoblitt
    99 *
    10  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-02-13 11:21:18 $
     10 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-02-13 19:55:53 $
    1212 *
    1313 *  Copyright 2005 Joshua Hoblitt, University of Hawaii
     
    12451245    ssize_t         tailLength;         // length of string to append
    12461246
    1247     // size of existing string
    1248     oldLength = strlen(*dest);
     1247    if (!*dest) {
     1248        *dest = psStringCopy("");
     1249        oldLength = 0;
     1250    } else {
     1251        // size of existing string
     1252        oldLength = strlen(*dest);
     1253    }
    12491254
    12501255    // find the size of the string to append
     
    12811286    char            *oldDest;           // copy of original string
    12821287
    1283     // size of existing string
    1284     length = strlen(*dest);
     1288    if (!*dest) {
     1289        // makes the string backup and concatination pointless
     1290        *dest = psStringCopy("");
     1291        length = 0;
     1292    } else {
     1293        // size of existing string
     1294        length = strlen(*dest);
     1295    }
    12851296
    12861297    // find the size of the string to prepend
Note: See TracChangeset for help on using the changeset viewer.