TagPool, ...: include cleanup

This commit is contained in:
Max Kellermann 2013-01-30 22:53:12 +01:00
parent 378ebad1c8
commit 5ed9f02c4d
26 changed files with 49 additions and 80 deletions

View File

@ -32,8 +32,6 @@
#include <string> #include <string>
#include <list> #include <list>
#include <glib.h>
#undef G_LOG_DOMAIN #undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "client" #define G_LOG_DOMAIN "client"
@ -129,17 +127,7 @@ extern int client_timeout;
extern size_t client_max_command_list_size; extern size_t client_max_command_list_size;
extern size_t client_max_output_buffer_size; extern size_t client_max_output_buffer_size;
enum command_return
client_read(Client *client);
enum command_return enum command_return
client_process_line(Client *client, char *line); client_process_line(Client *client, char *line);
void
client_write_output(Client *client);
gboolean
client_in_event(GIOChannel *source, GIOCondition condition,
gpointer data);
#endif #endif

View File

@ -22,8 +22,7 @@
#include "command.h" #include "command.h"
#include "playlist_error.h" #include "playlist_error.h"
#include "gerror.h"
#include <glib.h>
class Client; class Client;

View File

@ -21,11 +21,9 @@
#define MPD_DATABASE_SIMPLE_HXX #define MPD_DATABASE_SIMPLE_HXX
#include "gcc.h" #include "gcc.h"
#include "gerror.h"
#include <glib.h>
#include <sys/time.h> #include <sys/time.h>
#include <stdbool.h>
struct config_param; struct config_param;
struct Directory; struct Directory;

View File

@ -25,8 +25,8 @@
#include "gcc.h" #include "gcc.h"
#include "DatabaseVisitor.hxx" #include "DatabaseVisitor.hxx"
#include "PlaylistVector.hxx" #include "PlaylistVector.hxx"
#include "gerror.h"
#include <glib.h>
#include <stdbool.h> #include <stdbool.h>
#include <sys/types.h> #include <sys/types.h>

View File

@ -20,7 +20,7 @@
#ifndef MPD_DIRECTORY_SAVE_HXX #ifndef MPD_DIRECTORY_SAVE_HXX
#define MPD_DIRECTORY_SAVE_HXX #define MPD_DIRECTORY_SAVE_HXX
#include <glib.h> #include "gerror.h"
#include <stdio.h> #include <stdio.h>

View File

@ -24,8 +24,6 @@
#include "gerror.h" #include "gerror.h"
#include "gcc.h" #include "gcc.h"
#include <glib.h>
typedef void (*mpd_inotify_callback_t)(int wd, unsigned mask, typedef void (*mpd_inotify_callback_t)(int wd, unsigned mask,
const char *name, void *ctx); const char *name, void *ctx);

View File

@ -22,8 +22,6 @@
#include "replay_gain_info.h" #include "replay_gain_info.h"
#include <glib.h>
#include <stddef.h> #include <stddef.h>
struct audio_output; struct audio_output;
@ -32,12 +30,6 @@ struct config_param;
struct music_pipe; struct music_pipe;
struct player_control; struct player_control;
static inline GQuark
audio_output_quark(void)
{
return g_quark_from_static_string("audio_output");
}
void void
audio_output_set_replay_gain_mode(struct audio_output *ao, audio_output_set_replay_gain_mode(struct audio_output *ao,
enum replay_gain_mode mode); enum replay_gain_mode mode);

View File

@ -20,6 +20,7 @@
#include "config.h" #include "config.h"
#include "OutputControl.hxx" #include "OutputControl.hxx"
#include "OutputList.hxx" #include "OutputList.hxx"
#include "OutputError.hxx"
#include "FilterConfig.hxx" #include "FilterConfig.hxx"
#include "output_api.h" #include "output_api.h"
#include "AudioParser.hxx" #include "AudioParser.hxx"
@ -65,7 +66,7 @@ audio_output_detect(GError **error)
return plugin; return plugin;
} }
g_set_error(error, audio_output_quark(), 0, g_set_error(error, output_quark(), 0,
"Unable to detect an audio device"); "Unable to detect an audio device");
return NULL; return NULL;
} }
@ -148,7 +149,7 @@ ao_base_init(struct audio_output *ao,
ao->name = config_get_block_string(param, AUDIO_OUTPUT_NAME, ao->name = config_get_block_string(param, AUDIO_OUTPUT_NAME,
NULL); NULL);
if (ao->name == NULL) { if (ao->name == NULL) {
g_set_error(error_r, audio_output_quark(), 0, g_set_error(error_r, output_quark(), 0,
"Missing \"name\" configuration"); "Missing \"name\" configuration");
return false; return false;
} }
@ -274,7 +275,7 @@ audio_output_setup(struct audio_output *ao, const struct config_param *param,
g_warning("No such mixer for output '%s'", ao->name); g_warning("No such mixer for output '%s'", ao->name);
} else if (strcmp(replay_gain_handler, "software") != 0 && } else if (strcmp(replay_gain_handler, "software") != 0 &&
ao->replay_gain_filter != NULL) { ao->replay_gain_filter != NULL) {
g_set_error(error_r, audio_output_quark(), 0, g_set_error(error_r, output_quark(), 0,
"Invalid \"replay_gain_handler\" value"); "Invalid \"replay_gain_handler\" value");
return false; return false;
} }
@ -301,14 +302,14 @@ audio_output_new(const struct config_param *param,
p = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL); p = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL);
if (p == NULL) { if (p == NULL) {
g_set_error(error_r, audio_output_quark(), 0, g_set_error(error_r, output_quark(), 0,
"Missing \"type\" configuration"); "Missing \"type\" configuration");
return nullptr; return nullptr;
} }
plugin = audio_output_plugin_get(p); plugin = audio_output_plugin_get(p);
if (plugin == NULL) { if (plugin == NULL) {
g_set_error(error_r, audio_output_quark(), 0, g_set_error(error_r, output_quark(), 0,
"No such audio output plugin: %s", p); "No such audio output plugin: %s", p);
return nullptr; return nullptr;
} }

View File

@ -21,9 +21,9 @@
#define MPD_PLAYLIST_DATABASE_HXX #define MPD_PLAYLIST_DATABASE_HXX
#include "check.h" #include "check.h"
#include "gerror.h"
#include <stdio.h> #include <stdio.h>
#include <glib.h>
#define PLAYLIST_META_BEGIN "playlist_begin: " #define PLAYLIST_META_BEGIN "playlist_begin: "

View File

@ -20,12 +20,11 @@
#ifndef MPD_PLAYLIST_FILE_HXX #ifndef MPD_PLAYLIST_FILE_HXX
#define MPD_PLAYLIST_FILE_HXX #define MPD_PLAYLIST_FILE_HXX
#include "gerror.h"
#include <vector> #include <vector>
#include <string> #include <string>
#include <glib.h>
#include <time.h>
struct song; struct song;
struct PlaylistInfo; struct PlaylistInfo;
class PlaylistVector; class PlaylistVector;

View File

@ -20,7 +20,8 @@
#ifndef MPD_PLAYLIST_PRINT_HXX #ifndef MPD_PLAYLIST_PRINT_HXX
#define MPD_PLAYLIST_PRINT_HXX #define MPD_PLAYLIST_PRINT_HXX
#include <glib.h> #include "gerror.h"
#include <stdint.h> #include <stdint.h>
struct playlist; struct playlist;

View File

@ -23,10 +23,6 @@
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "thread/Cond.hxx" #include "thread/Cond.hxx"
#include <glib.h>
#include <stdbool.h>
struct playlist_provider; struct playlist_provider;
struct input_stream; struct input_stream;

View File

@ -25,7 +25,6 @@
#ifndef MPD_PLAYLIST_STATE_HXX #ifndef MPD_PLAYLIST_STATE_HXX
#define MPD_PLAYLIST_STATE_HXX #define MPD_PLAYLIST_STATE_HXX
#include <glib.h>
#include <stdio.h> #include <stdio.h>
struct playlist; struct playlist;

View File

@ -25,7 +25,6 @@
#ifndef MPD_QUEUE_SAVE_HXX #ifndef MPD_QUEUE_SAVE_HXX
#define MPD_QUEUE_SAVE_HXX #define MPD_QUEUE_SAVE_HXX
#include <glib.h>
#include <stdio.h> #include <stdio.h>
struct queue; struct queue;

View File

@ -30,6 +30,8 @@ extern "C" {
#include "uri.h" #include "uri.h"
} }
#include <glib.h>
void void
song_print_uri(Client *client, struct song *song) song_print_uri(Client *client, struct song *song)
{ {

View File

@ -20,7 +20,7 @@
#ifndef MPD_SONG_SAVE_HXX #ifndef MPD_SONG_SAVE_HXX
#define MPD_SONG_SAVE_HXX #define MPD_SONG_SAVE_HXX
#include <glib.h> #include "gerror.h"
#include <stdio.h> #include <stdio.h>

View File

@ -114,12 +114,12 @@ struct sticker_song_find_data {
size_t base_uri_length; size_t base_uri_length;
void (*func)(struct song *song, const char *value, void (*func)(struct song *song, const char *value,
gpointer user_data); void *user_data);
gpointer user_data; void *user_data;
}; };
static void static void
sticker_song_find_cb(const char *uri, const char *value, gpointer user_data) sticker_song_find_cb(const char *uri, const char *value, void *user_data)
{ {
struct sticker_song_find_data *data = struct sticker_song_find_data *data =
(struct sticker_song_find_data *)user_data; (struct sticker_song_find_data *)user_data;
@ -136,8 +136,8 @@ sticker_song_find_cb(const char *uri, const char *value, gpointer user_data)
bool bool
sticker_song_find(Directory *directory, const char *name, sticker_song_find(Directory *directory, const char *name,
void (*func)(struct song *song, const char *value, void (*func)(struct song *song, const char *value,
gpointer user_data), void *user_data),
gpointer user_data) void *user_data)
{ {
struct sticker_song_find_data data; struct sticker_song_find_data data;
data.directory = directory; data.directory = directory;

View File

@ -20,7 +20,7 @@
#ifndef MPD_SONG_STICKER_HXX #ifndef MPD_SONG_STICKER_HXX
#define MPD_SONG_STICKER_HXX #define MPD_SONG_STICKER_HXX
#include <glib.h> #include "gerror.h"
struct song; struct song;
struct Directory; struct Directory;
@ -77,7 +77,7 @@ sticker_song_get(const struct song *song);
bool bool
sticker_song_find(Directory *directory, const char *name, sticker_song_find(Directory *directory, const char *name,
void (*func)(struct song *song, const char *value, void (*func)(struct song *song, const char *value,
gpointer user_data), void *user_data),
gpointer user_data); void *user_data);
#endif #endif

View File

@ -20,6 +20,8 @@
#include "config.h" #include "config.h"
#include "TagPool.hxx" #include "TagPool.hxx"
#include <glib.h>
#include <assert.h> #include <assert.h>
Mutex tag_pool_lock; Mutex tag_pool_lock;

View File

@ -23,8 +23,6 @@
#include "tag.h" #include "tag.h"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include <glib.h>
extern Mutex tag_pool_lock; extern Mutex tag_pool_lock;
struct tag_item; struct tag_item;

View File

@ -37,8 +37,6 @@ update_archive_file(Directory *directory,
#else #else
#include <glib.h>
static inline bool static inline bool
update_archive_file(gcc_unused Directory *directory, update_archive_file(gcc_unused Directory *directory,
gcc_unused const char *name, gcc_unused const char *name,

View File

@ -23,8 +23,6 @@
#include "event/BufferedSocket.hxx" #include "event/BufferedSocket.hxx"
#include "gcc.h" #include "gcc.h"
#include <glib.h>
#include <list> #include <list>
#include <stddef.h> #include <stddef.h>

View File

@ -30,8 +30,6 @@
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "event/ServerSocket.hxx" #include "event/ServerSocket.hxx"
#include <glib.h>
#include <forward_list> #include <forward_list>
struct config_param; struct config_param;

View File

@ -20,7 +20,7 @@
#ifndef MPD_PCM_UTILS_H #ifndef MPD_PCM_UTILS_H
#define MPD_PCM_UTILS_H #define MPD_PCM_UTILS_H
#include <glib.h> #include "gcc.h"
#include <stdint.h> #include <stdint.h>
@ -42,9 +42,9 @@ pcm_end_pointer(const void *p, size_t size)
static inline int32_t static inline int32_t
pcm_range(int32_t sample, unsigned bits) pcm_range(int32_t sample, unsigned bits)
{ {
if (G_UNLIKELY(sample < (-1 << (bits - 1)))) if (gcc_unlikely(sample < (-1 << (bits - 1))))
return -1 << (bits - 1); return -1 << (bits - 1);
if (G_UNLIKELY(sample >= (1 << (bits - 1)))) if (gcc_unlikely(sample >= (1 << (bits - 1))))
return (1 << (bits - 1)) - 1; return (1 << (bits - 1)) - 1;
return sample; return sample;
} }
@ -56,37 +56,37 @@ pcm_range(int32_t sample, unsigned bits)
static inline int64_t static inline int64_t
pcm_range_64(int64_t sample, unsigned bits) pcm_range_64(int64_t sample, unsigned bits)
{ {
if (G_UNLIKELY(sample < ((int64_t)-1 << (bits - 1)))) if (gcc_unlikely(sample < ((int64_t)-1 << (bits - 1))))
return (int64_t)-1 << (bits - 1); return (int64_t)-1 << (bits - 1);
if (G_UNLIKELY(sample >= ((int64_t)1 << (bits - 1)))) if (gcc_unlikely(sample >= ((int64_t)1 << (bits - 1))))
return ((int64_t)1 << (bits - 1)) - 1; return ((int64_t)1 << (bits - 1)) - 1;
return sample; return sample;
} }
G_GNUC_CONST gcc_const
static inline int16_t static inline int16_t
pcm_clamp_16(int x) pcm_clamp_16(int x)
{ {
static const int32_t MIN_VALUE = G_MININT16; static const int32_t MIN_VALUE = -(1 << 15);
static const int32_t MAX_VALUE = G_MAXINT16; static const int32_t MAX_VALUE = (1 << 15) - 1;
if (G_UNLIKELY(x < MIN_VALUE)) if (gcc_unlikely(x < MIN_VALUE))
return MIN_VALUE; return MIN_VALUE;
if (G_UNLIKELY(x > MAX_VALUE)) if (gcc_unlikely(x > MAX_VALUE))
return MAX_VALUE; return MAX_VALUE;
return x; return x;
} }
G_GNUC_CONST gcc_const
static inline int32_t static inline int32_t
pcm_clamp_24(int x) pcm_clamp_24(int x)
{ {
static const int32_t MIN_VALUE = -(1 << 23); static const int32_t MIN_VALUE = -(1 << 23);
static const int32_t MAX_VALUE = (1 << 23) - 1; static const int32_t MAX_VALUE = (1 << 23) - 1;
if (G_UNLIKELY(x < MIN_VALUE)) if (gcc_unlikely(x < MIN_VALUE))
return MIN_VALUE; return MIN_VALUE;
if (G_UNLIKELY(x > MAX_VALUE)) if (gcc_unlikely(x > MAX_VALUE))
return MAX_VALUE; return MAX_VALUE;
return x; return x;
} }

View File

@ -21,6 +21,7 @@
#define MPD_TAG_TABLE_H #define MPD_TAG_TABLE_H
#include "tag.h" #include "tag.h"
#include "gcc.h"
#include <glib.h> #include <glib.h>
@ -35,7 +36,7 @@ struct tag_table {
* Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found * Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found
* in the table. * in the table.
*/ */
G_GNUC_PURE gcc_pure
static inline enum tag_type static inline enum tag_type
tag_table_lookup(const struct tag_table *table, const char *name) tag_table_lookup(const struct tag_table *table, const char *name)
{ {
@ -51,7 +52,7 @@ tag_table_lookup(const struct tag_table *table, const char *name)
* Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found * Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found
* in the table. * in the table.
*/ */
G_GNUC_PURE gcc_pure
static inline enum tag_type static inline enum tag_type
tag_table_lookup_i(const struct tag_table *table, const char *name) tag_table_lookup_i(const struct tag_table *table, const char *name)
{ {

View File

@ -3,6 +3,8 @@
#include "song.h" #include "song.h"
#include "Directory.hxx" #include "Directory.hxx"
#include <glib.h>
Directory detached_root; Directory detached_root;
Directory::Directory() {} Directory::Directory() {}
@ -15,11 +17,11 @@ song_dup_detached(const struct song *src)
} }
void void
song_free(G_GNUC_UNUSED struct song *song) song_free(gcc_unused struct song *song)
{ {
} }
G_GNUC_UNUSED gcc_unused
static void static void
dump_order(const struct queue *queue) dump_order(const struct queue *queue)
{ {
@ -46,7 +48,7 @@ check_descending_priority(const struct queue *queue,
} }
int int
main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) main(gcc_unused int argc, gcc_unused char **argv)
{ {
static struct song songs[16]; static struct song songs[16];