summaryrefslogtreecommitdiff
path: root/Lib/typemaps
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/typemaps
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/typemaps')
-rw-r--r--Lib/typemaps/cpointer.swg4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/typemaps/cpointer.swg b/Lib/typemaps/cpointer.swg
index 94bbbd6bc..88e8ef242 100644
--- a/Lib/typemaps/cpointer.swg
+++ b/Lib/typemaps/cpointer.swg
@@ -55,7 +55,7 @@ typedef struct {
return %new_instance(TYPE);
}
~NAME() {
- if ($self) %delete($self);
+ %delete($self);
}
}
@@ -114,7 +114,7 @@ typedef struct {
}
static void delete_##NAME(TYPE *obj) {
- if (obj) %delete(obj);
+ %delete(obj);
}
static void NAME ##_assign(TYPE *obj, TYPE value) {