From c229b64cfdf63c0671f41130fa3b2bb15dbf9779 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sun, 27 Feb 2011 17:51:33 -0700 Subject: [PATCH] regcomp.c: Add fcn add_cp_to_invlist() This is just an inline shorthand when a single code point is all that is needed. A macro could have been used instead, but this just seemed nicer. --- embed.fnc | 1 + embed.h | 1 + proto.h | 3 +++ regcomp.c | 5 +++++ 4 files changed, 10 insertions(+) diff --git a/embed.fnc b/embed.fnc index 1a18a3a..eb915ef 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1301,6 +1301,7 @@ EXMpR |HV* |_new_invlist |IV initial_size EXMpR |HV* |_swash_to_invlist |NN SV* const swash EXMp |void |_append_range_to_invlist |NN HV* const invlist|const UV start|const UV end #ifdef PERL_IN_REGCOMP_C +EiMR |HV* |add_cp_to_invlist |NULLOK HV* invlist|const UV cp EsMR |HV* |add_range_to_invlist |NULLOK HV* invlist|const UV start|const UV end EiMR |UV* |invlist_array |NN HV* const invlist EiM |void |invlist_destroy |NN HV* const invlist diff --git a/embed.h b/embed.h index 6aa7eb5..d334542 100644 --- a/embed.h +++ b/embed.h @@ -867,6 +867,7 @@ # endif # if defined(PERL_IN_REGCOMP_C) #define add_alternate(a,b,c) S_add_alternate(aTHX_ a,b,c) +#define add_cp_to_invlist(a,b) S_add_cp_to_invlist(aTHX_ a,b) #define add_data S_add_data #define add_range_to_invlist(a,b,c) S_add_range_to_invlist(aTHX_ a,b,c) #define checkposixcc(a) S_checkposixcc(aTHX_ a) diff --git a/proto.h b/proto.h index 2faf6d5..92e1ad3 100644 --- a/proto.h +++ b/proto.h @@ -5960,6 +5960,9 @@ STATIC void S_add_alternate(pTHX_ AV** alternate_ptr, U8* string, STRLEN len) #define PERL_ARGS_ASSERT_ADD_ALTERNATE \ assert(alternate_ptr); assert(string) +PERL_STATIC_INLINE HV* S_add_cp_to_invlist(pTHX_ HV* invlist, const UV cp) + __attribute__warn_unused_result__; + STATIC U32 S_add_data(struct RExC_state_t *pRExC_state, U32 n, const char *s) __attribute__warn_unused_result__ __attribute__nonnull__(1) diff --git a/regcomp.c b/regcomp.c index 4e9a098..c4673ec 100644 --- a/regcomp.c +++ b/regcomp.c @@ -6294,6 +6294,11 @@ S_add_range_to_invlist(pTHX_ HV* invlist, const UV start, const UV end) return added_invlist; } +PERL_STATIC_INLINE HV* +S_add_cp_to_invlist(pTHX_ HV* invlist, const UV cp) { + return add_range_to_invlist(invlist, cp, cp); +} + /* End of inversion list object */ /* -- 2.7.4