From: Nicholas Clark <nick@ccl4.org>
Date: Sun, 22 Feb 2009 22:17:47 +0000 (+0100)
Subject: For S_incpush(), dir is never NULL, and len is always > 0.
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08d0d8ab11be611f4baf746cfb6ff7791962f494;p=p5sagit%2Fp5-mst-13.2.git

For S_incpush(), dir is never NULL, and len is always > 0.
---

diff --git a/embed.fnc b/embed.fnc
index d6c5558..cae666c 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -1473,7 +1473,7 @@ s	|void	|Slab_to_rw	|NN void *op
 #if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT)
 s	|void	|find_beginning	|NN SV* linestr_sv|NN PerlIO *rsfp
 s	|void	|forbid_setid	|const char flag|const bool suidscript
-s	|void	|incpush	|NULLOK const char *const dir|STRLEN len \
+s	|void	|incpush	|NN const char *const dir|STRLEN len \
 				|U32 flags
 s	|void	|incpush_use_sep|NN const char *p|STRLEN len|U32 flags
 s	|void	|init_interp
diff --git a/perl.c b/perl.c
index 9f7c682..7f98351 100644
--- a/perl.c
+++ b/perl.c
@@ -4358,13 +4358,13 @@ S_incpush(pTHX_ const char *const dir, STRLEN len, U32 flags)
     const U8 canrelocate = (U8)flags & INCPUSH_CAN_RELOCATE;
     const U8 unshift     = (U8)flags & INCPUSH_UNSHIFT;
     const U8 push_basedir = (flags & INCPUSH_NOT_BASEDIR) ? 0 : 1;
-    AV *inc;
+    AV *const inc = GvAVn(PL_incgv);
 
-    if (!dir || !*dir)
-	return;
-
-    inc = GvAVn(PL_incgv);
+    PERL_ARGS_ASSERT_INCPUSH;
+    assert(len > 0);
 
+    /* Could remove this vestigial extra block, if we don't mind a lot of
+       re-indenting diff noise.  */
     {
 	SV *libdir;
 	/* Change 20189146be79a0596543441fa369c6bf7f85103f, to fix RT#6665,
diff --git a/proto.h b/proto.h
index 7945bde..f5cb2d2 100644
--- a/proto.h
+++ b/proto.h
@@ -4759,7 +4759,11 @@ STATIC void	S_find_beginning(pTHX_ SV* linestr_sv, PerlIO *rsfp)
 	assert(linestr_sv); assert(rsfp)
 
 STATIC void	S_forbid_setid(pTHX_ const char flag, const bool suidscript);
-STATIC void	S_incpush(pTHX_ const char *const dir, STRLEN len, U32 flags);
+STATIC void	S_incpush(pTHX_ const char *const dir, STRLEN len, U32 flags)
+			__attribute__nonnull__(pTHX_1);
+#define PERL_ARGS_ASSERT_INCPUSH	\
+	assert(dir)
+
 STATIC void	S_incpush_use_sep(pTHX_ const char *p, STRLEN len, U32 flags)
 			__attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_INCPUSH_USE_SEP	\