From: André Malo Date: Mon, 28 Jul 2003 13:02:37 +0000 (+0000) Subject: cleanup current_logtime function. X-Git-Tag: pre_ajp_proxy~1346 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ed491cbf6b60df0a239a5eae1f3c1bdd1dfd80fa;p=apache cleanup current_logtime function. 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 --- diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index 6fbff0b592..a594773798 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -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); }