]> granicus.if.org Git - apache/commitdiff
cleanup current_logtime function.
authorAndré Malo <nd@apache.org>
Mon, 28 Jul 2003 13:02:37 +0000 (13:02 +0000)
committerAndré Malo <nd@apache.org>
Mon, 28 Jul 2003 13:02:37 +0000 (13:02 +0000)
use sizeof where sizeof should be used.
don't compute strlen again and again (use the supplied value
from apr_strftime instead).

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100810 13f79535-47bb-0310-9956-ffa450edef68

modules/mappers/mod_rewrite.c

index 6fbff0b592c9bd63c00a7613e1efaff8e50b455d..a594773798ff8baa7e5eea53c8b0b76548957d6f 100644 (file)
@@ -372,10 +372,11 @@ static char *current_logtime(request_rec *r)
 
     apr_time_exp_lt(&t, apr_time_now());
 
-    apr_strftime(tstr, &len, 80, "[%d/%b/%Y:%H:%M:%S ", &t);
-    apr_snprintf(tstr + strlen(tstr), 80-strlen(tstr), "%c%.2d%.2d]",
+    apr_strftime(tstr, &len, sizeof(tstr), "[%d/%b/%Y:%H:%M:%S ", &t);
+    apr_snprintf(tstr+len, sizeof(tstr)-len, "%c%.2d%.2d]",
                  t.tm_gmtoff < 0 ? '-' : '+',
                  t.tm_gmtoff / (60*60), t.tm_gmtoff % (60*60));
+
     return apr_pstrdup(r->pool, tstr);
 }