From: Gisle Aas Date: Wed, 4 Jan 2006 16:42:03 +0000 (+0000) Subject: Move all the xxxpvs() macros to handy.h. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ba3a79e7bc1290494bbec9ddd2cd46b87300eb54;p=p5sagit%2Fp5-mst-13.2.git Move all the xxxpvs() macros to handy.h. This brings them closer to STR_WITH_LEN. Besides only half of them were sv-related after change 26649. p4raw-id: //depot/perl@26650 --- diff --git a/handy.h b/handy.h index 5bcbe05..4fc2b88 100644 --- a/handy.h +++ b/handy.h @@ -239,6 +239,18 @@ typedef U64TYPE U64; /* concatenating with "" ensures that only literal strings are accepted as argument */ #define STR_WITH_LEN(s) (s ""), (sizeof(s)-1) +/* note that STR_WITH_LEN() can't be used as argument to macros or functions that + * under some configurations might be macros, which means that it requires the full + * Perl_xxx(aTHX_ ...) form for any API calls where it's used. + */ + +/* STR_WITH_LEN() shortcuts */ +#define newSVpvs(str) Perl_newSVpvn(aTHX_ STR_WITH_LEN(str)) +#define newSVpvs_share(str) Perl_newSVpvn_share(aTHX_ STR_WITH_LEN(str), 0) +#define sv_catpvs(sv, str) Perl_sv_catpvn_flags(aTHX_ sv, STR_WITH_LEN(str), SV_GMAGIC) +#define savepvs(str) Perl_savepvn(aTHX_ STR_WITH_LEN(str)) +#define gv_stashpvs(str, create) Perl_gv_stashpvn(aTHX_ STR_WITH_LEN(str), create) + /* =head1 Miscellaneous Functions diff --git a/sv.h b/sv.h index 890166f..b5aeac8 100644 --- a/sv.h +++ b/sv.h @@ -1425,12 +1425,6 @@ Like C but doesn't process magic. #define sv_2iv(sv) sv_2iv_flags(sv, SV_GMAGIC) #define sv_2uv(sv) sv_2uv_flags(sv, SV_GMAGIC) -#define newSVpvs(str) Perl_newSVpvn(aTHX_ STR_WITH_LEN(str)) -#define newSVpvs_share(str) Perl_newSVpvn_share(aTHX_ STR_WITH_LEN(str), 0) -#define sv_catpvs(sv, str) Perl_sv_catpvn_flags(aTHX_ sv, STR_WITH_LEN(str), SV_GMAGIC) -#define savepvs(str) Perl_savepvn(aTHX_ STR_WITH_LEN(str)) -#define gv_stashpvs(str, create) Perl_gv_stashpvn(aTHX_ STR_WITH_LEN(str), create) - /* Should be named SvCatPVN_utf8_upgrade? */ #define sv_catpvn_utf8_upgrade(dsv, sstr, slen, nsv) \ STMT_START { \