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
|
|
@ -30,7 +30,7 @@ namespace std {
|
|||
if (scm_is_string($input)) {
|
||||
tempptr = SWIG_scm2str($input);
|
||||
$1.assign(tempptr);
|
||||
if (tempptr) SWIG_free(tempptr);
|
||||
SWIG_free(tempptr);
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "string expected");
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ namespace std {
|
|||
if (scm_is_string($input)) {
|
||||
tempptr = SWIG_scm2str($input);
|
||||
temp.assign(tempptr);
|
||||
if (tempptr) SWIG_free(tempptr);
|
||||
SWIG_free(tempptr);
|
||||
$1 = &temp;
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "string expected");
|
||||
|
|
@ -51,7 +51,7 @@ namespace std {
|
|||
if (scm_is_string($input)) {
|
||||
tempptr = SWIG_scm2str($input);
|
||||
$1 = new $*1_ltype(tempptr);
|
||||
if (tempptr) SWIG_free(tempptr);
|
||||
SWIG_free(tempptr);
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "string expected");
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ namespace std {
|
|||
if (scm_is_string($input)) {
|
||||
char *tempptr = SWIG_scm2str($input);
|
||||
$1.assign(tempptr);
|
||||
if (tempptr) SWIG_free(tempptr);
|
||||
SWIG_free(tempptr);
|
||||
} else {
|
||||
SWIG_exception(SWIG_TypeError, "string expected");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue