Skip to content

Commit

Permalink
Move inline fcn to #included file
Browse files Browse the repository at this point in the history
Future commits will want this function to be able to be used in more
than one core file.
  • Loading branch information
khwilliamson committed Jan 22, 2015
1 parent f5f6ef0 commit 551cedb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion embed.fnc
Original file line number Diff line number Diff line change
Expand Up @@ -1513,7 +1513,6 @@ Ap |UV |swash_fetch |NN SV *swash|NN const U8 *ptr|bool do_utf8
EiMR |SV* |add_cp_to_invlist |NULLOK SV* invlist|const UV cp
EsM |void |_append_range_to_invlist |NN SV* const invlist|const UV start|const UV end
EiMRn |UV* |_invlist_array_init |NN SV* const invlist|const bool will_have_0
EiMRn |UV* |invlist_array |NN SV* const invlist
EsM |void |invlist_extend |NN SV* const invlist|const UV len
EiMRn |UV |invlist_max |NN SV* const invlist
EiM |void |invlist_set_len|NN SV* const invlist|const UV len|const bool offset
Expand Down Expand Up @@ -1556,6 +1555,7 @@ EXp |SV* |_core_swash_init|NN const char* pkg|NN const char* name \
|NULLOK SV* invlist|NULLOK U8* const flags_p
#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C)
EiMRn |UV* |invlist_array |NN SV* const invlist
EXMpR |SV* |_invlist_contents|NN SV* const invlist
EiMRn |bool* |get_invlist_offset_addr|NN SV* invlist
EiMRn |UV |_invlist_len |NN SV* const invlist
Expand Down
2 changes: 1 addition & 1 deletion embed.h
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,6 @@
#define get_invlist_iter_addr S_get_invlist_iter_addr
#define grok_bslash_N(a,b,c,d,e,f) S_grok_bslash_N(aTHX_ a,b,c,d,e,f)
#define handle_regex_sets(a,b,c,d,e) S_handle_regex_sets(aTHX_ a,b,c,d,e)
#define invlist_array S_invlist_array
#define invlist_clone(a) S_invlist_clone(aTHX_ a)
#define invlist_extend(a,b) S_invlist_extend(aTHX_ a,b)
#define invlist_highest S_invlist_highest
Expand Down Expand Up @@ -1029,6 +1028,7 @@
#define _invlist_search Perl__invlist_search
#define _swash_inversion_hash(a) Perl__swash_inversion_hash(aTHX_ a)
#define get_invlist_offset_addr S_get_invlist_offset_addr
#define invlist_array S_invlist_array
# endif
# if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) || defined(PERL_IN_TOKE_C)
#define _core_swash_init(a,b,c,d,e,f,g) Perl__core_swash_init(aTHX_ a,b,c,d,e,f,g)
Expand Down
21 changes: 21 additions & 0 deletions inline_invlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,27 @@ S__invlist_contains_cp(SV* const invlist, const UV cp)
return index >= 0 && ELEMENT_RANGE_MATCHES_INVLIST(index);
}

PERL_STATIC_INLINE UV*
S_invlist_array(SV* const invlist)
{
/* Returns the pointer to the inversion list's array. Every time the
* length changes, this needs to be called in case malloc or realloc moved
* it */

PERL_ARGS_ASSERT_INVLIST_ARRAY;

/* Must not be empty. If these fail, you probably didn't check for <len>
* being non-zero before trying to get the array */
assert(_invlist_len(invlist));

/* The very first element always contains zero, The array begins either
* there, or if the inversion list is offset, at the element after it.
* The offset header field determines which; it contains 0 or 1 to indicate
* how much additionally to add */
assert(0 == *(SvPVX(invlist)));
return ((UV *) SvPVX(invlist) + *get_invlist_offset_addr(invlist));
}

# if defined(PERL_IN_UTF8_C) || defined(PERL_IN_REGEXEC_C)

/* These symbols are only needed later in regcomp.c */
Expand Down
12 changes: 6 additions & 6 deletions proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -6953,12 +6953,6 @@ STATIC regnode* S_handle_regex_sets(pTHX_ RExC_state_t *pRExC_state, SV ** retur
#define PERL_ARGS_ASSERT_HANDLE_REGEX_SETS \
assert(pRExC_state); assert(flagp); assert(oregcomp_parse)

PERL_STATIC_INLINE UV* S_invlist_array(SV* const invlist)
__attribute__warn_unused_result__
__attribute__nonnull__(1);
#define PERL_ARGS_ASSERT_INVLIST_ARRAY \
assert(invlist)

PERL_STATIC_INLINE SV* S_invlist_clone(pTHX_ SV* const invlist)
__attribute__warn_unused_result__
__attribute__nonnull__(pTHX_1);
Expand Down Expand Up @@ -7311,6 +7305,12 @@ PERL_STATIC_INLINE bool* S_get_invlist_offset_addr(SV* invlist)
#define PERL_ARGS_ASSERT_GET_INVLIST_OFFSET_ADDR \
assert(invlist)

PERL_STATIC_INLINE UV* S_invlist_array(SV* const invlist)
__attribute__warn_unused_result__
__attribute__nonnull__(1);
#define PERL_ARGS_ASSERT_INVLIST_ARRAY \
assert(invlist)

#endif
#if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) || defined(PERL_IN_TOKE_C)
PERL_CALLCONV SV* Perl__core_swash_init(pTHX_ const char* pkg, const char* name, SV* listsv, I32 minbits, I32 none, SV* invlist, U8* const flags_p)
Expand Down
21 changes: 0 additions & 21 deletions regcomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8009,27 +8009,6 @@ S__invlist_array_init(SV* const invlist, const bool will_have_0)
return zero_addr + *offset;
}

PERL_STATIC_INLINE UV*
S_invlist_array(SV* const invlist)
{
/* Returns the pointer to the inversion list's array. Every time the
* length changes, this needs to be called in case malloc or realloc moved
* it */

PERL_ARGS_ASSERT_INVLIST_ARRAY;

/* Must not be empty. If these fail, you probably didn't check for <len>
* being non-zero before trying to get the array */
assert(_invlist_len(invlist));

/* The very first element always contains zero, The array begins either
* there, or if the inversion list is offset, at the element after it.
* The offset header field determines which; it contains 0 or 1 to indicate
* how much additionally to add */
assert(0 == *(SvPVX(invlist)));
return ((UV *) SvPVX(invlist) + *get_invlist_offset_addr(invlist));
}

PERL_STATIC_INLINE void
S_invlist_set_len(pTHX_ SV* const invlist, const UV len, const bool offset)
{
Expand Down

0 comments on commit 551cedb

Please sign in to comment.