]> granicus.if.org Git - php/commitdiff
avoid strlen() usage in loop
authorAnatol Belski <ab@php.net>
Sun, 14 Sep 2014 15:00:06 +0000 (17:00 +0200)
committerAnatol Belski <ab@php.net>
Sun, 14 Sep 2014 15:00:06 +0000 (17:00 +0200)
ext/date/lib/timelib.c

index 716975a90f1544581aee829ed05117c8140d0e6f..4fe327ed598ce9c0c6b0555c1169356114748c5f 100644 (file)
@@ -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]);
        }
 }