aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2006-03-26 19:31:22 +0000
committerEric Wong <normalperson@yhbt.net>2006-03-26 19:31:22 +0000
commit171e1e9d7240fd760e03b779897301fd28319825 (patch)
tree0fb861ef6e0ae2dae5818e0e6a50e2161cbde23d /src
parent10afe91c64ac147a14801147c207067bade20a5c (diff)
downloadmpd-171e1e9d7240fd760e03b779897301fd28319825.tar.gz
mpd-171e1e9d7240fd760e03b779897301fd28319825.tar.xz
mpd-171e1e9d7240fd760e03b779897301fd28319825.zip
src/playlist.c: remove unnecessary strdup()
Yes, I know about what I said on IRC earlier, but this is an allocation + free inside a loop. git-svn-id: https://svn.musicpd.org/mpd/trunk@3953 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src')
-rw-r--r--src/playlist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/playlist.c b/src/playlist.c
index 2edf4cb7d..d122948e5 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -1461,12 +1461,13 @@ static int PlaylistIterFunc(FILE * fp, char * utf8file, void (*IterFunc)(FILE *f
slength = 0;
temp = fsCharsetToUtf8(s);
if(!temp) continue;
- /* Needed to make a copy? */
if(!commentCharFound)
{
- temp = strdup(temp);
- IterFunc(fp, temp, &erroredFile);
- free(temp);
+ /* using temp directly should be safe,
+ * for our current IterFunction set
+ * but just in case, we copy to s */
+ strcpy(s, temp);
+ IterFunc(fp, s, &erroredFile);
}
}
else if(slength==MAXPATHLEN) {