perl 4.0 patch 14: patch #11, continued
[p5sagit/p5-mst-13.2.git] / array.c
diff --git a/array.c b/array.c
index aff66ca..e2561d7 100644 (file)
--- a/array.c
+++ b/array.c
@@ -1,22 +1,16 @@
-/* $Header: array.c,v 3.0.1.3 90/10/15 14:56:17 lwall Locked $
+/* $RCSfile: array.c,v $$Revision: 4.0.1.1 $$Date: 91/06/07 10:19:08 $
  *
- *    Copyright (c) 1989, Larry Wall
+ *    Copyright (c) 1991, Larry Wall
  *
- *    You may distribute under the terms of the GNU General Public License
- *    as specified in the README file that comes with the perl 3.0 kit.
+ *    You may distribute under the terms of either the GNU General Public
+ *    License or the Artistic License, as specified in the README file.
  *
  * $Log:       array.c,v $
- * Revision 3.0.1.3  90/10/15  14:56:17  lwall
- * patch29: non-existent array values no longer cause core dumps
+ * Revision 4.0.1.1  91/06/07  10:19:08  lwall
+ * patch4: new copyright notice
  * 
- * Revision 3.0.1.2  90/08/13  21:52:20  lwall
- * patch28: defined(@array) and defined(%array) didn't work right
- * 
- * Revision 3.0.1.1  89/11/17  15:02:52  lwall
- * patch5: nested foreach on same array didn't work
- * 
- * Revision 3.0  89/10/18  15:08:33  lwall
- * 3.0 baseline
+ * Revision 4.0  91/03/20  01:03:32  lwall
+ * 4.0 baseline.
  * 
  */
 
@@ -36,7 +30,7 @@ int lval;
            if (ar->ary_flags & ARF_REAL)
                str = Str_new(5,0);
            else
-               str = str_static(&str_undef);
+               str = str_mortal(&str_undef);
            (void)astore(ar,key,str);
            return str;
        }
@@ -126,8 +120,8 @@ STAB *stab;
 ARRAY *
 afake(stab,size,strp)
 STAB *stab;
-int size;
-STR **strp;
+register int size;
+register STR **strp;
 {
     register ARRAY *ar;
 
@@ -140,6 +134,9 @@ STR **strp;
     ar->ary_fill = size - 1;
     ar->ary_max = size - 1;
     ar->ary_flags = 0;
+    while (size--) {
+       (*strp++)->str_pok &= ~SP_TEMP;
+    }
     return ar;
 }
 
@@ -222,8 +219,14 @@ register int num;
        (void)astore(ar,ar->ary_fill+num,(STR*)0);      /* maybe extend array */
        dstr = ar->ary_array + ar->ary_fill;
        sstr = dstr - num;
+#ifdef BUGGY_MSC5
+ # pragma loop_opt(off)        /* don't loop-optimize the following code */
+#endif /* BUGGY_MSC5 */
        for (i = ar->ary_fill; i >= 0; i--) {
            *dstr-- = *sstr--;
+#ifdef BUGGY_MSC5
+ # pragma loop_opt()   /* loop-optimization back to command-line setting */
+#endif /* BUGGY_MSC5 */
        }
        Zero(ar->ary_array, num, STR*);
     }