From: Nicholas Clark Date: Sat, 29 Oct 2005 16:25:38 +0000 (+0000) Subject: sv_2pv_nolen, sv_2pvbyte_nolen and sv_2pvutf8_nolen can all be replaced X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cb2f1b7b22aef64f26e7bd5484244a0df0c94631;p=p5sagit%2Fp5-mst-13.2.git sv_2pv_nolen, sv_2pvbyte_nolen and sv_2pvutf8_nolen can all be replaced with terse macros, and the function bodies retired. p4raw-id: //depot/perl@25883 --- diff --git a/embed.fnc b/embed.fnc index fbc98f1..da2704a 100644 --- a/embed.fnc +++ b/embed.fnc @@ -931,9 +931,9 @@ Ap |void |do_sv_dump |I32 level|NN PerlIO *file|NULLOK SV *sv|I32 nest \ |I32 maxnest|bool dumpops|STRLEN pvlim Ap |void |magic_dump |NULLOK const MAGIC *mg Ap |void |reginitcolors -ApdR |char* |sv_2pv_nolen |NN SV* sv -ApdR |char* |sv_2pvutf8_nolen|NN SV* sv -ApdR |char* |sv_2pvbyte_nolen|NN SV* sv +ApdRmb |char* |sv_2pv_nolen |NN SV* sv +ApdRmb |char* |sv_2pvutf8_nolen|NN SV* sv +ApdRmb |char* |sv_2pvbyte_nolen|NN SV* sv AmdbR |char* |sv_pv |NN SV *sv AmdbR |char* |sv_pvutf8 |NN SV *sv AmdbR |char* |sv_pvbyte |NN SV *sv diff --git a/embed.h b/embed.h index 744d1c1..e41c68a 100644 --- a/embed.h +++ b/embed.h @@ -967,9 +967,6 @@ #define do_sv_dump Perl_do_sv_dump #define magic_dump Perl_magic_dump #define reginitcolors Perl_reginitcolors -#define sv_2pv_nolen Perl_sv_2pv_nolen -#define sv_2pvutf8_nolen Perl_sv_2pvutf8_nolen -#define sv_2pvbyte_nolen Perl_sv_2pvbyte_nolen #define sv_utf8_downgrade Perl_sv_utf8_downgrade #define sv_utf8_encode Perl_sv_utf8_encode #define sv_utf8_decode Perl_sv_utf8_decode @@ -2953,9 +2950,6 @@ #define do_sv_dump(a,b,c,d,e,f,g) Perl_do_sv_dump(aTHX_ a,b,c,d,e,f,g) #define magic_dump(a) Perl_magic_dump(aTHX_ a) #define reginitcolors() Perl_reginitcolors(aTHX) -#define sv_2pv_nolen(a) Perl_sv_2pv_nolen(aTHX_ a) -#define sv_2pvutf8_nolen(a) Perl_sv_2pvutf8_nolen(aTHX_ a) -#define sv_2pvbyte_nolen(a) Perl_sv_2pvbyte_nolen(aTHX_ a) #define sv_utf8_downgrade(a,b) Perl_sv_utf8_downgrade(aTHX_ a,b) #define sv_utf8_encode(a) Perl_sv_utf8_encode(aTHX_ a) #define sv_utf8_decode(a) Perl_sv_utf8_decode(aTHX_ a) diff --git a/mathoms.c b/mathoms.c index 29faf69..2eee3cb 100644 --- a/mathoms.c +++ b/mathoms.c @@ -97,6 +97,54 @@ Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp) } /* +=for apidoc sv_2pv_nolen + +Like C, but doesn't return the length too. You should usually +use the macro wrapper C instead. +=cut +*/ + +char * +Perl_sv_2pv_nolen(pTHX_ register SV *sv) +{ + return sv_2pv(sv, 0); +} + +/* +=for apidoc sv_2pvbyte_nolen + +Return a pointer to the byte-encoded representation of the SV. +May cause the SV to be downgraded from UTF-8 as a side-effect. + +Usually accessed via the C macro. + +=cut +*/ + +char * +Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv) +{ + return sv_2pvbyte(sv, 0); +} + +/* +=for apidoc sv_2pvutf8_nolen + +Return a pointer to the UTF-8-encoded representation of the SV. +May cause the SV to be upgraded to UTF-8 as a side-effect. + +Usually accessed via the C macro. + +=cut +*/ + +char * +Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv) +{ + return sv_2pvutf8(sv, 0); +} + +/* =for apidoc sv_force_normal Undo various types of fakery on an SV: if the PV is a shared string, make diff --git a/proto.h b/proto.h index 82d35ef..a932e61 100644 --- a/proto.h +++ b/proto.h @@ -2594,17 +2594,17 @@ PERL_CALLCONV void Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 ne PERL_CALLCONV void Perl_magic_dump(pTHX_ const MAGIC *mg); PERL_CALLCONV void Perl_reginitcolors(pTHX); -PERL_CALLCONV char* Perl_sv_2pv_nolen(pTHX_ SV* sv) +/* PERL_CALLCONV char* Perl_sv_2pv_nolen(pTHX_ SV* sv) __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); + __attribute__nonnull__(pTHX_1); */ -PERL_CALLCONV char* Perl_sv_2pvutf8_nolen(pTHX_ SV* sv) +/* PERL_CALLCONV char* Perl_sv_2pvutf8_nolen(pTHX_ SV* sv) __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); + __attribute__nonnull__(pTHX_1); */ -PERL_CALLCONV char* Perl_sv_2pvbyte_nolen(pTHX_ SV* sv) +/* PERL_CALLCONV char* Perl_sv_2pvbyte_nolen(pTHX_ SV* sv) __attribute__warn_unused_result__ - __attribute__nonnull__(pTHX_1); + __attribute__nonnull__(pTHX_1); */ /* PERL_CALLCONV char* sv_pv(pTHX_ SV *sv) __attribute__warn_unused_result__ diff --git a/sv.c b/sv.c index b10ea25..1169249 100644 --- a/sv.c +++ b/sv.c @@ -2901,20 +2901,6 @@ S_asUV(pTHX_ SV *sv) return U_V(Atof(SvPVX_const(sv))); } -/* -=for apidoc sv_2pv_nolen - -Like C, but doesn't return the length too. You should usually -use the macro wrapper C instead. -=cut -*/ - -char * -Perl_sv_2pv_nolen(pTHX_ register SV *sv) -{ - return sv_2pv(sv, 0); -} - /* uiv_2buf(): private routine for use by sv_2pv_flags(): print an IV or * UV as a string towards the end of buf, and return pointers to start and * end of it. @@ -3318,23 +3304,6 @@ Perl_sv_copypv(pTHX_ SV *dsv, register SV *ssv) } /* -=for apidoc sv_2pvbyte_nolen - -Return a pointer to the byte-encoded representation of the SV. -May cause the SV to be downgraded from UTF-8 as a side-effect. - -Usually accessed via the C macro. - -=cut -*/ - -char * -Perl_sv_2pvbyte_nolen(pTHX_ register SV *sv) -{ - return sv_2pvbyte(sv, 0); -} - -/* =for apidoc sv_2pvbyte Return a pointer to the byte-encoded representation of the SV, and set *lp @@ -3354,23 +3323,6 @@ Perl_sv_2pvbyte(pTHX_ register SV *sv, STRLEN *lp) } /* -=for apidoc sv_2pvutf8_nolen - -Return a pointer to the UTF-8-encoded representation of the SV. -May cause the SV to be upgraded to UTF-8 as a side-effect. - -Usually accessed via the C macro. - -=cut -*/ - -char * -Perl_sv_2pvutf8_nolen(pTHX_ register SV *sv) -{ - return sv_2pvutf8(sv, 0); -} - -/* * =for apidoc sv_2pvutf8 * * Return a pointer to the UTF-8-encoded representation of the SV, and set *lp diff --git a/sv.h b/sv.h index 2dc1d8c..2fad32a 100644 --- a/sv.h +++ b/sv.h @@ -1393,6 +1393,9 @@ Like C but doesn't process magic. #define sv_catsv_nomg(dsv, ssv) sv_catsv_flags(dsv, ssv, 0) #define sv_catpvn(dsv, sstr, slen) sv_catpvn_flags(dsv, sstr, slen, SV_GMAGIC) #define sv_2pv(sv, lp) sv_2pv_flags(sv, lp, SV_GMAGIC) +#define sv_2pv_nolen(sv) sv_2pv(sv, 0) +#define sv_2pvbyte_nolen(sv) sv_2pvbyte(sv, 0) +#define sv_2pvutf8_nolen(sv) sv_2pvutf8(sv, 0) #define sv_2pv_nomg(sv, lp) sv_2pv_flags(sv, lp, 0) #define sv_pvn_force(sv, lp) sv_pvn_force_flags(sv, lp, SV_GMAGIC) #define sv_utf8_upgrade(sv) sv_utf8_upgrade_flags(sv, SV_GMAGIC)