regcomp.c: Add fcn add_cp_to_invlist()
authorKarl Williamson <public@khwilliamson.com>
Mon, 28 Feb 2011 00:51:33 +0000 (17:51 -0700)
committerKarl Williamson <public@khwilliamson.com>
Mon, 28 Feb 2011 02:21:32 +0000 (19:21 -0700)
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
embed.h
proto.h
regcomp.c

index 1a18a3a..eb915ef 100644 (file)
--- 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 (file)
--- a/embed.h
+++ b/embed.h
 #  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 (file)
--- 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)
index 4e9a098..c4673ec 100644 (file)
--- 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 */
 
 /*