Skip to content

Commit aca6aef

Browse files
authored
Remove 'register' type qualifier (#6980)
The compiler should be smart enough to optimize this on its own
1 parent 2a486d4 commit aca6aef

21 files changed

+61
-61
lines changed

Zend/zend_compile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ void zend_verify_namespace(void) /* {{{ */
19731973
Returns directory name component of path */
19741974
ZEND_API size_t zend_dirname(char *path, size_t len)
19751975
{
1976-
register char *end = path + len - 1;
1976+
char *end = path + len - 1;
19771977
unsigned int len_adjust = 0;
19781978

19791979
#ifdef ZEND_WIN32

Zend/zend_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2731,7 +2731,7 @@ ZEND_API zval* ZEND_FASTCALL zend_hash_minmax(const HashTable *ht, bucket_compar
27312731

27322732
ZEND_API bool ZEND_FASTCALL _zend_handle_numeric_str_ex(const char *key, size_t length, zend_ulong *idx)
27332733
{
2734-
register const char *tmp = key;
2734+
const char *tmp = key;
27352735

27362736
const char *end = key + length;
27372737

Zend/zend_ini_scanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ zend_result zend_ini_prepare_string_for_scanning(char *str, int scanner_mode)
305305
/* {{{ zend_ini_escape_string() */
306306
static void zend_ini_escape_string(zval *lval, char *str, int len, char quote_type)
307307
{
308-
register char *s, *t;
308+
char *s, *t;
309309
char *end;
310310

311311
zend_ini_copy_value(lval, str, len);

Zend/zend_language_scanner.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ ZEND_API void zend_multibyte_yyinput_again(zend_encoding_filter old_input_filter
905905

906906
static zend_result zend_scan_escape_string(zval *zendlval, char *str, int len, char quote_type)
907907
{
908-
register char *s, *t;
908+
char *s, *t;
909909
char *end;
910910

911911
if (len <= 1) {
@@ -2427,7 +2427,7 @@ inline_char_handler:
24272427

24282428

24292429
<ST_IN_SCRIPTING>b?['] {
2430-
register char *s, *t;
2430+
char *s, *t;
24312431
char *end;
24322432
int bprefix = (yytext[0] != '\'') ? 1 : 0;
24332433

Zend/zend_operators.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,13 +2683,13 @@ ZEND_API void ZEND_FASTCALL zend_str_tolower(char *str, size_t length) /* {{{ */
26832683

26842684
ZEND_API char* ZEND_FASTCALL zend_str_tolower_dup_ex(const char *source, size_t length) /* {{{ */
26852685
{
2686-
register const unsigned char *p = (const unsigned char*)source;
2687-
register const unsigned char *end = p + length;
2686+
const unsigned char *p = (const unsigned char*)source;
2687+
const unsigned char *end = p + length;
26882688

26892689
while (p < end) {
26902690
if (*p != zend_tolower_ascii(*p)) {
26912691
char *res = (char*)emalloc(length + 1);
2692-
register unsigned char *r;
2692+
unsigned char *r;
26932693

26942694
if (p != (const unsigned char*)source) {
26952695
memcpy(res, source, p - (const unsigned char*)source);
@@ -3280,8 +3280,8 @@ static zend_always_inline void zend_memnstr_ex_pre(unsigned int td[], const char
32803280
ZEND_API const char* ZEND_FASTCALL zend_memnstr_ex(const char *haystack, const char *needle, size_t needle_len, const char *end) /* {{{ */
32813281
{
32823282
unsigned int td[256];
3283-
register size_t i;
3284-
register const char *p;
3283+
size_t i;
3284+
const char *p;
32853285

32863286
if (needle_len == 0 || (end - haystack) < needle_len) {
32873287
return NULL;
@@ -3314,8 +3314,8 @@ ZEND_API const char* ZEND_FASTCALL zend_memnstr_ex(const char *haystack, const c
33143314
ZEND_API const char* ZEND_FASTCALL zend_memnrstr_ex(const char *haystack, const char *needle, size_t needle_len, const char *end) /* {{{ */
33153315
{
33163316
unsigned int td[256];
3317-
register size_t i;
3318-
register const char *p;
3317+
size_t i;
3318+
const char *p;
33193319

33203320
if (needle_len == 0 || (end - haystack) < needle_len) {
33213321
return NULL;

Zend/zend_virtual_cwd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ CWD_API char *virtual_getcwd(char *buf, size_t size) /* {{{ */
301301
#ifdef ZEND_WIN32
302302
static inline zend_ulong realpath_cache_key(const char *path, size_t path_len) /* {{{ */
303303
{
304-
register zend_ulong h;
304+
zend_ulong h;
305305
size_t bucket_key_len;
306306
const char *bucket_key_start = tsrm_win32_get_path_sid_key(path, path_len, &bucket_key_len);
307307
const char *bucket_key = bucket_key_start;
@@ -325,7 +325,7 @@ static inline zend_ulong realpath_cache_key(const char *path, size_t path_len) /
325325
#else
326326
static inline zend_ulong realpath_cache_key(const char *path, size_t path_len) /* {{{ */
327327
{
328-
register zend_ulong h;
328+
zend_ulong h;
329329
const char *e = path + path_len;
330330

331331
for (h = Z_UL(2166136261); path < e;) {

ext/mbstring/mbstring.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4232,7 +4232,7 @@ MBSTRING_API size_t php_mb_mbchar_bytes(const char *s)
42324232
/* {{{ MBSTRING_API char *php_mb_safe_strrchr_ex() */
42334233
MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c, size_t nbytes, const mbfl_encoding *enc)
42344234
{
4235-
register const char *p = s;
4235+
const char *p = s;
42364236
char *last=NULL;
42374237

42384238
if (nbytes == (size_t)-1) {
@@ -4252,8 +4252,8 @@ MBSTRING_API char *php_mb_safe_strrchr_ex(const char *s, unsigned int c, size_t
42524252
++p;
42534253
}
42544254
} else {
4255-
register size_t bcnt = nbytes;
4256-
register size_t nbytes_char;
4255+
size_t bcnt = nbytes;
4256+
size_t nbytes_char;
42574257
while (bcnt > 0) {
42584258
if ((unsigned char)*p == (unsigned char)c) {
42594259
last = (char *)p;

ext/mysqli/mysqli_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ mysqli_escape_string_for_tx_name_in_comment(const char * const name)
7979
*p_copy++ = '/';
8080
*p_copy++ = '*';
8181
while (1) {
82-
register char v = *p_orig;
82+
char v = *p_orig;
8383
if (v == 0) {
8484
break;
8585
}

ext/mysqlnd/mysqlnd_wireprotocol.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static enum_mysqlnd_collected_stats packet_type_to_statistic_packet_count[PROT_L
9191
zend_ulong
9292
php_mysqlnd_net_field_length(const zend_uchar **packet)
9393
{
94-
register const zend_uchar *p= (const zend_uchar *)*packet;
94+
const zend_uchar *p= (const zend_uchar *)*packet;
9595

9696
if (*p < 251) {
9797
(*packet)++;
@@ -121,7 +121,7 @@ php_mysqlnd_net_field_length(const zend_uchar **packet)
121121
uint64_t
122122
php_mysqlnd_net_field_length_ll(const zend_uchar **packet)
123123
{
124-
register const zend_uchar *p = (zend_uchar *)*packet;
124+
const zend_uchar *p = (zend_uchar *)*packet;
125125

126126
if (*p < 251) {
127127
(*packet)++;
@@ -639,7 +639,7 @@ size_t php_mysqlnd_auth_write(MYSQLND_CONN_DATA * conn, void * _packet)
639639
static enum_func_status
640640
php_mysqlnd_auth_response_read(MYSQLND_CONN_DATA * conn, void * _packet)
641641
{
642-
register MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet;
642+
MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet;
643643
MYSQLND_ERROR_INFO * error_info = conn->error_info;
644644
MYSQLND_PFC * pfc = conn->protocol_frame_codec;
645645
MYSQLND_VIO * vio = conn->vio;
@@ -802,7 +802,7 @@ php_mysqlnd_change_auth_response_write(MYSQLND_CONN_DATA * conn, void * _packet)
802802
static enum_func_status
803803
php_mysqlnd_ok_read(MYSQLND_CONN_DATA * conn, void * _packet)
804804
{
805-
register MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet;
805+
MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet;
806806
MYSQLND_ERROR_INFO * error_info = conn->error_info;
807807
MYSQLND_PFC * pfc = conn->protocol_frame_codec;
808808
MYSQLND_VIO * vio = conn->vio;

ext/pcre/php_pcre.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,8 +1500,8 @@ PHP_FUNCTION(preg_match_all)
15001500
/* {{{ preg_get_backref */
15011501
static int preg_get_backref(char **str, int *backref)
15021502
{
1503-
register char in_brace = 0;
1504-
register char *walk = *str;
1503+
char in_brace = 0;
1504+
char *walk = *str;
15051505

15061506
if (walk[1] == 0)
15071507
return 0;

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
static char * _pdo_pgsql_trim_message(const char *message, int persistent)
3939
{
40-
register int i = strlen(message)-1;
40+
size_t i = strlen(message)-1;
4141
char *tmp;
4242

4343
if (i>1 && (message[i-1] == '\r' || message[i-1] == '\n') && message[i] == '.') {

ext/standard/exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ PHP_FUNCTION(passthru)
281281
*/
282282
PHPAPI zend_string *php_escape_shell_cmd(const char *str)
283283
{
284-
register size_t x, y;
284+
size_t x, y;
285285
size_t l = strlen(str);
286286
uint64_t estimate = (2 * (uint64_t)l) + 1;
287287
zend_string *cmd;

ext/standard/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ PHP_FUNCTION(file)
722722
char *filename;
723723
size_t filename_len;
724724
char *p, *s, *e;
725-
register int i = 0;
725+
int i = 0;
726726
char eol_marker = '\n';
727727
zend_long flags = 0;
728728
bool use_include_path;

ext/standard/flock_compat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ PHPAPI int php_flock(int fd, int operation)
162162
int inet_aton(const char *cp, struct in_addr *ap)
163163
{
164164
int dots = 0;
165-
register unsigned long acc = 0, addr = 0;
165+
unsigned long acc = 0, addr = 0;
166166

167167
do {
168-
register char cc = *cp;
168+
char cc = *cp;
169169

170170
switch (cc) {
171171
case '0':

ext/standard/formatted_print.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ php_sprintf_appendstring(zend_string **buffer, size_t *pos, char *add,
8585
size_t min_width, size_t max_width, char padding,
8686
size_t alignment, size_t len, int neg, int expprec, int always_sign)
8787
{
88-
register size_t npad;
88+
size_t npad;
8989
size_t req_size;
9090
size_t copy_len;
9191
size_t m_width;
@@ -143,8 +143,8 @@ php_sprintf_appendint(zend_string **buffer, size_t *pos, zend_long number,
143143
int always_sign)
144144
{
145145
char numbuf[NUM_BUF_SIZE];
146-
register zend_ulong magn, nmagn;
147-
register unsigned int i = NUM_BUF_SIZE - 1, neg = 0;
146+
zend_ulong magn, nmagn;
147+
unsigned int i = NUM_BUF_SIZE - 1, neg = 0;
148148

149149
PRINTF_DEBUG(("sprintf: appendint(%x, %x, %x, %d, %d, '%c', %d)\n",
150150
*buffer, pos, &ZSTR_LEN(*buffer), number, width, padding, alignment));
@@ -187,8 +187,8 @@ php_sprintf_appenduint(zend_string **buffer, size_t *pos,
187187
size_t width, char padding, size_t alignment)
188188
{
189189
char numbuf[NUM_BUF_SIZE];
190-
register zend_ulong magn, nmagn;
191-
register unsigned int i = NUM_BUF_SIZE - 1;
190+
zend_ulong magn, nmagn;
191+
unsigned int i = NUM_BUF_SIZE - 1;
192192

193193
PRINTF_DEBUG(("sprintf: appenduint(%x, %x, %x, %d, %d, '%c', %d)\n",
194194
*buffer, pos, &ZSTR_LEN(*buffer), number, width, padding, alignment));
@@ -326,9 +326,9 @@ php_sprintf_append2n(zend_string **buffer, size_t *pos, zend_long number,
326326
const char *chartable, int expprec)
327327
{
328328
char numbuf[NUM_BUF_SIZE];
329-
register zend_ulong num;
330-
register zend_ulong i = NUM_BUF_SIZE - 1;
331-
register int andbits = (1 << n) - 1;
329+
zend_ulong num;
330+
zend_ulong i = NUM_BUF_SIZE - 1;
331+
int andbits = (1 << n) - 1;
332332

333333
PRINTF_DEBUG(("sprintf: append2n(%x, %x, %x, %d, %d, '%c', %d, %d, %x)\n",
334334
*buffer, pos, &ZSTR_LEN(*buffer), number, width, padding, alignment, n,
@@ -355,8 +355,8 @@ inline static int
355355
php_sprintf_getnumber(char **buffer, size_t *len)
356356
{
357357
char *endptr;
358-
register zend_long num = ZEND_STRTOL(*buffer, &endptr, 10);
359-
register size_t i;
358+
zend_long num = ZEND_STRTOL(*buffer, &endptr, 10);
359+
size_t i;
360360

361361
if (endptr != NULL) {
362362
i = (endptr - *buffer);

ext/standard/mt_rand.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ static inline void php_mt_initialize(uint32_t seed, uint32_t *state)
100100
In previous versions, most significant bits (MSBs) of the seed affect
101101
only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. */
102102

103-
register uint32_t *s = state;
104-
register uint32_t *r = state;
105-
register int i = 1;
103+
uint32_t *s = state;
104+
uint32_t *r = state;
105+
int i = 1;
106106

107107
*s++ = seed & 0xffffffffU;
108108
for( ; i < N; ++i ) {
@@ -118,9 +118,9 @@ static inline void php_mt_reload(void)
118118
/* Generate N new values in state
119119
Made clearer and faster by Matthew Bellew (matthew.bellew@home.com) */
120120

121-
register uint32_t *state = BG(state);
122-
register uint32_t *p = state;
123-
register int i;
121+
uint32_t *state = BG(state);
122+
uint32_t *p = state;
123+
int i;
124124

125125
if (BG(mt_rand_mode) == MT_RAND_MT19937) {
126126
for (i = N - M; i--; ++p)
@@ -159,7 +159,7 @@ PHPAPI uint32_t php_mt_rand(void)
159159
/* Pull a 32-bit integer from the generator state
160160
Every other access function simply transforms the numbers extracted here */
161161

162-
register uint32_t s1;
162+
uint32_t s1;
163163

164164
if (UNEXPECTED(!BG(mt_rand_is_seeded))) {
165165
zend_long bytes;

ext/standard/quot_print.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ static char php_hex2int(int c) /* {{{ */
4949

5050
PHPAPI zend_string *php_quot_print_decode(const unsigned char *str, size_t length, int replace_us_by_ws) /* {{{ */
5151
{
52-
register size_t i;
53-
register unsigned const char *p1;
54-
register unsigned char *p2;
55-
register unsigned int h_nbl, l_nbl;
52+
size_t i;
53+
unsigned const char *p1;
54+
unsigned char *p2;
55+
unsigned int h_nbl, l_nbl;
5656

5757
size_t decoded_len, buf_size;
5858
zend_string *retval;

ext/standard/string.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ PHPAPI zend_string *php_string_toupper(zend_string *s)
13671367

13681368
while (c < e) {
13691369
if (islower(*c)) {
1370-
register unsigned char *r;
1370+
unsigned char *r;
13711371
zend_string *res = zend_string_alloc(ZSTR_LEN(s), 0);
13721372

13731373
if (c != (unsigned char*)ZSTR_VAL(s)) {
@@ -1432,7 +1432,7 @@ PHPAPI zend_string *php_string_tolower(zend_string *s)
14321432

14331433
while (c < e) {
14341434
if (isupper(*c)) {
1435-
register unsigned char *r;
1435+
unsigned char *r;
14361436
zend_string *res = zend_string_alloc(ZSTR_LEN(s), 0);
14371437

14381438
if (c != (unsigned char*)ZSTR_VAL(s)) {
@@ -1764,8 +1764,8 @@ PHPAPI char *php_stristr(char *s, char *t, size_t s_len, size_t t_len)
17641764
/* {{{ php_strspn */
17651765
PHPAPI size_t php_strspn(const char *s1, const char *s2, const char *s1_end, const char *s2_end)
17661766
{
1767-
register const char *p = s1, *spanp;
1768-
register char c = *p;
1767+
const char *p = s1, *spanp;
1768+
char c = *p;
17691769

17701770
cont:
17711771
for (spanp = s2; p != s1_end && spanp != s2_end;) {
@@ -1781,8 +1781,8 @@ PHPAPI size_t php_strspn(const char *s1, const char *s2, const char *s1_end, con
17811781
/* {{{ php_strcspn */
17821782
PHPAPI size_t php_strcspn(const char *s1, const char *s2, const char *s1_end, const char *s2_end)
17831783
{
1784-
register const char *p, *spanp;
1785-
register char c = *s1;
1784+
const char *p, *spanp;
1785+
char c = *s1;
17861786

17871787
for (p = s1;;) {
17881788
spanp = s2;
@@ -2667,8 +2667,8 @@ PHP_FUNCTION(ucwords)
26672667
{
26682668
zend_string *str;
26692669
char *delims = " \t\r\n\f\v";
2670-
register char *r;
2671-
register const char *r_end;
2670+
char *r;
2671+
const char *r_end;
26722672
size_t delims_len = 6;
26732673
char mask[256];
26742674

ext/standard/url.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ static int php_htoi(char *s)
459459
static const unsigned char hexchars[] = "0123456789ABCDEF";
460460

461461
static zend_always_inline zend_string *php_url_encode_impl(const char *s, size_t len, bool raw) /* {{{ */ {
462-
register unsigned char c;
462+
unsigned char c;
463463
unsigned char *to;
464464
unsigned char const *from, *end;
465465
zend_string *start;

ext/zlib/zlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ PHP_FUNCTION(gzfile)
612612
size_t filename_len;
613613
int flags = REPORT_ERRORS;
614614
char buf[8192] = {0};
615-
register int i = 0;
615+
int i = 0;
616616
zend_long use_include_path = 0;
617617
php_stream *stream;
618618

0 commit comments

Comments
 (0)