This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Reorder a couple of function calls
authorKarl Williamson <public@khwilliamson.com>
Fri, 12 Jul 2013 01:44:56 +0000 (19:44 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 16 Jul 2013 19:58:10 +0000 (13:58 -0600)
A future commit with require that the offset be known before the length
gets set.  This prepares for that.

regcomp.c

index 284ca6a..f109681 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -7270,9 +7270,10 @@ S__new_invlist_C_array(pTHX_ const UV* const list)
      * when that adjustment wasn't needed.  That happens when the offset was 0;
      * the exclusive-or flips the 0 to 1, and vice versa */
     SvCUR_set(invlist, TO_INTERNAL_SIZE(length - (offset ^ 1)));
+    *(get_invlist_offset_addr(invlist)) = offset;
 
     invlist_set_len(invlist, length);
-    *(get_invlist_offset_addr(invlist)) = offset;
+
     invlist_set_previous_index(invlist, 0);
 
     /* Initialize the iteration pointer. */
@@ -8140,9 +8141,9 @@ S_invlist_clone(pTHX_ SV* const invlist)
     PERL_ARGS_ASSERT_INVLIST_CLONE;
 
     SvCUR_set(new_invlist, physical_length); /* This isn't done automatically */
-    invlist_set_len(new_invlist, _invlist_len(invlist));
     *(get_invlist_offset_addr(new_invlist))
                                 = *(get_invlist_offset_addr(invlist));
+    invlist_set_len(new_invlist, _invlist_len(invlist));
     Copy(SvPVX(invlist), SvPVX(new_invlist), physical_length, char);
 
     return new_invlist;