[Pcre-svn] [591] code/trunk: Remove all "register" declarati…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [591] code/trunk: Remove all "register" declarations.
Revision: 591
          http://www.exim.org/viewvc/pcre2?view=rev&revision=591
Author:   ph10
Date:     2016-11-03 17:35:59 +0000 (Thu, 03 Nov 2016)
Log Message:
-----------
Remove all "register" declarations.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_auto_possess.c
    code/trunk/src/pcre2_dfa_match.c
    code/trunk/src/pcre2_find_bracket.c
    code/trunk/src/pcre2_match.c
    code/trunk/src/pcre2_ord2utf.c
    code/trunk/src/pcre2_printint.c
    code/trunk/src/pcre2_study.c
    code/trunk/src/pcre2_valid_utf.c
    code/trunk/src/pcre2grep.c
    code/trunk/src/pcre2test.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/ChangeLog    2016-11-03 17:35:59 UTC (rev 591)
@@ -140,7 +140,10 @@
 which started with .* inside a positive lookahead was incorrectly being
 compiled as implicitly anchored.


+19. Removed all instances of "register" declarations, as they are considered
+obsolete these days and in any case had become very haphazard.

+
Version 10.22 29-July-2016
--------------------------


Modified: code/trunk/src/pcre2_auto_possess.c
===================================================================
--- code/trunk/src/pcre2_auto_possess.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2_auto_possess.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -1061,7 +1061,7 @@
 int
 PRIV(auto_possessify)(PCRE2_UCHAR *code, BOOL utf, const compile_block *cb)
 {
-register PCRE2_UCHAR c;
+PCRE2_UCHAR c;
 PCRE2_SPTR end;
 PCRE2_UCHAR *repeat_opcode;
 uint32_t list[8];


Modified: code/trunk/src/pcre2_dfa_match.c
===================================================================
--- code/trunk/src/pcre2_dfa_match.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2_dfa_match.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -3470,7 +3470,7 @@
       {
       while (start_match < end_subject)
         {
-        register uint32_t c = UCHAR21TEST(start_match);
+        uint32_t c = UCHAR21TEST(start_match);
 #if PCRE2_CODE_UNIT_WIDTH != 8
         if (c > 255) c = 255;
 #endif
@@ -3510,7 +3510,7 @@


       if (has_req_cu && end_subject - start_match < REQ_CU_MAX)
         {
-        register PCRE2_SPTR p = start_match + (has_first_cu? 1:0);
+        PCRE2_SPTR p = start_match + (has_first_cu? 1:0);


         /* We don't need to repeat the search if we haven't yet reached the
         place we found it at last time. */
@@ -3521,7 +3521,7 @@
             {
             while (p < end_subject)
               {
-              register uint32_t pp = UCHAR21INCTEST(p);
+              uint32_t pp = UCHAR21INCTEST(p);
               if (pp == req_cu || pp == req_cu2) { p--; break; }
               }
             }


Modified: code/trunk/src/pcre2_find_bracket.c
===================================================================
--- code/trunk/src/pcre2_find_bracket.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2_find_bracket.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -71,7 +71,7 @@
 {
 for (;;)
   {
-  register PCRE2_UCHAR c = *code;
+  PCRE2_UCHAR c = *code;


if (c == OP_END) return NULL;


Modified: code/trunk/src/pcre2_match.c
===================================================================
--- code/trunk/src/pcre2_match.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2_match.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -142,7 +142,7 @@
 */


static int
-match_ref(PCRE2_SIZE offset, PCRE2_SIZE offset_top, register PCRE2_SPTR eptr,
+match_ref(PCRE2_SIZE offset, PCRE2_SIZE offset_top, PCRE2_SPTR eptr,
match_block *mb, BOOL caseless, PCRE2_SIZE *lengthptr)
{
#if defined SUPPORT_UNICODE
@@ -149,7 +149,7 @@
BOOL utf = (mb->poptions & PCRE2_UTF) != 0;
#endif

-register PCRE2_SPTR p;
+PCRE2_SPTR p;
PCRE2_SIZE length;
PCRE2_SPTR eptr_start = eptr;

@@ -296,7 +296,6 @@
argument of RMATCH isn't actually used in this definition. */

#ifndef HEAP_MATCH_RECURSE
-#define REGISTER register
#define RMATCH(ra,rb,rc,rd,re,rw) \
rrc = match(ra,rb,mstart,rc,rd,re,rdepth+1)
#define RRETURN(ra) return ra
@@ -306,8 +305,6 @@
the "rd" argument of RMATCH isn't actually used in this definition. It's the mb
argument of match(), which never changes. */

-#define REGISTER
-
#define RMATCH(ra,rb,rc,rd,re,rw)\
{\
heapframe *newframe = frame->Xnextframe;\
@@ -425,7 +422,7 @@
op_recurse_ovecsave(). */

static int
-match(REGISTER PCRE2_SPTR eptr, REGISTER PCRE2_SPTR ecode, PCRE2_SPTR mstart,
+match(PCRE2_SPTR eptr, PCRE2_SPTR ecode, PCRE2_SPTR mstart,
PCRE2_SIZE offset_top, match_block *mb, eptrblock *eptrb, uint32_t rdepth);


@@ -468,11 +465,11 @@
#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
__attribute__ ((noinline))
#endif
-op_recurse_ovecsave(REGISTER PCRE2_SPTR eptr, PCRE2_SPTR callpat,
+op_recurse_ovecsave(PCRE2_SPTR eptr, PCRE2_SPTR callpat,
PCRE2_SPTR mstart, PCRE2_SIZE offset_top, match_block *mb, eptrblock *eptrb,
uint32_t rdepth)
{
-register int rrc;
+int rrc;
BOOL cbegroup = *callpat >= OP_SBRA;
recursion_info *new_recursive = mb->recursive;
PCRE2_SIZE ovecsave[OP_RECURSE_STACK_SAVE_MAX];
@@ -576,7 +573,7 @@
*/

static int
-match(REGISTER PCRE2_SPTR eptr, REGISTER PCRE2_SPTR ecode, PCRE2_SPTR mstart,
+match(PCRE2_SPTR eptr, PCRE2_SPTR ecode, PCRE2_SPTR mstart,
PCRE2_SIZE offset_top, match_block *mb, eptrblock *eptrb, uint32_t rdepth)
{
/* These variables do not need to be preserved over recursion in this function,
@@ -583,10 +580,10 @@
so they can be ordinary variables in all cases. Mark some of them with
"register" because they are used a lot in loops. */

-register int  rrc;         /* Returns from recursive calls */
-register int  i;           /* Used for loops not involving calls to RMATCH() */
-register uint32_t c;       /* Character values not kept over RMATCH() calls */
-register BOOL utf;         /* Local copy of UTF flag for speed */
+int  rrc;         /* Returns from recursive calls */
+int  i;           /* Used for loops not involving calls to RMATCH() */
+uint32_t c;       /* Character values not kept over RMATCH() calls */
+BOOL utf;         /* Local copy of UTF flag for speed */


BOOL minimize, possessive; /* Quantifier options */
BOOL caseless;
@@ -1503,8 +1500,8 @@

       if (offset >= offset_top)
         {
-        register PCRE2_SIZE *iptr = mb->ovector + offset_top;
-        register PCRE2_SIZE *iend = mb->ovector + offset;
+        PCRE2_SIZE *iptr = mb->ovector + offset_top;
+        PCRE2_SIZE *iend = mb->ovector + offset;
         while (iptr < iend) *iptr++ = PCRE2_UNSET;
         offset_top = offset + 2;
         }
@@ -2052,8 +2049,8 @@


         if (offset > offset_top)
           {
-          register PCRE2_SIZE *iptr = mb->ovector + offset_top;
-          register PCRE2_SIZE *iend = mb->ovector + offset;
+          PCRE2_SIZE *iptr = mb->ovector + offset_top;
+          PCRE2_SIZE *iend = mb->ovector + offset;
           while (iptr < iend) *iptr++ = PCRE2_UNSET;
           }


@@ -2849,9 +2846,7 @@
         continue;
       }


-    /* First, ensure the minimum number of matches are present. We get back
-    the length of the reference string explicitly rather than passing the
-    address of eptr, so that eptr can be a register variable. */
+    /* First, ensure the minimum number of matches are present. */


     for (i = 1; i <= min; i++)
       {
@@ -3762,7 +3757,7 @@
 #ifdef SUPPORT_UNICODE
     if (utf)
       {
-      register uint32_t ch, och;
+      uint32_t ch, och;


       ecode++;
       GETCHARINC(ch, ecode);
@@ -3784,7 +3779,7 @@
     else
 #endif  /* SUPPORT_UNICODE */
       {
-      register uint32_t ch = ecode[1];
+      uint32_t ch = ecode[1];
       c = *eptr++;
       if (ch == c || (op == OP_NOTI && TABLE_GET(ch, mb->fcc, ch) == c))
         RRETURN(MATCH_NOMATCH);
@@ -3890,7 +3885,7 @@
 #ifdef SUPPORT_UNICODE
       if (utf)
         {
-        register uint32_t d;
+        uint32_t d;
         for (i = 1; i <= min; i++)
           {
           if (eptr >= mb->end_subject)
@@ -3925,7 +3920,7 @@
 #ifdef SUPPORT_UNICODE
         if (utf)
           {
-          register uint32_t d;
+          uint32_t d;
           for (fi = min;; fi++)
             {
             RMATCH(eptr, ecode, offset_top, mb, eptrb, RM28);
@@ -3970,7 +3965,7 @@
 #ifdef SUPPORT_UNICODE
         if (utf)
           {
-          register uint32_t d;
+          uint32_t d;
           for (i = min; i < max; i++)
             {
             int len = 1;
@@ -4031,7 +4026,7 @@
 #ifdef SUPPORT_UNICODE
       if (utf)
         {
-        register uint32_t d;
+        uint32_t d;
         for (i = 1; i <= min; i++)
           {
           if (eptr >= mb->end_subject)
@@ -4065,7 +4060,7 @@
 #ifdef SUPPORT_UNICODE
         if (utf)
           {
-          register uint32_t d;
+          uint32_t d;
           for (fi = min;; fi++)
             {
             RMATCH(eptr, ecode, offset_top, mb, eptrb, RM32);
@@ -4109,7 +4104,7 @@
 #ifdef SUPPORT_UNICODE
         if (utf)
           {
-          register uint32_t d;
+          uint32_t d;
           for (i = min; i < max; i++)
             {
             int len = 1;
@@ -6731,8 +6726,8 @@


 if (ocount > 0)
   {
-  register PCRE2_SIZE *iptr = mb->ovector + ocount;
-  register PCRE2_SIZE *iend = iptr - re->top_bracket;
+  PCRE2_SIZE *iptr = mb->ovector + ocount;
+  PCRE2_SIZE *iend = iptr - re->top_bracket;
   if (iend < mb->ovector + 2) iend = mb->ovector + 2;
   while (--iptr >= iend) *iptr = PCRE2_UNSET;
   mb->ovector[0] = mb->ovector[1] = PCRE2_UNSET;
@@ -6888,7 +6883,7 @@
       {
       while (start_match < end_subject)
         {
-        register uint32_t c = UCHAR21TEST(start_match);
+        uint32_t c = UCHAR21TEST(start_match);
 #if PCRE2_CODE_UNIT_WIDTH != 8
         if (c > 255) c = 255;
 #endif
@@ -6932,7 +6927,7 @@


       if (has_req_cu && end_subject - start_match < REQ_CU_MAX)
         {
-        register PCRE2_SPTR p = start_match + (has_first_cu? 1:0);
+        PCRE2_SPTR p = start_match + (has_first_cu? 1:0);


         /* We don't need to repeat the search if we haven't yet reached the
         place we found it at last time. */
@@ -6943,7 +6938,7 @@
             {
             while (p < end_subject)
               {
-              register uint32_t pp = UCHAR21INCTEST(p);
+              uint32_t pp = UCHAR21INCTEST(p);
               if (pp == req_cu || pp == req_cu2) { p--; break; }
               }
             }
@@ -7176,7 +7171,7 @@


   if (mb->end_offset_top/2 <= re->top_bracket)
     {
-    register PCRE2_SIZE *iptr, *iend;
+    PCRE2_SIZE *iptr, *iend;
     int resetcount = re->top_bracket + 1;
     if (resetcount > match_data->oveccount) resetcount = match_data->oveccount;
     iptr = match_data->ovector + mb->end_offset_top;


Modified: code/trunk/src/pcre2_ord2utf.c
===================================================================
--- code/trunk/src/pcre2_ord2utf.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2_ord2utf.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -83,7 +83,7 @@
 /* Convert to UTF-8 */


#if PCRE2_CODE_UNIT_WIDTH == 8
-register int i, j;
+int i, j;
for (i = 0; i < PRIV(utf8_table1_size); i++)
if ((int)cvalue <= PRIV(utf8_table1)[i]) break;
buffer += i;

Modified: code/trunk/src/pcre2_printint.c
===================================================================
--- code/trunk/src/pcre2_printint.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2_printint.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -206,7 +206,7 @@
 {
 while (*ptr != '\0')
   {
-  register uint32_t c = *ptr++;
+  uint32_t c = *ptr++;
   if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c);
   }
 }
@@ -216,7 +216,7 @@
 {
 for (; len > 0; len--)
   {
-  register uint32_t c = *ptr++;
+  uint32_t c = *ptr++;
   if (PRINTABLE(c)) fprintf(f, "%c", c); else fprintf(f, "\\x{%x}", c);
   }
 }


Modified: code/trunk/src/pcre2_study.c
===================================================================
--- code/trunk/src/pcre2_study.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2_study.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -101,8 +101,8 @@
 BOOL had_recurse = FALSE;
 BOOL dupcapused = (re->flags & PCRE2_DUPCAPUSED) != 0;
 recurse_check this_recurse;
-register int branchlength = 0;
-register PCRE2_UCHAR *cc = (PCRE2_UCHAR *)code + 1 + LINK_SIZE;
+int branchlength = 0;
+PCRE2_UCHAR *cc = (PCRE2_UCHAR *)code + 1 + LINK_SIZE;


/* If this is a "could be empty" group, its minimum length is 0. */

@@ -124,7 +124,7 @@
{
int d, min, recno;
PCRE2_UCHAR *cs, *ce;
- register PCRE2_UCHAR op = *cc;
+ PCRE2_UCHAR op = *cc;

if (branchlength >= UINT16_MAX) return UINT16_MAX;

@@ -792,7 +792,7 @@
static void
set_type_bits(pcre2_real_code *re, int cbit_type, unsigned int table_limit)
{
-register uint32_t c;
+uint32_t c;
for (c = 0; c < table_limit; c++)
re->start_bitmap[c] |= re->tables[c+cbits_offset+cbit_type];
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
@@ -833,7 +833,7 @@
static void
set_nottype_bits(pcre2_real_code *re, int cbit_type, unsigned int table_limit)
{
-register uint32_t c;
+uint32_t c;
for (c = 0; c < table_limit; c++)
re->start_bitmap[c] |= ~(re->tables[c+cbits_offset+cbit_type]);
#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8
@@ -873,7 +873,7 @@
static int
set_start_bits(pcre2_real_code *re, PCRE2_SPTR code, BOOL utf)
{
-register uint32_t c;
+uint32_t c;
int yield = SSB_DONE;

#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH == 8

Modified: code/trunk/src/pcre2_valid_utf.c
===================================================================
--- code/trunk/src/pcre2_valid_utf.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2_valid_utf.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -93,8 +93,8 @@
 int
 PRIV(valid_utf)(PCRE2_SPTR string, PCRE2_SIZE length, PCRE2_SIZE *erroroffset)
 {
-register PCRE2_SPTR p;
-register uint32_t c;
+PCRE2_SPTR p;
+uint32_t c;


/* ----------------- Check a UTF-8 string ----------------- */

@@ -133,7 +133,7 @@

for (p = string; length > 0; p++)
{
- register uint32_t ab, d;
+ uint32_t ab, d;

c = *p;
length--;

Modified: code/trunk/src/pcre2grep.c
===================================================================
--- code/trunk/src/pcre2grep.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2grep.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -1272,7 +1272,7 @@
   while (p < endptr)
     {
     int extra = 0;
-    register int c = *((unsigned char *)p);
+    int c = *((unsigned char *)p);


     if (utf && c >= 0xc0)
       {
@@ -1316,7 +1316,7 @@
   while (p < endptr)
     {
     int extra = 0;
-    register int c = *((unsigned char *)p);
+    int c = *((unsigned char *)p);


     if (utf && c >= 0xc0)
       {
@@ -1418,7 +1418,7 @@


   while (p > startptr)
     {
-    register unsigned int c;
+    unsigned int c;
     char *pp = p - 1;


     if (utf)


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2016-11-03 17:01:17 UTC (rev 590)
+++ code/trunk/src/pcre2test.c    2016-11-03 17:35:59 UTC (rev 591)
@@ -2702,7 +2702,7 @@
 static int
 ord2utf8(uint32_t cvalue, uint8_t *utf8bytes)
 {
-register int i, j;
+int i, j;
 if (cvalue > 0x7fffffffu)
   return -1;
 for (i = 0; i < utf8_table1_size; i++)
@@ -5011,7 +5011,7 @@


 if (timeit > 0)
   {
-  register int i;
+  int i;
   clock_t time_taken = 0;
   for (i = 0; i < timeit; i++)
     {
@@ -5041,7 +5041,7 @@
   {
   if (timeit > 0)
     {
-    register int i;
+    int i;
     clock_t time_taken = 0;
     for (i = 0; i < timeit; i++)
       {
@@ -6409,7 +6409,7 @@


   if (timeitm > 0)
     {
-    register int i;
+    int i;
     clock_t start_time, time_taken;


     if ((dat_datctl.control & CTL_DFA) != 0)