From fb0579a0dfdabd894c1d99e8ff5358acfef0912c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 Aug 2019 15:23:35 +0200 Subject: [PATCH] Simplify SWIGTYPE "in" typemap There is no need to check if the input is non-null, as the effect of both branches of "if" is the same anyhow. Also get rid of an extra and unnecessary block. No real changes. --- Lib/c/c.swg | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Lib/c/c.swg b/Lib/c/c.swg index 7ce4e927a..bcb6a528c 100644 --- a/Lib/c/c.swg +++ b/Lib/c/c.swg @@ -190,12 +190,9 @@ same_action_all_primitive_types(in, "$1 = ($1_ltype) $input;", "$1 = &$input;") free($input); } -%typemap(in) SWIGTYPE & { - if ($input) +%typemap(in) SWIGTYPE & %{ $1 = ($1_ltype) $input; - else - $1 = ($1_ltype) 0; -} +%} // Typemaps for assigning result values to a special return variable same_action_all_primitive_types(out, "$result = $1;", "$result = *$1;")