]> granicus.if.org Git - curl/commitdiff
rawstr: Speed up Curl_raw_toupper by 40%
authorLauri Kasanen <cand@gmx.com>
Mon, 2 Nov 2015 20:18:03 +0000 (21:18 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 2 Nov 2015 21:57:13 +0000 (22:57 +0100)
Rationale: when starting up a curl-using app, all cookies from the jar
are checked against each other. This was causing a startup delay in the
Fifth browser.

All tests pass.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
lib/rawstr.c

index e27dac4a80b0b9c668ed6a9426b292e1634872b1..31633b9fabe5847d2c404427ea9627d1e6e91a83 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
    its behavior is altered by the current locale. */
 char Curl_raw_toupper(char in)
 {
+#if !defined(CURL_DOES_CONVERSIONS)
+  if(in >= 'a' && in <= 'z')
+    return (char)('A' + in - 'a');
+#else
   switch (in) {
   case 'a':
     return 'A';
@@ -82,6 +86,8 @@ char Curl_raw_toupper(char in)
   case 'z':
     return 'Z';
   }
+#endif
+
   return in;
 }