WinCE more implemented functions
[p5sagit/p5-mst-13.2.git] / perl.c
diff --git a/perl.c b/perl.c
index 0968e26..fb9fd20 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -181,6 +181,9 @@ perl_construct(pTHXx)
            SvNV(&PL_sv_yes);
            SvREADONLY_on(&PL_sv_yes);
            SvREFCNT(&PL_sv_yes) = (~(U32)0)/2;
+
+           SvREADONLY_on(&PL_sv_placeholder);
+           SvREFCNT(&PL_sv_placeholder) = (~(U32)0)/2;
        }
 
        PL_sighandlerp = Perl_sighandler;
@@ -783,6 +786,9 @@ perl_destruct(pTHXx)
     SvREFCNT(&PL_sv_undef) = 0;
     SvREADONLY_off(&PL_sv_undef);
 
+    SvREFCNT(&PL_sv_placeholder) = 0;
+    SvREADONLY_off(&PL_sv_placeholder);
+
     Safefree(PL_origfilename);
     Safefree(PL_reg_start_tmp);
     if (PL_reg_curpm)
@@ -929,7 +935,7 @@ setuid perl scripts securely.\n");
         * the area we are able to modify is limited to the size of
         * the original argv[0].  (See below for 'contiguous', though.)
         * --jhi */
-        char *s;
+        char *s = NULL;
         int i;
         UV mask =
           ~(UV)(PTRSIZE == 4 ? 3 : PTRSIZE == 8 ? 7 : PTRSIZE == 16 ? 15 : 0);
@@ -946,26 +952,27 @@ setuid perl scripts securely.\n");
          * PTRSIZE bytes.  As long as no system has something bizarre
          * like the argv[] interleaved with some other data, we are
          * fine.  (Did I just evoke Murphy's Law?)  --jhi */
-        s = PL_origargv[0];
-        while (*s) s++;
-        for (i = 1; i < PL_origargc; i++) {
-             if ((PL_origargv[i] == s + 1
+        if (PL_origargv && PL_origargc >= 1 && (s = PL_origargv[0])) {
+             while (*s) s++;
+             for (i = 1; i < PL_origargc; i++) {
+                  if ((PL_origargv[i] == s + 1
 #ifdef OS2
-                  || PL_origargv[i] == s + 2
+                       || PL_origargv[i] == s + 2
 #endif 
-                 )
-                 ||
-                 (aligned &&
-                  (PL_origargv[i] >  s &&
-                   PL_origargv[i] <=
-                   INT2PTR(char *, PTR2UV(s + PTRSIZE) & mask)))
-                )
-             {
-                  s = PL_origargv[i];
-                  while (*s) s++;
+                           )
+                      ||
+                      (aligned &&
+                       (PL_origargv[i] >  s &&
+                        PL_origargv[i] <=
+                        INT2PTR(char *, PTR2UV(s + PTRSIZE) & mask)))
+                       )
+                  {
+                       s = PL_origargv[i];
+                       while (*s) s++;
+                  }
+                  else
+                       break;
              }
-             else
-                  break;
         }
         /* Can we grab env area too to be used as the area for $0? */
         if (PL_origenviron) {
@@ -1658,7 +1665,7 @@ S_run_body(pTHX_ I32 oldscope)
 
     if (!PL_restartop) {
        DEBUG_x(dump_all());
-       DEBUG(PerlIO_printf(Perl_debug_log, "\nEXECUTING...\n\n"));
+       PERL_DEBUG(PerlIO_printf(Perl_debug_log, "\nEXECUTING...\n\n"));
        DEBUG_S(PerlIO_printf(Perl_debug_log, "main thread is 0x%"UVxf"\n",
                              PTR2UV(thr)));