This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reinstate "regcomp.c: Remove unused data structure field"
authorKarl Williamson <public@khwilliamson.com>
Sat, 6 Jul 2013 19:58:55 +0000 (13:58 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 16 Jul 2013 19:58:07 +0000 (13:58 -0600)
This reverts commit c7995b20ccfbb4248b23aeae9fd1eab838852fcc, which
reverted 4b98096221966ea01c046f4f61b2dc4f60b534b9, thus reinstating
the latter commit.  It turns out that the error being chased down was
not due to this commit.

Its original message was:

This removes a field that is set in the inversion list data structure
and examined just once.  And that sole examiner is the function that
calls the function that does the set.  In other words X calls Y passing
it data D.  Y puts D into a structure.  Upon return from Y, X looks for
D in the structure.  No one else looks at D.  X might just as well have
looked at D directly, without involving Y, and without the structure
needing a space for D.

embed.fnc
embed.h
proto.h
regcomp.c

index 1d910c9..19d227a 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1444,7 +1444,6 @@ EiM       |void   |invlist_trim   |NN SV* const invlist
 EiMR   |SV*    |invlist_clone  |NN SV* const invlist
 EiMR   |bool   |invlist_is_iterating|NN SV* const invlist
 EiMR   |UV*    |get_invlist_iter_addr  |NN SV* invlist
-EiMR   |UV*    |get_invlist_version_id_addr    |NN SV* invlist
 EiM    |void   |invlist_iterinit|NN SV* invlist
 EsMR   |bool   |invlist_iternext|NN SV* invlist|NN UV* start|NN UV* end
 EiM    |void   |invlist_iterfinish|NN SV* invlist
diff --git a/embed.h b/embed.h
index 58b7b35..965d74a 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define could_it_be_a_POSIX_class(a)   S_could_it_be_a_POSIX_class(aTHX_ a)
 #define get_invlist_iter_addr(a)       S_get_invlist_iter_addr(aTHX_ a)
 #define get_invlist_previous_index_addr(a)     S_get_invlist_previous_index_addr(aTHX_ a)
-#define get_invlist_version_id_addr(a) S_get_invlist_version_id_addr(aTHX_ a)
 #define get_invlist_zero_addr(a)       S_get_invlist_zero_addr(aTHX_ a)
 #define grok_bslash_N(a,b,c,d,e,f,g)   S_grok_bslash_N(aTHX_ a,b,c,d,e,f,g)
 #define handle_regex_sets(a,b,c,d,e)   S_handle_regex_sets(aTHX_ a,b,c,d,e)
diff --git a/proto.h b/proto.h
index 7893c1d..08af5db 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -6515,12 +6515,6 @@ PERL_STATIC_INLINE IV*   S_get_invlist_previous_index_addr(pTHX_ SV* invlist)
 #define PERL_ARGS_ASSERT_GET_INVLIST_PREVIOUS_INDEX_ADDR       \
        assert(invlist)
 
-PERL_STATIC_INLINE UV* S_get_invlist_version_id_addr(pTHX_ SV* invlist)
-                       __attribute__warn_unused_result__
-                       __attribute__nonnull__(pTHX_1);
-#define PERL_ARGS_ASSERT_GET_INVLIST_VERSION_ID_ADDR   \
-       assert(invlist)
-
 PERL_STATIC_INLINE UV* S_get_invlist_zero_addr(pTHX_ SV* invlist)
                        __attribute__warn_unused_result__
                        __attribute__nonnull__(pTHX_1);
index de0405e..bf4cbc6 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -7225,7 +7225,6 @@ Perl__new_invlist(pTHX_ IV initial_size)
     *(zero_addr + 1) = 0;
 
     *get_invlist_previous_index_addr(new_list) = 0;
-    *get_invlist_version_id_addr(new_list) = INVLIST_VERSION_ID;
 #if HEADER_LENGTH != 6
 #   error Need to regenerate INVLIST_VERSION_ID by running perl -E 'say int(rand 2**31-1)', and then changing the #if to the new length
 #endif
@@ -7251,7 +7250,7 @@ S__new_invlist_C_array(pTHX_ UV* list)
                               shouldn't touch it */
     SvCUR_set(invlist, TO_INTERNAL_SIZE(_invlist_len(invlist)));
 
-    if (*get_invlist_version_id_addr(invlist) != INVLIST_VERSION_ID) {
+    if (list[INVLIST_VERSION_ID_OFFSET] != INVLIST_VERSION_ID) {
         Perl_croak(aTHX_ "panic: Incorrect version for previously generated inversion list");
     }
     invlist_set_len(invlist, list[INVLIST_LEN_OFFSET]);
@@ -8143,16 +8142,6 @@ S_get_invlist_iter_addr(pTHX_ SV* invlist)
     return (UV *) (SvPVX(invlist) + (INVLIST_ITER_OFFSET * sizeof (UV)));
 }
 
-PERL_STATIC_INLINE UV*
-S_get_invlist_version_id_addr(pTHX_ SV* invlist)
-{
-    /* Return the address of the UV that contains the version id. */
-
-    PERL_ARGS_ASSERT_GET_INVLIST_VERSION_ID_ADDR;
-
-    return (UV *) (SvPVX(invlist) + (INVLIST_VERSION_ID_OFFSET * sizeof (UV)));
-}
-
 PERL_STATIC_INLINE void
 S_invlist_iterinit(pTHX_ SV* invlist)  /* Initialize iterator for invlist */
 {