aboutsummaryrefslogtreecommitdiffstats
path: root/src/song.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-29 15:52:30 +0200
committerMax Kellermann <max@duempel.org>2008-09-29 15:52:30 +0200
commit35d519625d1748e00f05fa66252c938c1cd2c5d8 (patch)
treea02a89a1182fdfad618fe728c2e4d48932982614 /src/song.h
parente8e94382554320c078397a3c053be4fb2f31baeb (diff)
downloadmpd-35d519625d1748e00f05fa66252c938c1cd2c5d8.tar.gz
mpd-35d519625d1748e00f05fa66252c938c1cd2c5d8.tar.xz
mpd-35d519625d1748e00f05fa66252c938c1cd2c5d8.zip
song: converted "type" to enum
Having an enum type is much nicer than an anonymous integer plus CPP macros. Note that the old code didn't save any space by declaring the variable 8 bit, due to padding.
Diffstat (limited to 'src/song.h')
-rw-r--r--src/song.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/song.h b/src/song.h
index 00629d702..5b1be84c0 100644
--- a/src/song.h
+++ b/src/song.h
@@ -25,8 +25,10 @@
#define SONG_BEGIN "songList begin"
#define SONG_END "songList end"
-#define SONG_TYPE_FILE 1
-#define SONG_TYPE_URL 2
+enum song_type {
+ SONG_TYPE_FILE = 1,
+ SONG_TYPE_URL = 2
+};
#define SONG_FILE "file: "
#define SONG_TIME "Time: "
@@ -35,7 +37,7 @@ struct client;
typedef struct _Song {
char *url;
- int8_t type;
+ enum song_type type;
struct tag *tag;
struct _Directory *parentDir;
time_t mtime;
@@ -43,7 +45,8 @@ typedef struct _Song {
Song *newNullSong(void);
-Song *newSong(const char *url, int songType, struct _Directory *parentDir);
+Song *newSong(const char *url, enum song_type type,
+ struct _Directory *parentDir);
void freeSong(Song *);