com php-src: avoid strlen() usage in loop: ext/date/lib/timelib.c

From: Date: Sun, 14 Sep 2014 15:00:06 +0000
Subject: com php-src: avoid strlen() usage in loop: ext/date/lib/timelib.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81613@lists.php.net to get a copy of this message
Commit: ad9dc751509a53a7930e8716db6b51b489866328 Author: Anatol Belski <ab@php.net> Sun, 14 Sep 2014 17:00:06 +0200 Parents: 29f8b21cd71bc4af1ead7b8a93cfe09338d2eff5 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ad9dc751509a53a7930e8716db6b51b489866328 Log: avoid strlen() usage in loop Changed paths: M ext/date/lib/timelib.c Diff: diff --git a/ext/date/lib/timelib.c b/ext/date/lib/timelib.c index 716975a..4fe327e 100644 --- a/ext/date/lib/timelib.c +++ b/ext/date/lib/timelib.c @@ -71,10 +71,11 @@ timelib_rel_time* timelib_rel_time_clone(timelib_rel_time *rel) void timelib_time_tz_abbr_update(timelib_time* tm, char* tz_abbr) { unsigned int i; + size_t tz_abbr_len = strlen(tz_abbr); TIMELIB_TIME_FREE(tm->tz_abbr); tm->tz_abbr = strdup(tz_abbr); - for (i = 0; i < strlen(tz_abbr); i++) { + for (i = 0; i < tz_abbr_len; i++) { tm->tz_abbr[i] = toupper(tz_abbr[i]); } }

« previous php.cvs (#81613) next »