]> git.kaiwu.me - nginx.git/commitdiff
break cycle early
authorIgor Sysoev <igor@sysoev.ru>
Thu, 24 Jun 2010 13:16:19 +0000 (13:16 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Thu, 24 Jun 2010 13:16:19 +0000 (13:16 +0000)
src/http/modules/ngx_http_geo_module.c

index 40c11f25f1784547ad887ff96cb659d71eb82d3b..8d96ff202a8dcc8f7933e9e678ff88400fbbb360 100644 (file)
@@ -166,10 +166,10 @@ ngx_http_geo_range_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v,
     n = addr & 0xffff;
 
     for (i = 0; i < ctx->u.high->low[addr >> 16].n; i++) {
-        if (n >= (ngx_uint_t) range[i].start
-            && n <= (ngx_uint_t) range[i].end)
+        if (n >= (ngx_uint_t) range[i].start && n <= (ngx_uint_t) range[i].end)
         {
             *v = *range[i].value;
+            break;
         }
     }