cache ERRSV in a local variable
Lukas Mai [Fri, 8 Mar 2013 02:58:32 +0000 (03:58 +0100)]
Turns out 'SvTRUE(ERRSV)' expands to truly hideous code.
'SV *err = ERRSV; if (SvTRUE(err))' looks slightly better.

Parameters.xs

index ec46ef3..282bb03 100644 (file)
@@ -774,9 +774,11 @@ static size_t count_named_params(const ParamSpec *ps) {
 }
 
 static void my_require(pTHX_ const char *file) {
+       SV *err;
        require_pv(file);
-       if (SvTRUE(ERRSV)) {
-               croak_sv(ERRSV);
+       err = ERRSV;
+       if (SvTRUE(err)) {
+               croak_sv(err);
        }
 }