IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9919 for trunk/psLib


Ignore:
Timestamp:
Nov 8, 2006, 5:50:08 PM (20 years ago)
Author:
jhoblitt
Message:

delay parseLevelInfoArray alloc in parseLine() until it's really needed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psMetadataConfig.c

    r9918 r9919  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.115 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-11-09 03:22:38 $
     12*  @version $Revision: 1.116 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-11-09 03:50:08 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    14071407    }
    14081408
     1409    // split the input string into an array of lines
     1410    psList *doc = psStringSplit(str, "\n", true);
     1411    if (!doc) {
     1412        psError(PS_ERR_UNKNOWN, false, "failed to split string: %s", str);
     1413        if (allocedMD) {
     1414            psFree(md);
     1415        }
     1416        return NULL;
     1417    }
     1418    if (psListLength(doc) == 0) {
     1419        psError(PS_ERR_UNKNOWN, false, "string contained no lines");
     1420        psFree(doc);
     1421        if (allocedMD) {
     1422            psFree(md);
     1423        }
     1424        return NULL;
     1425    }
     1426
    14091427    // Allocate array to store parse level information
    14101428    psArray *parseLevelInfoArray = psArrayAllocEmpty(INITIAL_LENGTH);
     
    14151433    psArrayAdd(parseLevelInfoArray, 0, topLevelInfo);
    14161434    psFree(topLevelInfo);
    1417 
    1418     psList *doc = psStringSplit(str, "\n", true);
    1419     if (!doc) {
    1420         psError(PS_ERR_UNKNOWN, false, "failed to split string: %s", str);
    1421         psFree(parseLevelInfoArray);
    1422         if (allocedMD) {
    1423             psFree(md);
    1424         }
    1425         return NULL;
    1426     }
    1427     if (psListLength(doc) == 0) {
    1428         psError(PS_ERR_UNKNOWN, false, "string contained no lines");
    1429         psFree(doc);
    1430         psFree(parseLevelInfoArray);
    1431         if (allocedMD) {
    1432             psFree(md);
    1433         }
    1434         return NULL;
    1435     }
    14361435
    14371436    // clear the error stack so we can call psError(..., false, ...) and let
Note: See TracChangeset for help on using the changeset viewer.