cURL / Mailing Lists / curl-library / Single Mail

curl-library

[PATCH/RFC] Remove use of register keyword

From: Tor Arntsen <tor_at_spacetec.no>
Date: Thu, 27 May 2010 13:12:41 +0200

Using the 'register' keyword rarely improves anything with
modern compilers and architectures.

---
This patch is just for consideration. Using 'register' is a bit
old-fashioned these days, don't you think? I did some comparision
of the generated assembly code on x86_64 with and without 'register',
and as far as I can tell there is no improvement to the generated code
when 'register' is used, some parts even look slightly worse.
 lib/curl_fnmatch.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/curl_fnmatch.c b/lib/curl_fnmatch.c
index dc9dd60..410938a 100644
--- a/lib/curl_fnmatch.c
+++ b/lib/curl_fnmatch.c
@@ -67,7 +67,7 @@ static int parsekeyword(unsigned char **pattern, unsigned char *charset)
   char keyword[KEYLEN] = { 0 };
   int found = FALSE;
   int i;
-  register unsigned char *p = *pattern;
+  unsigned char *p = *pattern;
   for(i = 0; !found; i++) {
     char c = *p++;
     if(i >= KEYLEN)
@@ -123,7 +123,7 @@ static int setcharset(unsigned char **p, unsigned char *charset)
   unsigned char rangestart = 0;
   unsigned char lastchar   = 0;
   bool something_found = FALSE;
-  register unsigned char c;
+  unsigned char c;
   for(;;) {
     c = **p;
     switch(state) {
@@ -300,8 +300,8 @@ static int setcharset(unsigned char **p, unsigned char *charset)
 static int loop(const unsigned char *pattern, const unsigned char *string)
 {
   loop_state state = CURLFNM_LOOP_DEFAULT;
-  register unsigned char *p = (unsigned char *)pattern;
-  register unsigned char *s = (unsigned char *)string;
+  unsigned char *p = (unsigned char *)pattern;
+  unsigned char *s = (unsigned char *)string;
   unsigned char charset[CURLFNM_CHSET_SIZE] = { 0 };
   int rc = 0;
 
-- 
1.7.1
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-05-27