Skip to content

Commit

Permalink
simplify SfRealloc()
Browse files Browse the repository at this point in the history
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 3e2964c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions mapshape.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/************************************************************************/
Expand Down
5 changes: 1 addition & 4 deletions mapxbase.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) );
}

/************************************************************************/
Expand Down

0 comments on commit 3e2964c

Please sign in to comment.