From 98759f7bed3768ef150dcd41f97f87cbb84be8b1 Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 21 Dec 2020 16:38:28 +0100 Subject: Remove cppcheck warnings about the variable scope can be reduced --- src/fr-command-cpio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/fr-command-cpio.c') diff --git a/src/fr-command-cpio.c b/src/fr-command-cpio.c index 457de72..1b380ad 100644 --- a/src/fr-command-cpio.c +++ b/src/fr-command-cpio.c @@ -49,19 +49,21 @@ mktime_from_string (char *month, char *mday, char *year) { - static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; struct tm tm = {0, }; tm.tm_isdst = -1; if (month != NULL) { + static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; int i; - for (i = 0; i < 12; i++) + + for (i = 0; i < 12; i++) { if (strcmp (months[i], month) == 0) { tm.tm_mon = i; break; } + } } tm.tm_mday = atoi (mday); if (strchr (year, ':') != NULL) { -- cgit v1.2.1