diff --git a/src/db.c b/src/db.c index 28813b9e..f7066189 100644 --- a/src/db.c +++ b/src/db.c @@ -27,8 +27,6 @@ #include #include -#include - #include #include @@ -53,9 +51,6 @@ struct col_type_map { short type; }; -#define mfi_offsetof(field) offsetof(struct media_file_info, field) -#define pli_offsetof(field) offsetof(struct playlist_info, field) - /* This list must be kept in sync with * - the order of the columns in the files table * - the type and name of the fields in struct media_file_info @@ -124,9 +119,6 @@ static struct col_type_map pli_cols_map[] = /* items is computed on the fly */ }; -#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field) -#define dbpli_offsetof(field) offsetof(struct db_playlist_info, field) - /* This list must be kept in sync with * - the order of the columns in the files table * - the name of the fields in struct db_media_file_info @@ -195,8 +187,6 @@ static ssize_t dbpli_cols_map[] = /* items is computed on the fly */ }; -#define wi_offsetof(field) offsetof(struct watch_info, field) - /* This list must be kept in sync with * - the order of the columns in the inotify table * - the name and type of the fields in struct watch_info diff --git a/src/db.h b/src/db.h index 1dc0caca..1187304a 100644 --- a/src/db.h +++ b/src/db.h @@ -3,7 +3,7 @@ #define __DB_H__ #include - +#include #include #include @@ -105,6 +105,8 @@ struct media_file_info { char *album_artist; }; +#define mfi_offsetof(field) offsetof(struct media_file_info, field) + struct playlist_info { uint32_t id; /* integer id (miid) */ char *title; /* playlist name as displayed in iTunes (minm) */ @@ -117,6 +119,8 @@ struct playlist_info { uint32_t index; /* index of playlist for paths with multiple playlists */ }; +#define pli_offsetof(field) offsetof(struct playlist_info, field) + struct db_playlist_info { char *id; char *title; @@ -129,6 +133,8 @@ struct db_playlist_info { char *index; }; +#define dbpli_offsetof(field) offsetof(struct db_playlist_info, field) + struct db_media_file_info { char *id; char *path; @@ -174,6 +180,8 @@ struct db_media_file_info { char *album_artist; }; +#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field) + struct watch_info { int wd; char *path; @@ -181,6 +189,8 @@ struct watch_info { int libidx; }; +#define wi_offsetof(field) offsetof(struct watch_info, field) + struct watch_enum { uint32_t cookie; char *match; diff --git a/src/filescanner_ffmpeg.c b/src/filescanner_ffmpeg.c index e4572f79..8e6680bd 100644 --- a/src/filescanner_ffmpeg.c +++ b/src/filescanner_ffmpeg.c @@ -30,9 +30,6 @@ #include #endif -#include -#include - #include #include @@ -58,8 +55,6 @@ struct metadata_map { size_t offset; }; -#define mfi_offsetof(field) offsetof(struct media_file_info, field) - /* Lookup is case-insensitive, first occurrence takes precedence */ static struct metadata_map md_map[] = { diff --git a/src/httpd_daap.c b/src/httpd_daap.c index 122b2b88..64cd9268 100644 --- a/src/httpd_daap.c +++ b/src/httpd_daap.c @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -74,10 +73,6 @@ struct dmap_field_map { ssize_t pli_offset; }; - -#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field) -#define dbpli_offsetof(field) offsetof(struct db_playlist_info, field) - static struct dmap_field_map dmap_fields[] = { { 0, DMAP_TYPE_INT, "miid", "dmap.itemid", diff --git a/src/httpd_rsp.c b/src/httpd_rsp.c index 4fc059c3..7691ed95 100644 --- a/src/httpd_rsp.c +++ b/src/httpd_rsp.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include @@ -69,9 +68,6 @@ struct uri_map { void (*handler)(struct evhttp_request *req, char **uri, struct evkeyvalq *query); }; - -#define dbpli_offsetof(field) offsetof(struct db_playlist_info, field) - static struct field_map pl_fields[] = { { "id", dbpli_offsetof(id), F_ALWAYS }, @@ -85,8 +81,6 @@ static struct field_map pl_fields[] = { NULL, 0, 0 } }; -#define dbmfi_offsetof(field) offsetof(struct db_media_file_info, field) - static struct field_map rsp_fields[] = { { "id", dbmfi_offsetof(id), F_ALWAYS },