X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=av.h;h=8de81f42e42418f8e46a956bcb87ee2dee83b9ac;hb=b174585de5ccc9973ba572393b2b34e1a6a5b749;hp=56b6e325d0cf64d3d22ab7771fd71f5e0fcf85e8;hpb=0a5de7f065f979dd72caec4a4531f4f7c4734c83;p=p5sagit%2Fp5-mst-13.2.git diff --git a/av.h b/av.h index 56b6e32..8de81f4 100644 --- a/av.h +++ b/av.h @@ -1,6 +1,6 @@ /* av.h * - * Copyright (c) 1991-1994, 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. @@ -8,15 +8,15 @@ */ struct xpvav { - char* xav_array; /* pointer to malloced string */ - SSize_t xav_fill; - SSize_t xav_max; + char* xav_array; /* pointer to first array element */ + 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 */ HV* xmg_stash; /* class package */ - SV** xav_alloc; + SV** xav_alloc; /* pointer to malloced string */ SV* xav_arylen; U8 xav_flags; }; @@ -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,7 @@ 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))