regcomp.c old feature removal
[p5sagit/p5-mst-13.2.git] / util.c
diff --git a/util.c b/util.c
index d089df4..b163b05 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1,6 +1,6 @@
 /*    util.c
  *
- *    Copyright (c) 1991-2000, Larry Wall
+ *    Copyright (c) 1991-2001, Larry Wall
  *
  *    You may distribute under the terms of either the GNU General Public
  *    License or the Artistic License, as specified in the README file.
@@ -533,7 +533,7 @@ Perl_new_collate(pTHX_ char *newcoll)
 
     if (! newcoll) {
        if (PL_collation_name) {
-           PL_collation_ix++;
+           ++PL_collation_ix;
            Safefree(PL_collation_name);
            PL_collation_name = NULL;
        }
@@ -544,10 +544,9 @@ Perl_new_collate(pTHX_ char *newcoll)
     }
 
     if (! PL_collation_name || strNE(PL_collation_name, newcoll)) {
-       PL_collation_ix++;
-       if (PL_collation_name)
-           Safefree(PL_collation_name);
-       PL_collation_name = stdize_locale(newcoll);
+       ++PL_collation_ix;
+       Safefree(PL_collation_name);
+       PL_collation_name = stdize_locale(savepv(newcoll));
        PL_collation_standard = (strEQ(newcoll, "C") || strEQ(newcoll, "POSIX"));
 
        {
@@ -606,9 +605,8 @@ Perl_new_numeric(pTHX_ char *newnum)
     }
 
     if (! PL_numeric_name || strNE(PL_numeric_name, newnum)) {
-       if (PL_numeric_name)
-           Safefree(PL_numeric_name);
-       PL_numeric_name = stdize_locale(newnum);
+       Safefree(PL_numeric_name);
+       PL_numeric_name = stdize_locale(savepv(newnum));
        PL_numeric_standard = (strEQ(newnum, "C") || strEQ(newnum, "POSIX"));
        PL_numeric_local = TRUE;
        set_numeric_radix();
@@ -2457,8 +2455,12 @@ Perl_my_popen(pTHX_ char *cmd, char *mode)
        PerlLIO_close(pp[0]);
        did_pipes = 0;
        if (n) {                        /* Error */
+           int pid2, status;
            if (n != sizeof(int))
                Perl_croak(aTHX_ "panic: kid popen errno read");
+           do {
+               pid2 = wait4pid(pid, &status, 0);
+           } while (pid2 == -1 && errno == EINTR);
            errno = errkid;             /* Propagate errno from kid */
            return Nullfp;
        }
@@ -2661,7 +2663,7 @@ Perl_my_pclose(pTHX_ PerlIO *ptr)
     LOCK_FDPID_MUTEX;
     svp = av_fetch(PL_fdpid,PerlIO_fileno(ptr),TRUE);
     UNLOCK_FDPID_MUTEX;
-    pid = SvIVX(*svp);
+    pid = (SvTYPE(*svp) == SVt_IV) ? SvIVX(*svp) : -1;
     SvREFCNT_dec(*svp);
     *svp = &PL_sv_undef;
 #ifdef OS2
@@ -3643,9 +3645,9 @@ Perl_new_struct_thread(pTHX_ struct perl_thread *t)
     PL_tainted = t->Ttainted;
     PL_curpm = t->Tcurpm;         /* XXX No PMOP ref count */
     PL_nrs = newSVsv(t->Tnrs);
-    PL_rs = SvREFCNT_inc(PL_nrs);
+    PL_rs = t->Tnrs ? SvREFCNT_inc(PL_nrs) : Nullsv;
     PL_last_in_gv = Nullgv;
-    PL_ofs_sv = SvREFCNT_inc(PL_ofs_sv);
+    PL_ofs_sv = t->Tofs_sv ? SvREFCNT_inc(PL_ofs_sv) : Nullsv;
     PL_defoutgv = (GV*)SvREFCNT_inc(t->Tdefoutgv);
     PL_chopset = t->Tchopset;
     PL_bodytarget = newSVsv(t->Tbodytarget);