Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Change 24059: Re: regexp trie fails compile on VMS
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rafael Garcia-Suarez  
View profile  
 More options Mar 21 2005, 4:56 pm
Newsgroups: perl.perl5.changes
From: rgarciasua...@free.fr (Rafael Garcia-Suarez)
Date: Mon, 21 Mar 2005 13:56:26 -0800
Local: Mon, Mar 21 2005 4:56 pm
Subject: Change 24059: Re: regexp trie fails compile on VMS
Change 24059 by rgs@marais on 2005/03/21 21:33:16

        Subject: Re: regexp trie fails compile on VMS
        From: demerphq <demer...@gmail.com>
        Date: Mon, 21 Mar 2005 22:29:09 +0100
        Message-ID: <9b18b311050321132917a4b...@mail.gmail.com>

Affected files ...

... //depot/perl/regcomp.c#353 edit
... //depot/perl/regcomp.h#67 edit
... //depot/perl/regcomp.pl#8 edit
... //depot/perl/regcomp.sym#10 edit
... //depot/perl/regexec.c#333 edit

Differences ...

==== //depot/perl/regcomp.c#353 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#352~24049~   Mon Mar 21 01:39:35 2005
+++ perl/regcomp.c      Mon Mar 21 13:33:16 2005
@@ -1160,8 +1160,7 @@
                 */
                 trie->states[ state ].trans.base=base;
             }
-            Renew( trie->trans, tp + 1, reg_trie_trans );
-
+            trie->lasttrans = tp + 1;
         }
     } else {
         /*
@@ -1409,7 +1408,7 @@
                 }
             }
         }
-        Renew( trie->trans, pos + 1, reg_trie_trans);
+        trie->lasttrans = pos + 1;
         Renew( trie->states, laststate + 1, reg_trie_state);
         DEBUG_TRIE_COMPILE_MORE_r(
                 PerlIO_printf( Perl_debug_log, " Alloc: %d Orig: %d elements, Final:%d. Savings of %%%5.2f\n",
@@ -1419,6 +1418,8 @@

         } /* end table compress */
     }
+    /* resize the trans array to remove unused space */
+    Renew( trie->trans, trie->lasttrans, reg_trie_trans);

     DEBUG_TRIE_COMPILE_r({
         U32 state;
@@ -1436,9 +1437,11 @@
             }
         }
         PerlIO_printf( Perl_debug_log, "\n-----:-----------------------");
+
         for( state = 0 ; state < trie->uniquecharcount ; state++ )
             PerlIO_printf( Perl_debug_log, "-----");
         PerlIO_printf( Perl_debug_log, "\n");
+
         for( state = 1 ; state < trie->laststate ; state++ ) {
             U32 base = trie->states[ state ].trans.base;

@@ -1455,14 +1458,16 @@
             if ( base ) {
                 U32 ofs = 0;

-                while( ( base + ofs - trie->uniquecharcount ) >=0 &&
-                      trie->trans[ base + ofs - trie->uniquecharcount ].check != state )
+                while( ( base + ofs  < trie->uniquecharcount ) ||
+                       ( base + ofs - trie->uniquecharcount < trie->lasttrans
+                         && trie->trans[ base + ofs - trie->uniquecharcount ].check != state))
                         ofs++;

                 PerlIO_printf( Perl_debug_log, "+%02X[ ", ofs);

                 for ( ofs = 0 ; ofs < trie->uniquecharcount ; ofs++ ) {
-                    if ( ( base + ofs - trie->uniquecharcount>=0) &&
+                    if ( ( base + ofs >= trie->uniquecharcount ) &&
+                         ( base + ofs - trie->uniquecharcount < trie->lasttrans ) &&
                          trie->trans[ base + ofs - trie->uniquecharcount ].check == state )
                     {
                        PerlIO_printf( Perl_debug_log, "%04X ",

==== //depot/perl/regcomp.h#67 (text) ====
Index: perl/regcomp.h
--- perl/regcomp.h#66~24044~    Fri Mar 18 07:04:39 2005
+++ perl/regcomp.h      Mon Mar 21 13:33:16 2005
@@ -463,6 +463,7 @@
     U16              wordcount;
     STRLEN           charcount;
     U32              laststate;
+    U32              lasttrans;
     U16              *charmap;
     HV               *widecharmap;
     reg_trie_state   *states;

==== //depot/perl/regexec.c#333 (text) ====
Index: perl/regexec.c
--- perl/regexec.c#332~24055~   Mon Mar 21 06:58:21 2005
+++ perl/regexec.c      Mon Mar 21 13:33:16 2005
@@ -2361,7 +2361,8 @@
             }                                                           \
         }                                                               \
         if ( charid &&                                                  \
-             ( base + charid - 1 - trie->uniquecharcount ) >=0  &&      \
+             ( base + charid > trie->uniquecharcount ) &&               \
+             ( base + charid - 1 - trie->uniquecharcount < trie->lasttrans) && \
              trie->trans[ base + charid - 1 - trie->uniquecharcount ].check == state ) \
         {                                                               \
             state = trie->trans[ base + charid - 1 - trie->uniquecharcount ].next;     \
@@ -2731,7 +2732,7 @@
                            tmp ? SvPV_nolen( *tmp ) : "not compiled under -Dr",
                            PL_colors[5] );
                    });
-                   PL_reginput = accept_buff[ 0 ].endpos;
+                   PL_reginput = (char *)accept_buff[ 0 ].endpos;
                    /* in this case we free tmps/leave before we call regmatch
                       as we wont be using accept_buff again. */
                    FREETMPS;
@@ -2772,7 +2773,7 @@
                            accept_buff[ accepted ] = tmp;
                            best = accepted;
                        }
-                       PL_reginput = accept_buff[ best ].endpos;
+                       PL_reginput = (char *)accept_buff[ best ].endpos;

                         /*
                            as far as I can tell we only need the SAVETMPS/FREETMPS
End of Patch.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.