From 5ed9f02c4de0a8ddb7649e0541a8d6f32f61b3f8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 30 Jan 2013 22:53:12 +0100 Subject: TagPool, ...: include cleanup --- src/ClientInternal.hxx | 12 ------------ src/CommandError.hxx | 3 +-- src/DatabaseSimple.hxx | 4 +--- src/Directory.hxx | 2 +- src/DirectorySave.hxx | 2 +- src/InotifySource.hxx | 2 -- src/OutputControl.hxx | 8 -------- src/OutputInit.cxx | 11 ++++++----- src/PlaylistDatabase.hxx | 2 +- src/PlaylistFile.hxx | 5 ++--- src/PlaylistPrint.hxx | 3 ++- src/PlaylistRegistry.hxx | 4 ---- src/PlaylistState.hxx | 1 - src/QueueSave.hxx | 1 - src/SongPrint.cxx | 2 ++ src/SongSave.hxx | 2 +- src/SongSticker.cxx | 10 +++++----- src/SongSticker.hxx | 6 +++--- src/TagPool.cxx | 2 ++ src/TagPool.hxx | 2 -- src/UpdateArchive.hxx | 2 -- src/output/HttpdClient.hxx | 2 -- src/output/HttpdInternal.hxx | 2 -- src/pcm_utils.h | 26 +++++++++++++------------- src/tag_table.h | 5 +++-- test/test_queue_priority.cxx | 8 +++++--- 26 files changed, 49 insertions(+), 80 deletions(-) diff --git a/src/ClientInternal.hxx b/src/ClientInternal.hxx index 06a60be7..c3111868 100644 --- a/src/ClientInternal.hxx +++ b/src/ClientInternal.hxx @@ -32,8 +32,6 @@ #include #include -#include - #undef G_LOG_DOMAIN #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_output_buffer_size; -enum command_return -client_read(Client *client); - enum command_return client_process_line(Client *client, char *line); -void -client_write_output(Client *client); - -gboolean -client_in_event(GIOChannel *source, GIOCondition condition, - gpointer data); - #endif diff --git a/src/CommandError.hxx b/src/CommandError.hxx index 739e982e..5fb02122 100644 --- a/src/CommandError.hxx +++ b/src/CommandError.hxx @@ -22,8 +22,7 @@ #include "command.h" #include "playlist_error.h" - -#include +#include "gerror.h" class Client; diff --git a/src/DatabaseSimple.hxx b/src/DatabaseSimple.hxx index e57ae41b..c387a64f 100644 --- a/src/DatabaseSimple.hxx +++ b/src/DatabaseSimple.hxx @@ -21,11 +21,9 @@ #define MPD_DATABASE_SIMPLE_HXX #include "gcc.h" - -#include +#include "gerror.h" #include -#include struct config_param; struct Directory; diff --git a/src/Directory.hxx b/src/Directory.hxx index 710f4792..8fa5c235 100644 --- a/src/Directory.hxx +++ b/src/Directory.hxx @@ -25,8 +25,8 @@ #include "gcc.h" #include "DatabaseVisitor.hxx" #include "PlaylistVector.hxx" +#include "gerror.h" -#include #include #include diff --git a/src/DirectorySave.hxx b/src/DirectorySave.hxx index a7f3034a..f4b4816f 100644 --- a/src/DirectorySave.hxx +++ b/src/DirectorySave.hxx @@ -20,7 +20,7 @@ #ifndef MPD_DIRECTORY_SAVE_HXX #define MPD_DIRECTORY_SAVE_HXX -#include +#include "gerror.h" #include diff --git a/src/InotifySource.hxx b/src/InotifySource.hxx index d174cc86..e8f9ff03 100644 --- a/src/InotifySource.hxx +++ b/src/InotifySource.hxx @@ -24,8 +24,6 @@ #include "gerror.h" #include "gcc.h" -#include - typedef void (*mpd_inotify_callback_t)(int wd, unsigned mask, const char *name, void *ctx); diff --git a/src/OutputControl.hxx b/src/OutputControl.hxx index cf906d2f..2ff09539 100644 --- a/src/OutputControl.hxx +++ b/src/OutputControl.hxx @@ -22,8 +22,6 @@ #include "replay_gain_info.h" -#include - #include struct audio_output; @@ -32,12 +30,6 @@ struct config_param; struct music_pipe; struct player_control; -static inline GQuark -audio_output_quark(void) -{ - return g_quark_from_static_string("audio_output"); -} - void audio_output_set_replay_gain_mode(struct audio_output *ao, enum replay_gain_mode mode); diff --git a/src/OutputInit.cxx b/src/OutputInit.cxx index 0d3dd05a..0e9f851b 100644 --- a/src/OutputInit.cxx +++ b/src/OutputInit.cxx @@ -20,6 +20,7 @@ #include "config.h" #include "OutputControl.hxx" #include "OutputList.hxx" +#include "OutputError.hxx" #include "FilterConfig.hxx" #include "output_api.h" #include "AudioParser.hxx" @@ -65,7 +66,7 @@ audio_output_detect(GError **error) return plugin; } - g_set_error(error, audio_output_quark(), 0, + g_set_error(error, output_quark(), 0, "Unable to detect an audio device"); return NULL; } @@ -148,7 +149,7 @@ ao_base_init(struct audio_output *ao, ao->name = config_get_block_string(param, AUDIO_OUTPUT_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"); 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); } else if (strcmp(replay_gain_handler, "software") != 0 && 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"); return false; } @@ -301,14 +302,14 @@ audio_output_new(const struct config_param *param, p = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL); if (p == NULL) { - g_set_error(error_r, audio_output_quark(), 0, + g_set_error(error_r, output_quark(), 0, "Missing \"type\" configuration"); return nullptr; } plugin = audio_output_plugin_get(p); 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); return nullptr; } diff --git a/src/PlaylistDatabase.hxx b/src/PlaylistDatabase.hxx index f5f03926..a08d623f 100644 --- a/src/PlaylistDatabase.hxx +++ b/src/PlaylistDatabase.hxx @@ -21,9 +21,9 @@ #define MPD_PLAYLIST_DATABASE_HXX #include "check.h" +#include "gerror.h" #include -#include #define PLAYLIST_META_BEGIN "playlist_begin: " diff --git a/src/PlaylistFile.hxx b/src/PlaylistFile.hxx index 3f63253a..a9aeaa23 100644 --- a/src/PlaylistFile.hxx +++ b/src/PlaylistFile.hxx @@ -20,12 +20,11 @@ #ifndef MPD_PLAYLIST_FILE_HXX #define MPD_PLAYLIST_FILE_HXX +#include "gerror.h" + #include #include -#include -#include - struct song; struct PlaylistInfo; class PlaylistVector; diff --git a/src/PlaylistPrint.hxx b/src/PlaylistPrint.hxx index 588aeca8..16bee9b8 100644 --- a/src/PlaylistPrint.hxx +++ b/src/PlaylistPrint.hxx @@ -20,7 +20,8 @@ #ifndef MPD_PLAYLIST_PRINT_HXX #define MPD_PLAYLIST_PRINT_HXX -#include +#include "gerror.h" + #include struct playlist; diff --git a/src/PlaylistRegistry.hxx b/src/PlaylistRegistry.hxx index a9fc56dc..7c34c156 100644 --- a/src/PlaylistRegistry.hxx +++ b/src/PlaylistRegistry.hxx @@ -23,10 +23,6 @@ #include "thread/Mutex.hxx" #include "thread/Cond.hxx" -#include - -#include - struct playlist_provider; struct input_stream; diff --git a/src/PlaylistState.hxx b/src/PlaylistState.hxx index 572f6fb4..7e994478 100644 --- a/src/PlaylistState.hxx +++ b/src/PlaylistState.hxx @@ -25,7 +25,6 @@ #ifndef MPD_PLAYLIST_STATE_HXX #define MPD_PLAYLIST_STATE_HXX -#include #include struct playlist; diff --git a/src/QueueSave.hxx b/src/QueueSave.hxx index dc4a764a..25d7804f 100644 --- a/src/QueueSave.hxx +++ b/src/QueueSave.hxx @@ -25,7 +25,6 @@ #ifndef MPD_QUEUE_SAVE_HXX #define MPD_QUEUE_SAVE_HXX -#include #include struct queue; diff --git a/src/SongPrint.cxx b/src/SongPrint.cxx index c56e54d8..126e5b9f 100644 --- a/src/SongPrint.cxx +++ b/src/SongPrint.cxx @@ -30,6 +30,8 @@ extern "C" { #include "uri.h" } +#include + void song_print_uri(Client *client, struct song *song) { diff --git a/src/SongSave.hxx b/src/SongSave.hxx index 3214c545..3b0c3319 100644 --- a/src/SongSave.hxx +++ b/src/SongSave.hxx @@ -20,7 +20,7 @@ #ifndef MPD_SONG_SAVE_HXX #define MPD_SONG_SAVE_HXX -#include +#include "gerror.h" #include diff --git a/src/SongSticker.cxx b/src/SongSticker.cxx index 40af50b3..86385fc3 100644 --- a/src/SongSticker.cxx +++ b/src/SongSticker.cxx @@ -114,12 +114,12 @@ struct sticker_song_find_data { size_t base_uri_length; void (*func)(struct song *song, const char *value, - gpointer user_data); - gpointer user_data; + void *user_data); + void *user_data; }; 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 *)user_data; @@ -136,8 +136,8 @@ sticker_song_find_cb(const char *uri, const char *value, gpointer user_data) bool sticker_song_find(Directory *directory, const char *name, void (*func)(struct song *song, const char *value, - gpointer user_data), - gpointer user_data) + void *user_data), + void *user_data) { struct sticker_song_find_data data; data.directory = directory; diff --git a/src/SongSticker.hxx b/src/SongSticker.hxx index fd25af4c..07539b40 100644 --- a/src/SongSticker.hxx +++ b/src/SongSticker.hxx @@ -20,7 +20,7 @@ #ifndef MPD_SONG_STICKER_HXX #define MPD_SONG_STICKER_HXX -#include +#include "gerror.h" struct song; struct Directory; @@ -77,7 +77,7 @@ sticker_song_get(const struct song *song); bool sticker_song_find(Directory *directory, const char *name, void (*func)(struct song *song, const char *value, - gpointer user_data), - gpointer user_data); + void *user_data), + void *user_data); #endif diff --git a/src/TagPool.cxx b/src/TagPool.cxx index f529cda6..a9b89284 100644 --- a/src/TagPool.cxx +++ b/src/TagPool.cxx @@ -20,6 +20,8 @@ #include "config.h" #include "TagPool.hxx" +#include + #include Mutex tag_pool_lock; diff --git a/src/TagPool.hxx b/src/TagPool.hxx index 5d68a31d..649cef6e 100644 --- a/src/TagPool.hxx +++ b/src/TagPool.hxx @@ -23,8 +23,6 @@ #include "tag.h" #include "thread/Mutex.hxx" -#include - extern Mutex tag_pool_lock; struct tag_item; diff --git a/src/UpdateArchive.hxx b/src/UpdateArchive.hxx index aa9882ae..73b363d2 100644 --- a/src/UpdateArchive.hxx +++ b/src/UpdateArchive.hxx @@ -37,8 +37,6 @@ update_archive_file(Directory *directory, #else -#include - static inline bool update_archive_file(gcc_unused Directory *directory, gcc_unused const char *name, diff --git a/src/output/HttpdClient.hxx b/src/output/HttpdClient.hxx index 1f61d988..46196d2e 100644 --- a/src/output/HttpdClient.hxx +++ b/src/output/HttpdClient.hxx @@ -23,8 +23,6 @@ #include "event/BufferedSocket.hxx" #include "gcc.h" -#include - #include #include diff --git a/src/output/HttpdInternal.hxx b/src/output/HttpdInternal.hxx index f1ee513e..4b526bcd 100644 --- a/src/output/HttpdInternal.hxx +++ b/src/output/HttpdInternal.hxx @@ -30,8 +30,6 @@ #include "thread/Mutex.hxx" #include "event/ServerSocket.hxx" -#include - #include struct config_param; diff --git a/src/pcm_utils.h b/src/pcm_utils.h index 4ad89657..21df95e4 100644 --- a/src/pcm_utils.h +++ b/src/pcm_utils.h @@ -20,7 +20,7 @@ #ifndef MPD_PCM_UTILS_H #define MPD_PCM_UTILS_H -#include +#include "gcc.h" #include @@ -42,9 +42,9 @@ pcm_end_pointer(const void *p, size_t size) static inline int32_t 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); - if (G_UNLIKELY(sample >= (1 << (bits - 1)))) + if (gcc_unlikely(sample >= (1 << (bits - 1)))) return (1 << (bits - 1)) - 1; return sample; } @@ -56,37 +56,37 @@ pcm_range(int32_t sample, unsigned bits) static inline int64_t 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); - 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 sample; } -G_GNUC_CONST +gcc_const static inline int16_t pcm_clamp_16(int x) { - static const int32_t MIN_VALUE = G_MININT16; - static const int32_t MAX_VALUE = G_MAXINT16; + static const int32_t MIN_VALUE = -(1 << 15); + static const int32_t MAX_VALUE = (1 << 15) - 1; - if (G_UNLIKELY(x < MIN_VALUE)) + if (gcc_unlikely(x < MIN_VALUE)) return MIN_VALUE; - if (G_UNLIKELY(x > MAX_VALUE)) + if (gcc_unlikely(x > MAX_VALUE)) return MAX_VALUE; return x; } -G_GNUC_CONST +gcc_const static inline int32_t pcm_clamp_24(int x) { static const int32_t MIN_VALUE = -(1 << 23); static const int32_t MAX_VALUE = (1 << 23) - 1; - if (G_UNLIKELY(x < MIN_VALUE)) + if (gcc_unlikely(x < MIN_VALUE)) return MIN_VALUE; - if (G_UNLIKELY(x > MAX_VALUE)) + if (gcc_unlikely(x > MAX_VALUE)) return MAX_VALUE; return x; } diff --git a/src/tag_table.h b/src/tag_table.h index d87d4869..8e2172c1 100644 --- a/src/tag_table.h +++ b/src/tag_table.h @@ -21,6 +21,7 @@ #define MPD_TAG_TABLE_H #include "tag.h" +#include "gcc.h" #include @@ -35,7 +36,7 @@ struct tag_table { * Returns TAG_NUM_OF_ITEM_TYPES if the specified name was not found * in the table. */ -G_GNUC_PURE +gcc_pure static inline enum tag_type 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 * in the table. */ -G_GNUC_PURE +gcc_pure static inline enum tag_type tag_table_lookup_i(const struct tag_table *table, const char *name) { diff --git a/test/test_queue_priority.cxx b/test/test_queue_priority.cxx index cab56d82..8dd1c3f5 100644 --- a/test/test_queue_priority.cxx +++ b/test/test_queue_priority.cxx @@ -3,6 +3,8 @@ #include "song.h" #include "Directory.hxx" +#include + Directory detached_root; Directory::Directory() {} @@ -15,11 +17,11 @@ song_dup_detached(const struct song *src) } void -song_free(G_GNUC_UNUSED struct song *song) +song_free(gcc_unused struct song *song) { } -G_GNUC_UNUSED +gcc_unused static void dump_order(const struct queue *queue) { @@ -46,7 +48,7 @@ check_descending_priority(const struct queue *queue, } 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]; -- cgit v1.2.3