]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - lib/kstrtox.c
rfkill.txt: standardize document format
[karo-tx-linux.git] / lib / kstrtox.c
index bf85e05ce85815a0fb36ab26f9e5642dd455ae1a..720144075c1ea06b659ab7a15512ca6b3a1bba24 100644 (file)
@@ -51,13 +51,15 @@ unsigned int _parse_integer(const char *s, unsigned int base, unsigned long long
 
        res = 0;
        rv = 0;
-       while (*s) {
+       while (1) {
+               unsigned int c = *s;
+               unsigned int lc = c | 0x20; /* don't tolower() this line */
                unsigned int val;
 
-               if ('0' <= *s && *s <= '9')
-                       val = *s - '0';
-               else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
-                       val = _tolower(*s) - 'a' + 10;
+               if ('0' <= c && c <= '9')
+                       val = c - '0';
+               else if ('a' <= lc && lc <= 'f')
+                       val = lc - 'a' + 10;
                else
                        break;