IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 30, 2004, 2:14:40 PM (22 years ago)
Author:
harman
Message:

Added psAbort for failed memory allocation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/collections/psBitSet.c

    r1073 r1162  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-06-23 23:00:15 $
     12 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-07-01 00:14:25 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2727#include "psMemory.h"
    2828#include "psError.h"
     29#include "psAbort.h"
    2930
    3031/******************************************************************************/
     
    9091    numBytes = ceil(n/8.0);
    9192    newObj = psAlloc(sizeof(psBitSet));
     93    if(newObj == NULL) {
     94        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     95    }
    9296    p_psMemSetDeallocator(newObj,(psFreeFcn)bitSetFree);
    9397    newObj->n = numBytes;
     
    96100    /*@i@*/
    97101    newObj->bits = psAlloc(sizeof(char)*numBytes);
     102    if(newObj->bits == NULL) {
     103        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     104    }
     105
    98106    memset(newObj->bits, numBytes, 0);
    99107
     
    225233    int numBits = inBitSet->n*8;
    226234    char* outString = psAlloc((size_t)numBits+1);
     235    if(outString == NULL) {
     236        psAbort(__func__," : Line %d - Failed to allocate memory", __LINE__);
     237    }
     238
    227239    for(i=0; i<numBits; i++) {
    228240        outString[numBits-i-1] = (psBitSetTest(inBitSet, i) == 1)?'1':'0';
Note: See TracChangeset for help on using the changeset viewer.