develooper Front page | perl.perl5.changes | Postings from April 2008

Change 33706: Perl_gv_fetchmethod{,_autoload,_flags} are actually never* called with

From:
Nicholas Clark
Date:
April 17, 2008 06:00
Subject:
Change 33706: Perl_gv_fetchmethod{,_autoload,_flags} are actually never* called with
Change 33706 by nicholas@mouse-mill on 2008/04/17 12:47:39

	Perl_gv_fetchmethod{,_autoload,_flags} are actually never* called with
	a non-NULL stash. So change the parameter to NN.
	* Fixed the one really obscure hitherto untested case.

Affected files ...

... //depot/perl/embed.fnc#613 edit
... //depot/perl/gv.c#396 edit
... //depot/perl/pp_sys.c#558 edit
... //depot/perl/proto.h#947 edit

Differences ...

==== //depot/perl/embed.fnc#613 (text) ====
Index: perl/embed.fnc
--- perl/embed.fnc#612~33702~	2008-04-17 00:58:29.000000000 -0700
+++ perl/embed.fnc	2008-04-17 05:47:39.000000000 -0700
@@ -297,9 +297,10 @@
 				|const U32 flags
 Apd	|GV*	|gv_fetchmeth	|NULLOK HV* stash|NN const char* name|STRLEN len|I32 level
 Apd	|GV*	|gv_fetchmeth_autoload	|NULLOK HV* stash|NN const char* name|STRLEN len|I32 level
-Apdmb	|GV*	|gv_fetchmethod	|NULLOK HV* stash|NN const char* name
-Apd	|GV*	|gv_fetchmethod_autoload|NULLOK HV* stash|NN const char* name|I32 autoload
-ApdM	|GV*	|gv_fetchmethod_flags|NULLOK HV* stash|NN const char* name \
+Apdmb	|GV*	|gv_fetchmethod	|NN HV* stash|NN const char* name
+Apd	|GV*	|gv_fetchmethod_autoload|NN HV* stash|NN const char* name \
+				|I32 autoload
+ApdM	|GV*	|gv_fetchmethod_flags|NN HV* stash|NN const char* name \
 				|U32 flags
 Ap	|GV*	|gv_fetchpv	|NN const char *nambeg|I32 add|const svtype sv_type
 Ap	|void	|gv_fullname	|NN SV* sv|NN const GV* gv

==== //depot/perl/gv.c#396 (text) ====
Index: perl/gv.c
--- perl/gv.c#395~33704~	2008-04-17 03:03:04.000000000 -0700
+++ perl/gv.c	2008-04-17 05:47:39.000000000 -0700
@@ -622,7 +622,7 @@
 
     PERL_ARGS_ASSERT_GV_FETCHMETHOD_AUTOLOAD;
 
-    if (stash && SvTYPE(stash) < SVt_PVHV)
+    if (SvTYPE(stash) < SVt_PVHV)
 	stash = NULL;
 
     for (nend = name; *nend; nend++) {

==== //depot/perl/pp_sys.c#558 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c#557~33639~	2008-04-03 08:41:26.000000000 -0700
+++ perl/pp_sys.c	2008-04-17 05:47:39.000000000 -0700
@@ -942,7 +942,7 @@
 	PUTBACK;
 	require_pv("AnyDBM_File.pm");
 	SPAGAIN;
-	if (!(gv = gv_fetchmethod(stash, "TIEHASH")))
+	if (!stash || !(gv = gv_fetchmethod(stash, "TIEHASH")))
 	    DIE(aTHX_ "No dbm on this machine");
     }
 

==== //depot/perl/proto.h#947 (text+w) ====
Index: perl/proto.h
--- perl/proto.h#946~33702~	2008-04-17 00:58:29.000000000 -0700
+++ perl/proto.h	2008-04-17 05:47:39.000000000 -0700
@@ -894,19 +894,22 @@
 	assert(name)
 
 /* PERL_CALLCONV GV*	Perl_gv_fetchmethod(pTHX_ HV* stash, const char* name)
+			__attribute__nonnull__(pTHX_1)
 			__attribute__nonnull__(pTHX_2); */
 #define PERL_ARGS_ASSERT_GV_FETCHMETHOD	\
-	assert(name)
+	assert(stash); assert(name)
 
 PERL_CALLCONV GV*	Perl_gv_fetchmethod_autoload(pTHX_ HV* stash, const char* name, I32 autoload)
+			__attribute__nonnull__(pTHX_1)
 			__attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_GV_FETCHMETHOD_AUTOLOAD	\
-	assert(name)
+	assert(stash); assert(name)
 
 PERL_CALLCONV GV*	Perl_gv_fetchmethod_flags(pTHX_ HV* stash, const char* name, U32 flags)
+			__attribute__nonnull__(pTHX_1)
 			__attribute__nonnull__(pTHX_2);
 #define PERL_ARGS_ASSERT_GV_FETCHMETHOD_FLAGS	\
-	assert(name)
+	assert(stash); assert(name)
 
 PERL_CALLCONV GV*	Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, const svtype sv_type)
 			__attribute__nonnull__(pTHX_1);
End of Patch.



Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About