From: Gisle Aas Date: Wed, 4 Jan 2006 10:44:48 +0000 (+0000) Subject: Introduce STR_WITH_LEN macro in the form suggested by Chip. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2efa8cc776fec30c63893949ea1f5a5eb0cd3564;p=p5sagit%2Fp5-mst-13.2.git Introduce STR_WITH_LEN macro in the form suggested by Chip. p4raw-id: //depot/perl@26635 --- diff --git a/handy.h b/handy.h index 6c87f91..b587ea5 100644 --- a/handy.h +++ b/handy.h @@ -236,6 +236,9 @@ typedef U64TYPE U64; #define Ctl(ch) ((ch) & 037) +/* concatenating with "" ensures that only literal strings are accepted as agument */ +#define STR_WITH_LEN(s) (s ""), (sizeof(s)-1) + /* =head1 Miscellaneous Functions diff --git a/toke.c b/toke.c index 6a454ca..35d2639 100644 --- a/toke.c +++ b/toke.c @@ -460,7 +460,7 @@ S_missingterm(pTHX_ char *s) #define FEATURE_IS_ENABLED(name) \ ((0 != (PL_hints & HINT_LOCALIZE_HH)) \ - && feature_is_enabled((name ""), sizeof(name)-1)) + && feature_is_enabled(STR_WITH_LEN(name))) /* * S_feature_is_enabled * Check whether the named feature is enabled.