summaryrefslogtreecommitdiff
path: root/av.h
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>1998-01-13 20:52:38 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>1998-01-13 20:52:38 +0000
commit93965878572d85daec78ce5ce1926f613d93803b (patch)
treeaec5117a48c78f3e9a90cdbc74ac94a96d1e18d5 /av.h
parent65d0515c139c3d74c5955ce897f62cd229f1bcce (diff)
downloadperl-93965878572d85daec78ce5ce1926f613d93803b.tar.gz
tie array changes to core and tests
p4raw-id: //depot/ansiperl@418
Diffstat (limited to 'av.h')
-rw-r--r--av.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/av.h b/av.h
index a8dc60b4cd..fd34cb0dbc 100644
--- a/av.h
+++ b/av.h
@@ -1,6 +1,6 @@
/* av.h
*
- * Copyright (c) 1991-1997, Larry Wall
+ * Copyright (c) 1991-1998, 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.
@@ -9,8 +9,8 @@
struct xpvav {
char* xav_array; /* pointer to first array element */
- SSize_t xav_fill;
- SSize_t xav_max;
+ SSize_t xav_fill; /* Index of last element present */
+ SSize_t xav_max; /* Number of elements for which array has space */
IV xof_off; /* ptr is incremented by offset */
double xnv_nv; /* numeric value, if any */
MAGIC* xmg_magic; /* magic for scalar array */
@@ -30,7 +30,7 @@ struct xpvav {
#define AvARRAY(av) ((SV**)((XPVAV*) SvANY(av))->xav_array)
#define AvALLOC(av) ((XPVAV*) SvANY(av))->xav_alloc
#define AvMAX(av) ((XPVAV*) SvANY(av))->xav_max
-#define AvFILL(av) ((XPVAV*) SvANY(av))->xav_fill
+#define AvFILLp(av) ((XPVAV*) SvANY(av))->xav_fill
#define AvARYLEN(av) ((XPVAV*) SvANY(av))->xav_arylen
#define AvFLAGS(av) ((XPVAV*) SvANY(av))->xav_flags
@@ -45,4 +45,8 @@ struct xpvav {
#define AvREUSED_off(av) (AvFLAGS(av) &= ~AVf_REUSED)
#define AvREALISH(av) (AvFLAGS(av) & (AVf_REAL|AVf_REIFY))
+
+#define AvFILL(av) ((SvRMAGICAL((SV *) (av))) \
+ ? mg_size((SV *) av) \
+ : AvFILLp(av))