aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-17 00:48:58 +0200
committerMax Kellermann <max@duempel.org>2013-10-17 00:48:58 +0200
commit161f7ced96e8e6c08a51824720eeb6666a659ed0 (patch)
treee70eaa425fa432654a7baf4dd9efdcd309fef804
parent72bc11b180dd024eca54b1ee1e64e916643b0936 (diff)
downloadmpd-161f7ced96e8e6c08a51824720eeb6666a659ed0.tar.gz
mpd-161f7ced96e8e6c08a51824720eeb6666a659ed0.tar.xz
mpd-161f7ced96e8e6c08a51824720eeb6666a659ed0.zip
ArchiveLookup: declare local variables later
-rw-r--r--src/ArchiveLookup.cxx9
1 files 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,