mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-26 14:13:18 -05:00
Move *_offsetof() macro definitions to db.h
This commit is contained in:
parent
1f92052409
commit
e1c0b6d4b7
10
src/db.c
10
src/db.c
@ -27,8 +27,6 @@
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <sqlite3.h>
|
||||
@ -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
|
||||
|
12
src/db.h
12
src/db.h
@ -3,7 +3,7 @@
|
||||
#define __DB_H__
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sqlite3.h>
|
||||
@ -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;
|
||||
|
@ -30,9 +30,6 @@
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
|
||||
@ -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[] =
|
||||
{
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <sys/queue.h>
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
@ -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",
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include <sys/queue.h>
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <event.h>
|
||||
@ -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 },
|
||||
|
Loading…
x
Reference in New Issue
Block a user