Remove redundant NULL checks before free()/delete (#2184)
Remove redundant NULL checks before free()/delete The ISO C and C++ standards guarantee that it's safe to call these on a NULL pointer, so it's not necessary for the calling code to also check. Fixes https://sourceforge.net/p/swig/feature-requests/70/
This commit is contained in:
parent
5a10e10399
commit
7ec2f89fe2
17 changed files with 44 additions and 51 deletions
|
|
@ -192,10 +192,10 @@ int SWIG_read_NAME_num_array(lua_State* L,int index,TYPE *array,int size);
|
|||
There probably is some compiler that its not true for, so the code is left here just in case.
|
||||
#ifdef __cplusplus
|
||||
#define SWIG_ALLOC_ARRAY(TYPE,LEN) new TYPE[LEN]
|
||||
#define SWIG_FREE_ARRAY(PTR) if(PTR){delete[] PTR;}
|
||||
#define SWIG_FREE_ARRAY(PTR) delete[] PTR
|
||||
#else
|
||||
#define SWIG_ALLOC_ARRAY(TYPE,LEN) (TYPE *)malloc(LEN*sizeof(TYPE))
|
||||
#define SWIG_FREE_ARRAY(PTR) if(PTR){free(PTR);}
|
||||
#define SWIG_FREE_ARRAY(PTR) free(PTR)
|
||||
#endif
|
||||
*/
|
||||
%{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue