aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-16 17:00:05 +0100
committerMax Kellermann <max@duempel.org>2009-12-16 17:26:20 +0100
commit41a48b14e3cbe3935f8233341cdf3e327429da84 (patch)
tree1f871454d4612f64d320d4a791bdd658c43e20da
parent5821bd1a214d39ff68f356950fac8b9c5b25d46e (diff)
downloadmpd-41a48b14e3cbe3935f8233341cdf3e327429da84.tar.gz
mpd-41a48b14e3cbe3935f8233341cdf3e327429da84.tar.xz
mpd-41a48b14e3cbe3935f8233341cdf3e327429da84.zip
cue_tag: changed runtime checks to assertions
It's illegal to pass NULL here. This should not be ignored silently.
-rw-r--r--src/cue/cue_tag.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/cue/cue_tag.c b/src/cue/cue_tag.c
index e6a8a8545..9d3385981 100644
--- a/src/cue/cue_tag.c
+++ b/src/cue/cue_tag.c
@@ -3,6 +3,7 @@
#include "tag.h"
#include <libcue/libcue.h>
+#include <assert.h>
static struct tag *
cue_tag_cd(struct Cdtext *cdtext, struct Rem *rem)
@@ -10,8 +11,7 @@ cue_tag_cd(struct Cdtext *cdtext, struct Rem *rem)
struct tag *tag;
char *tmp;
- //if (cdtext == NULL)
- //return NULL;
+ assert(cdtext != NULL);
tag = tag_new();
@@ -98,8 +98,7 @@ cue_tag_track(struct Cdtext *cdtext, struct Rem *rem)
struct tag *tag;
char *tmp;
- //if (cdtext == NULL)
- //return NULL;
+ assert(cdtext != NULL);
tag = tag_new();
@@ -162,14 +161,12 @@ cue_tag_file(FILE *fp, unsigned tnum)
struct Cd *cd;
struct tag *cd_tag, *track_tag;
- if (tnum > 256)
- return NULL;
+ assert(fp != NULL);
- if (fp == NULL)
+ if (tnum > 256)
return NULL;
- else
- cd = cue_parse_file(fp);
+ cd = cue_parse_file(fp);
if (cd == NULL)
return NULL;
@@ -201,14 +198,12 @@ cue_tag_string(char *str, unsigned tnum)
struct Cd *cd;
struct tag *cd_tag, *track_tag;
- if (tnum > 256)
- return NULL;
+ assert(str != NULL);
- if (str == NULL)
+ if (tnum > 256)
return NULL;
- else
- cd = cue_parse_string(str);
+ cd = cue_parse_string(str);
if (cd == NULL)
return NULL;