aboutsummaryrefslogtreecommitdiffstats
path: root/src/ls.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-01-26 12:46:21 +0000
committerEric Wong <normalperson@yhbt.net>2008-01-26 12:46:21 +0000
commit07adb14e3c4daa8b1e6ebc69e54128b38b014d30 (patch)
tree7d22b4b2eb31a9bf46cf648731fe1370005ab1c9 /src/ls.c
parent28008e697720bb2b11989bb887eb468b91409b1a (diff)
downloadmpd-07adb14e3c4daa8b1e6ebc69e54128b38b014d30.tar.gz
mpd-07adb14e3c4daa8b1e6ebc69e54128b38b014d30.tar.xz
mpd-07adb14e3c4daa8b1e6ebc69e54128b38b014d30.zip
fixed -Wshadow warnings
Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/ls.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/ls.c b/src/ls.c
index 7a10448d9..d06ae350d 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -103,7 +103,7 @@ int lsPlaylists(int fd, char *utf8path)
DIR *dir;
struct stat st;
struct dirent *ent;
- char *dup;
+ char *duplicated;
char *utf8;
char s[MPD_PATH_MAX];
char path_max_tmp[MPD_PATH_MAX];
@@ -128,21 +128,20 @@ int lsPlaylists(int fd, char *utf8path)
while ((ent = readdir(dir))) {
size_t len = strlen(ent->d_name) + 1;
- dup = ent->d_name;
+ duplicated = ent->d_name;
if (mpd_likely(len <= maxlen) &&
- dup[0] != '.' &&
- (suff = strlen(dup) - suflen) > 0 &&
- dup[suff] == '.' &&
- strcmp(dup + suff + 1, PLAYLIST_FILE_SUFFIX) == 0) {
+ duplicated[0] != '.' &&
+ (suff = strlen(duplicated) - suflen) > 0 &&
+ duplicated[suff] == '.' &&
+ strcmp(duplicated + suff + 1, PLAYLIST_FILE_SUFFIX) == 0) {
memcpy(s + actlen, ent->d_name, len);
if (stat(s, &st) == 0) {
if (S_ISREG(st.st_mode)) {
- char path_max_tmp[MPD_PATH_MAX];
if (list == NULL)
list = makeList(NULL, 1);
- dup[suff] = '\0';
+ duplicated[suff] = '\0';
utf8 = fs_charset_to_utf8(path_max_tmp,
- dup);
+ duplicated);
if (utf8)
insertInList(list, utf8, NULL);
}
@@ -156,25 +155,27 @@ int lsPlaylists(int fd, char *utf8path)
int i;
sortList(list);
- dup = xmalloc(strlen(utf8path) + 2);
- strcpy(dup, utf8path);
- for (i = strlen(dup) - 1; i >= 0 && dup[i] == '/'; i--) {
- dup[i] = '\0';
+ duplicated = xmalloc(strlen(utf8path) + 2);
+ strcpy(duplicated, utf8path);
+ for (i = strlen(duplicated) - 1;
+ i >= 0 && duplicated[i] == '/';
+ i--) {
+ duplicated[i] = '\0';
}
- if (strlen(dup))
- strcat(dup, "/");
+ if (strlen(duplicated))
+ strcat(duplicated, "/");
node = list->firstNode;
while (node != NULL) {
if (!strchr(node->key, '\n')) {
- fdprintf(fd, "playlist: %s%s\n", dup,
+ fdprintf(fd, "playlist: %s%s\n", duplicated,
node->key);
}
node = node->nextNode;
}
freeList(list);
- free(dup);
+ free(duplicated);
}
return 0;