[nginx] Refactored ngx_parse_time().

Maxim Dounin mdounin at mdounin.ru
Tue Apr 7 13:04:56 UTC 2015


details:   http://hg.nginx.org/nginx/rev/54da18a533df
branches:  stable-1.6
changeset: 6084:54da18a533df
user:      Ruslan Ermilov <ru at nginx.com>
date:      Tue Mar 17 00:26:18 2015 +0300
description:
Refactored ngx_parse_time().

No functional changes.

diffstat:

 src/core/ngx_parse.c |  4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diffs (28 lines):

diff --git a/src/core/ngx_parse.c b/src/core/ngx_parse.c
--- a/src/core/ngx_parse.c
+++ b/src/core/ngx_parse.c
@@ -121,7 +121,6 @@ ngx_parse_time(ngx_str_t *line, ngx_uint
     value = 0;
     total = 0;
     step = is_sec ? st_start : st_month;
-    scale = is_sec ? 1 : 1000;
 
     p = line->data;
     last = p + line->len;
@@ -239,7 +238,6 @@ ngx_parse_time(ngx_str_t *line, ngx_uint
         }
 
         value = 0;
-        scale = is_sec ? 1 : 1000;
 
         while (p < last && *p == ' ') {
             p++;
@@ -247,7 +245,7 @@ ngx_parse_time(ngx_str_t *line, ngx_uint
     }
 
     if (valid) {
-        return total + value * scale;
+        return total + value * (is_sec ? 1 : 1000);
     }
 
     return NGX_ERROR;



More information about the nginx-devel mailing list