diff options
author | Max Kellermann <max@duempel.org> | 2009-12-16 17:27:52 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-12-16 17:27:52 +0100 |
commit | 67c41033c189f1efccdc4e40a7916c2ad46e40a6 (patch) | |
tree | 4301cc4cc19a7d91938b7488d963145fa29ede7d | |
parent | 59534b92d22b2bd42c3c222e00c2e5563402aeb0 (diff) | |
download | mpd-67c41033c189f1efccdc4e40a7916c2ad46e40a6.tar.gz mpd-67c41033c189f1efccdc4e40a7916c2ad46e40a6.tar.xz mpd-67c41033c189f1efccdc4e40a7916c2ad46e40a6.zip |
cue_tag: merged code into cue_tag_merge()
Diffstat (limited to '')
-rw-r--r-- | src/cue/cue_tag.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/cue/cue_tag.c b/src/cue/cue_tag.c index 15cf00155..70f7fc767 100644 --- a/src/cue/cue_tag.c +++ b/src/cue/cue_tag.c @@ -155,6 +155,22 @@ cue_tag_track(struct Cdtext *cdtext, struct Rem *rem) return tag; } +static struct tag * +cue_tag_merge(struct tag *a, struct tag *b) +{ + if (a != NULL && b != NULL) { + struct tag *merge_tag = tag_merge(a, b); + tag_free(a); + tag_free(b); + return merge_tag; + } else if (a != NULL) + return a; + else if (b != NULL) + return b; + else + return NULL; +} + struct tag * cue_tag_file(FILE *fp, unsigned tnum) { @@ -179,17 +195,7 @@ cue_tag_file(FILE *fp, unsigned tnum) cd_delete(cd); - if (cd_tag != NULL && track_tag != NULL) { - struct tag *merge_tag = tag_merge(cd_tag, track_tag); - tag_free(cd_tag); - tag_free(track_tag); - return merge_tag; - } else if (cd_tag != NULL) - return cd_tag; - else if (track_tag != NULL) - return track_tag; - else - return NULL; + return cue_tag_merge(cd_tag, track_tag); } struct tag * @@ -216,15 +222,5 @@ cue_tag_string(const char *str, unsigned tnum) cd_delete(cd); - if (cd_tag != NULL && track_tag != NULL) { - struct tag *merge_tag = tag_merge(cd_tag, track_tag); - tag_free(cd_tag); - tag_free(track_tag); - return merge_tag; - } else if (cd_tag != NULL) - return cd_tag; - else if (track_tag != NULL) - return track_tag; - else - return NULL; + return cue_tag_merge(cd_tag, track_tag); } |