mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 08:38:23 +00:00
Move prototype definition of SvPV_helper to embed.fnc
It's usually a bad idea to try to work around a limitation in common code by copy-pasting and then modifiying to taste. Fixes/improvements to the common code rarely get propagated to the outlier. I wrote code in 1ef9039bccb that did just this for the prototype definition of SvPV_helper, because the place where it really belongs, embed.fnc, couldn't (and still doesn't) handle function pointers as arguments (patches welcome). I should have at least added a comment to the common code noting the existence of this outlier. It turns out that that limitation can be worked around by declaring a typedef of the pointer, and then using that in embed.fnc. That's what this commit does. This commit removes the final instance of duplicating the work of embed.fnc in the core, except for some in the regex system whose comments say the reason is to avoid making a typedef public. I haven't investigated these further.
This commit is contained in:
parent
4610cbfdb6
commit
8444d54d4b
@ -3374,6 +3374,13 @@ CRdmp |char * |sv_2pvbyte_nolen \
|
||||
Adp |char * |sv_2pv_flags |NN SV * const sv \
|
||||
|NULLOK STRLEN * const lp \
|
||||
|const U32 flags
|
||||
Cip |char * |SvPV_helper |NN SV * const sv \
|
||||
|NN STRLEN * const lp \
|
||||
|const U32 flags \
|
||||
|const PL_SvPVtype type \
|
||||
|NN Perl_SvPV_helper_non_trivial_t non_trivial \
|
||||
|const bool or_null \
|
||||
|const U32 return_flags
|
||||
Cdmp |char * |sv_pvn_force |NN SV *sv \
|
||||
|NULLOK STRLEN *lp
|
||||
Adp |char * |sv_pvn_force_flags \
|
||||
|
||||
1
embed.h
1
embed.h
@ -109,6 +109,7 @@
|
||||
# define SvNV(a) Perl_SvNV(aTHX_ a)
|
||||
# define SvNV_nomg(a) Perl_SvNV_nomg(aTHX_ a)
|
||||
# define SvPVXtrue(a) Perl_SvPVXtrue(aTHX_ a)
|
||||
# define SvPV_helper(a,b,c,d,e,f,g) Perl_SvPV_helper(aTHX_ a,b,c,d,e,f,g)
|
||||
# define SvREFCNT_dec_ret_NULL(a) Perl_SvREFCNT_dec_ret_NULL(aTHX_ a)
|
||||
# define SvTRUE(a) Perl_SvTRUE(aTHX_ a)
|
||||
# define SvTRUE_NN(a) Perl_SvTRUE_NN(aTHX_ a)
|
||||
|
||||
5
proto.h
generated
5
proto.h
generated
@ -9781,6 +9781,11 @@ Perl_SvPVXtrue(pTHX_ SV *sv)
|
||||
# define PERL_ARGS_ASSERT_SVPVXTRUE \
|
||||
assert(sv)
|
||||
|
||||
PERL_STATIC_INLINE char *
|
||||
Perl_SvPV_helper(pTHX_ SV * const sv, STRLEN * const lp, const U32 flags, const PL_SvPVtype type, Perl_SvPV_helper_non_trivial_t non_trivial, const bool or_null, const U32 return_flags);
|
||||
# define PERL_ARGS_ASSERT_SVPV_HELPER \
|
||||
assert(sv); assert(lp); assert(non_trivial)
|
||||
|
||||
PERL_STATIC_INLINE void
|
||||
Perl_SvREFCNT_dec(pTHX_ SV *sv);
|
||||
# define PERL_ARGS_ASSERT_SVREFCNT_DEC
|
||||
|
||||
12
sv.h
12
sv.h
@ -1958,16 +1958,8 @@ typedef enum {
|
||||
SvPVbyte_pure_type_
|
||||
} PL_SvPVtype;
|
||||
|
||||
START_EXTERN_C
|
||||
|
||||
/* When this code was written, embed.fnc could not handle function pointer
|
||||
* parameters; perhaps it still can't */
|
||||
#ifndef PERL_NO_INLINE_FUNCTIONS
|
||||
PERL_STATIC_INLINE char*
|
||||
Perl_SvPV_helper(pTHX_ SV *const sv, STRLEN *const lp, const U32 flags, const PL_SvPVtype type, char * (*non_trivial)(pTHX_ SV *, STRLEN * const, const U32), const bool or_null, const U32 return_flags);
|
||||
#endif
|
||||
|
||||
END_EXTERN_C
|
||||
typedef char * (*Perl_SvPV_helper_non_trivial_t)(pTHX_ SV *, STRLEN * const,
|
||||
const U32);
|
||||
|
||||
/* This test is "is there a cached PV that we can use directly?"
|
||||
* We can if
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user