IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 13, 2006, 4:26:25 PM (20 years ago)
Author:
drobbin
Message:

Added str check test for error handling of psString fxns, namely stringSubstitute. Edited memory and type to include MemCheck's for string, line, and region. Added is_psType function to check for NULLs and native types first. <-will have to update all fxns next wrt to this change. Added psStringAlloc, stringFree, regionFree. Added doxygen comments.

File:
1 edited

Legend:

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

    r7879 r7901  
    1313 *  @author David Robbins, MHPCC
    1414 *
    15  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    16  *  @date $Date: 2006-07-12 21:17:51 $
     15 *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
     16 *  @date $Date: 2006-07-14 02:26:25 $
    1717 *
    1818 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3030#include "psErrorText.h"
    3131
     32static void stringFree(psString string)
     33{
     34    // There is non dynamic allocated item
     35}
     36
     37psString psStringAlloc(long nChar)
     38{
     39    if (nChar < 1) {
     40        return NULL;
     41    }
     42    psString string = psAlloc(nChar + 1);
     43    psMemSetDeallocator(string, (psFreeFunc)stringFree);
     44    return string;
     45}
     46
     47bool psMemCheckString(psPtr ptr)
     48{
     49    if (!is_psType(ptr)) {
     50        return false;
     51    }
     52    return ( psMemGetDeallocator(ptr) == (psFreeFunc)stringFree );
     53}
     54
    3255psString psStringCopy(const char *string)
    3356{
     
    231254        return input;
    232255    }
     256    if (!psMemCheckString(input)) {
     257        return input;
     258    }
     259
    233260
    234261    // replace == NULL is valid: it just means that we strip out the key
Note: See TracChangeset for help on using the changeset viewer.