From 161f7ced96e8e6c08a51824720eeb6666a659ed0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 17 Oct 2013 00:48:58 +0200 Subject: [PATCH] ArchiveLookup: declare local variables later --- src/ArchiveLookup.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ArchiveLookup.cxx b/src/ArchiveLookup.cxx index f906ae8cf..68458723c 100644 --- a/src/ArchiveLookup.cxx +++ b/src/ArchiveLookup.cxx @@ -56,16 +56,15 @@ bool archive_lookup(char *pathname, const char **archive, const char **inpath, const char **suffix) { - char *pathdupe; - int len, idx; - struct stat st_info; bool ret = false; - pathdupe = g_strdup(pathname); - len = idx = strlen(pathname); + char *const pathdupe = g_strdup(pathname); + const size_t len = strlen(pathname); + size_t idx = len; while (idx > 0) { //try to stat if its real directory + struct stat st_info; if (stat(pathdupe, &st_info) == -1) { if (errno != ENOTDIR) { FormatErrno(archive_domain,