summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authorLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1990-08-13 09:45:26 +0000
committerLarry Wall <lwall@jpl-devvax.jpl.nasa.gov>1990-08-13 09:45:26 +0000
commit6eb13c3b624098fc688ac86672bc30e26cbf8fd4 (patch)
tree13f2a8c28c0c79a68f94d0a2c6d852b0ad86f1b9 /array.c
parent62b28dd9eb2541847d5ce270cb7493fed626d1ef (diff)
downloadperl-6eb13c3b624098fc688ac86672bc30e26cbf8fd4.tar.gz
perl 3.0 patch #28 (combined patch)
Certain systems, notable Ultrix, set the close-on-exec flag by default on dup'ed file descriptors. This is anti-social when you're creating a new STDOUT. The flag is now forced off for STDIN, STDOUT and STDERR. Some yaccs report 29 shift/reduce conflicts and 59 reduce/reduce conflicts, while other yaccs and bison report 27 and 61. The Makefile now says to expect either thing. I'm not sure if there's a bug lurking there somewhere. The defined(@array) and defined(%array) ended up defining the arrays they were trying to determine the status of. Oops. Using the status of NSIG to determine whether <signal.h> had been included didn't work right on Xenix. A fix seems to be beyond Configure at the moment, so we've got some OS dependent #ifdefs in there. There were some syntax errors in the new code to determine whether it is safe to emulate rename() with unlink/link/unlink. Obviously heavily tested code... :-) Patch 27 introduced the possibility of using identifiers as unquoted strings, but the code to warn against the use of totally lowercase identifiers looped infinitely. I documented that you can't interpolate $) or $| in pattern. It was actually implied under s///, but it should have been more explicit. Patterns with {m} rather than {m,n} didn't work right. Tests io.fs and op.stat had difficulties under AFS. They now ignore the tests in question if they think they're running under /afs. The shift/reduce expectation message was off for a2p's Makefile.
Diffstat (limited to 'array.c')
-rw-r--r--array.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/array.c b/array.c
index e801f06428..5a1fcd4e58 100644
--- a/array.c
+++ b/array.c
@@ -1,4 +1,4 @@
-/* $Header: array.c,v 3.0.1.1 89/11/17 15:02:52 lwall Locked $
+/* $Header: array.c,v 3.0.1.2 90/08/13 21:52:20 lwall Locked $
*
* Copyright (c) 1989, Larry Wall
*
@@ -6,6 +6,9 @@
* as specified in the README file that comes with the perl 3.0 kit.
*
* $Log: array.c,v $
+ * 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
*
@@ -70,10 +73,16 @@ STR *val;
}
}
else {
- newmax = key + ar->ary_max / 5;
- resize:
- Renew(ar->ary_alloc,newmax+1, STR*);
- Zero(&ar->ary_alloc[ar->ary_max+1], newmax - ar->ary_max, STR*);
+ if (ar->ary_alloc) {
+ newmax = key + ar->ary_max / 5;
+ resize:
+ Renew(ar->ary_alloc,newmax+1, STR*);
+ Zero(&ar->ary_alloc[ar->ary_max+1], newmax - ar->ary_max, STR*);
+ }
+ else {
+ newmax = key < 4 ? 4 : key;
+ Newz(2,ar->ary_alloc, newmax+1, STR*);
+ }
ar->ary_array = ar->ary_alloc;
ar->ary_max = newmax;
}
@@ -100,12 +109,10 @@ STAB *stab;
register ARRAY *ar;
New(1,ar,1,ARRAY);
- Newz(2,ar->ary_alloc,5,STR*);
- ar->ary_array = ar->ary_alloc;
ar->ary_magic = Str_new(7,0);
+ ar->ary_alloc = ar->ary_array = 0;
str_magic(ar->ary_magic, stab, '#', Nullch, 0);
- ar->ary_fill = -1;
- ar->ary_max = 4;
+ ar->ary_max = ar->ary_fill = -1;
ar->ary_flags = ARF_REAL;
return ar;
}
@@ -136,7 +143,7 @@ register ARRAY *ar;
{
register int key;
- if (!ar || !(ar->ary_flags & ARF_REAL))
+ if (!ar || !(ar->ary_flags & ARF_REAL) || ar->ary_max < 0)
return;
if (key = ar->ary_array - ar->ary_alloc) {
ar->ary_max += key;