From: Nicholas Clark Date: Fri, 28 May 2010 13:53:04 +0000 (+0100) Subject: Add C_ARRAY_END(), returning a pointer to after the last element of an array. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd431fdedf8dec69c65efa7edc1d60005800919a;p=p5sagit%2Fp5-mst-13.2.git Add C_ARRAY_END(), returning a pointer to after the last element of an array. Refactor the macro append_flags() in dump.c to use it. --- diff --git a/dump.c b/dump.c index aaeb344..89ee269 100644 --- a/dump.c +++ b/dump.c @@ -84,7 +84,7 @@ S_append_flags(pTHX_ SV *sv, U32 flags, const struct flag_to_name *start, } #define append_flags(sv, f, flags) \ - S_append_flags(aTHX_ (sv), (f), (flags), (flags) + C_ARRAY_LENGTH(flags)) + S_append_flags(aTHX_ (sv), (f), (flags), C_ARRAY_END(flags)) #define Sequence PL_op_sequence diff --git a/handy.h b/handy.h index d17b8d3..3d2d46a 100644 --- a/handy.h +++ b/handy.h @@ -916,6 +916,7 @@ void Perl_mem_log_del_sv(const SV *sv, const char *filename, const int linenumbe #endif #define C_ARRAY_LENGTH(a) (sizeof(a)/sizeof((a)[0])) +#define C_ARRAY_END(a) (a) + (sizeof(a)/sizeof((a)[0])) #ifdef NEED_VA_COPY # ifdef va_copy