Remove all "register" declarations.

This commit is contained in:
Philip.Hazel 2016-11-03 17:35:59 +00:00
parent 336da0bf5d
commit e8d564831f
11 changed files with 56 additions and 58 deletions

View File

@ -140,6 +140,9 @@ pcre2fuzzcheck is also compiled.
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
--------------------------

View File

@ -1061,7 +1061,7 @@ Returns: 0 for success
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];

View File

@ -3470,7 +3470,7 @@ for (;;)
{
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 @@ for (;;)
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 @@ for (;;)
{
while (p < end_subject)
{
register uint32_t pp = UCHAR21INCTEST(p);
uint32_t pp = UCHAR21INCTEST(p);
if (pp == req_cu || pp == req_cu2) { p--; break; }
}
}

View File

@ -71,7 +71,7 @@ PRIV(find_bracket)(PCRE2_SPTR code, BOOL utf, int number)
{
for (;;)
{
register PCRE2_UCHAR c = *code;
PCRE2_UCHAR c = *code;
if (c == OP_END) return NULL;

View File

@ -142,14 +142,14 @@ Returns: = 0 sucessful match; number of code units matched is set
*/
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
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 @@ enum { RM1=1, RM2, RM3, RM4, RM5, RM6, RM7, RM8, RM9, RM10,
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 @@ argument of RMATCH isn't actually used in this definition. */
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 @@ to save the ovector while calling match() to process the pattern recursion. */
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 @@ static int
#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,17 +573,17 @@ Returns: MATCH_MATCH if matched ) these values are >= 0
*/
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,
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 @@ for (;;)
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 @@ for (;;)
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 @@ for (;;)
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 @@ for (;;)
#ifdef SUPPORT_UNICODE
if (utf)
{
register uint32_t ch, och;
uint32_t ch, och;
ecode++;
GETCHARINC(ch, ecode);
@ -3784,7 +3779,7 @@ for (;;)
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 @@ for (;;)
#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 @@ for (;;)
#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 @@ for (;;)
#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 @@ for (;;)
#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 @@ for (;;)
#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 @@ for (;;)
#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 @@ in case they inspect these fields. */
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 @@ for(;;)
{
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 @@ for(;;)
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 @@ for(;;)
{
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 (rc == MATCH_MATCH || rc == MATCH_ACCEPT)
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;

View File

@ -83,7 +83,7 @@ PRIV(ord2utf)(uint32_t cvalue, PCRE2_UCHAR *buffer)
/* 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;

View File

@ -206,7 +206,7 @@ print_custring(FILE *f, PCRE2_SPTR ptr)
{
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 @@ print_custring_bylen(FILE *f, PCRE2_SPTR ptr, PCRE2_UCHAR len)
{
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);
}
}

View File

@ -101,8 +101,8 @@ uint32_t once_fudge = 0;
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 @@ for (;;)
{
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 @@ Returns: nothing
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 @@ Returns: nothing
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 @@ Returns: SSB_FAIL => Failed to find any starting code units
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

View File

@ -93,8 +93,8 @@ Returns: == 0 if the string is a valid UTF string
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 @@ PCRE2_ERROR_UTF8_ERR21 Byte with the illegal value 0xfe or 0xff
for (p = string; length > 0; p++)
{
register uint32_t ab, d;
uint32_t ab, d;
c = *p;
length--;

View File

@ -1272,7 +1272,7 @@ switch(endlinetype)
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 @@ switch(endlinetype)
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 @@ switch(endlinetype)
while (p > startptr)
{
register unsigned int c;
unsigned int c;
char *pp = p - 1;
if (utf)

View File

@ -2702,7 +2702,7 @@ Returns: number of characters placed in the buffer
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 @@ use_pat_context = ((pat_patctl.control & CTL_NULLCONTEXT) != 0)?
if (timeit > 0)
{
register int i;
int i;
clock_t time_taken = 0;
for (i = 0; i < timeit; i++)
{
@ -5041,7 +5041,7 @@ if (TEST(compiled_code, !=, NULL) && pat_patctl.jit != 0)
{
if (timeit > 0)
{
register int i;
int i;
clock_t time_taken = 0;
for (i = 0; i < timeit; i++)
{
@ -6409,7 +6409,7 @@ else for (gmatched = 0;; gmatched++)
if (timeitm > 0)
{
register int i;
int i;
clock_t start_time, time_taken;
if ((dat_datctl.control & CTL_DFA) != 0)