Skip to content
Permalink
Browse files

simplify SfRealloc()

realloc(NULL,size) is equivalent to malloc(size).  No need for this
runtime check.
  • Loading branch information
MaxKellermann committed Mar 27, 2014
1 parent e151854 commit 3e2964ccfaa00489112992616f7efe091b0046f2
Showing with 2 additions and 8 deletions.
  1. +1 −4 mapshape.c
  2. +1 −4 mapxbase.c
@@ -78,10 +78,7 @@ static void SwapWord( int length, void * wordP )
/************************************************************************/
static void * SfRealloc( void * pMem, int nNewSize )
{
if( pMem == NULL )
return( (void *) malloc(nNewSize) );
else
return( (void *) realloc(pMem,nNewSize) );
return realloc(pMem, nNewSize);
}

/************************************************************************/
@@ -54,10 +54,7 @@
static void * SfRealloc( void * pMem, int nNewSize )

{
if( pMem == NULL )
return( (void *) malloc(nNewSize) );
else
return( (void *) realloc(pMem,nNewSize) );
return( (void *) realloc(pMem,nNewSize) );
}

/************************************************************************/

0 comments on commit 3e2964c

Please sign in to comment.
You can’t perform that action at this time.