summaryrefslogtreecommitdiff
path: root/Lib/lua
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2022-01-29 22:03:48 +1300
committerGitHub <noreply@github.com>2022-01-29 22:03:48 +1300
commit7ec2f89fe241e3aabd988d3aa6fe17e4878516dc (patch)
treee07b8a2f41f61cdec1275edd5850f2fad637fb7c /Lib/lua
parent5a10e103992c49b8b402745b294fcdd4ca48e705 (diff)
downloadswig-7ec2f89fe241e3aabd988d3aa6fe17e4878516dc.tar.gz
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/
Diffstat (limited to 'Lib/lua')
-rw-r--r--Lib/lua/typemaps.i4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/lua/typemaps.i b/Lib/lua/typemaps.i
index 8392e5bfa..a930b038f 100644
--- a/Lib/lua/typemaps.i
+++ b/Lib/lua/typemaps.i
@@ -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
*/
%{