about summary refs log tree commit homepage
path: root/ext/unicorn_http/common_field_optimization.h
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-02-18 18:44:38 -0800
committerEric Wong <normalperson@yhbt.net>2010-02-18 19:30:51 -0800
commit4347b8987732b5bea83ddb8fb9605cf2c4a1c2fe (patch)
tree1b173bd6184ef285122cfafb872260183f1eed27 /ext/unicorn_http/common_field_optimization.h
parent3e80ccb60e2b3632916094ac436806ab1cf03b11 (diff)
downloadunicorn-4347b8987732b5bea83ddb8fb9605cf2c4a1c2fe.tar.gz
We never come close to the signed limits anywhere, so it
should be safe either way, but make paranoid compiler settings
less noisy if possible.
Diffstat (limited to 'ext/unicorn_http/common_field_optimization.h')
-rw-r--r--ext/unicorn_http/common_field_optimization.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/unicorn_http/common_field_optimization.h b/ext/unicorn_http/common_field_optimization.h
index 850fb90..42c5430 100644
--- a/ext/unicorn_http/common_field_optimization.h
+++ b/ext/unicorn_http/common_field_optimization.h
@@ -67,7 +67,7 @@ static void init_common_fields(void)
   char tmp[64];
   memcpy(tmp, HTTP_PREFIX, HTTP_PREFIX_LEN);
 
-  for(i = 0; i < ARRAY_SIZE(common_http_fields); cf++, i++) {
+  for(i = ARRAY_SIZE(common_http_fields); --i >= 0; cf++) {
     /* Rack doesn't like certain headers prefixed with "HTTP_" */
     if (!strcmp("CONTENT_LENGTH", cf->name) ||
         !strcmp("CONTENT_TYPE", cf->name)) {
@@ -87,8 +87,8 @@ static VALUE find_common_field(const char *field, size_t flen)
   int i;
   struct common_field *cf = common_http_fields;
 
-  for(i = 0; i < ARRAY_SIZE(common_http_fields); i++, cf++) {
-    if (cf->len == flen && !memcmp(cf->name, field, flen))
+  for(i = ARRAY_SIZE(common_http_fields); --i >= 0; cf++) {
+    if (cf->len == (long)flen && !memcmp(cf->name, field, flen))
       return cf->value;
   }
   return Qnil;