develooper Front page | perl.perl5.porters | Postings from November 2003

Re: [PATCH 5.8.1] make reentr.[ch] compatible with 5.8.0 again

Thread Previous
From:
Jan Dubois
Date:
November 3, 2003 01:02
Subject:
Re: [PATCH 5.8.1] make reentr.[ch] compatible with 5.8.0 again
Message ID:
ip5cqvcu5qk1mc2e38ne7iv81bpljjrfe6@4ax.com
On Sun, 02 Nov 2003 21:43:44 -0800, Jan Dubois <jand@ActiveState.com> wrote:

>PS: Yes, I've noticed that I can optimize the 5.8.2 patch even further by
>moving the assignment to PL_reentrant_retint to the single case that needs
>it (already done in this patch).  I'll send another 5.8.2 patch later
>tonight...

Ok, patch attached.  It does 2 things:

* Changes prefix for wrapper functions from "S_my_" to "Perl_reentr_" because
  these names are visible to extension modules, and the "S_" names for statics
  should only be used for Perl internal functions.

* Only the /^get/ functions use PL_reentrant_retint, so only those need the
  complex redefinitions / wrappers.  This reduces the size of reentr.inc
  significantly.

This patch does *not* include the changed reentr.inc.  You have to run reentr.pl
to regenerate it.

Cheers,
-Jan

Index: reentr.pl
--- reentr.pl.~1~	Mon Nov  3 00:51:40 2003
+++ reentr.pl	Mon Nov  3 00:51:40 2003
@@ -692,29 +692,21 @@
 #       define $func($v) $call
 EOF
 	    } else {
-		$call = "((PL_REENTRANT_RETINT = $call))" if $r eq 'I' && $func ne 'random';
 		if ($func =~ /^get/) {
 		    my $rv = $v ? ", $v" : "";
 		    if ($r eq 'I') {
-			$call = qq[($call$test ? $true : (((PL_REENTRANT_RETINT == ERANGE) || (errno == ERANGE)) ? Perl_reentrant_retry("$func"$rv) : 0))];
-		    } else {
-			$call = qq[($call$test ? $true : ((errno == ERANGE) ? Perl_reentrant_retry("$func"$rv) : 0))];
-                    }
-		} else {
-		    $call = qq[($call$test ? $true : 0)];
-		}
-
-		my $arg = join(", ", map { $seenm{$func}{substr($a,$_,1)}." ".$v[$_] } 0..$seenu{$func}-1);
-		my $ret = $seenr{$func} eq 'V' ? "" : "return ";
-		push @wrap, <<EOF;
+			$call = qq[((PL_REENTRANT_RETINT = $call)$test ? $true : (((PL_REENTRANT_RETINT == ERANGE) || (errno == ERANGE)) ? Perl_reentrant_retry("$func"$rv) : 0))];
+			my $arg = join(", ", map { $seenm{$func}{substr($a,$_,1)}." ".$v[$_] } 0..$seenu{$func}-1);
+			my $ret = $seenr{$func} eq 'V' ? "" : "return ";
+			push @wrap, <<EOF;
 #       ifdef PERL_CORE
 #           define $func($v) $call
 #       else
 #           if defined(__GNUC__) && !defined(__STRICT_ANSI__) && !defined(PERL_GCC_PEDANTIC)
 #               define $func($v) ({int PL_REENTRANT_RETINT; $call;})
 #           else
-#               define $func($v) S_my_$func($v)
-                static $seenm{$func}{$seenr{$func}} S_my_$func($arg) {
+#               define $func($v) Perl_reentr_$func($v)
+                static $seenm{$func}{$seenr{$func}} Perl_reentr_$func($arg) {
                     dTHX;
                     int PL_REENTRANT_RETINT;
                     $ret$call;
@@ -722,6 +714,16 @@
 #           endif
 #       endif
 EOF
+		    } else {
+			push @wrap, <<EOF;
+#       define $func($v) ($call$test ? $true : ((errno == ERANGE) ? Perl_reentrant_retry("$func"$rv) : 0))
+EOF
+                    }
+		} else {
+	        push @wrap, <<EOF;
+#       define $func($v) ($call$test ? $true : 0)
+EOF
+		}
 	    }
 	    push @wrap, <<EOF;
 #   endif
End of Patch.


Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About