aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DatabasePlugin.hxx7
-rw-r--r--src/audio_check.h2
-rw-r--r--src/audio_format.h19
-rw-r--r--src/client.h15
-rw-r--r--src/client_file.h6
-rw-r--r--src/client_message.h9
-rw-r--r--src/client_subscribe.h6
-rw-r--r--src/command.h1
-rw-r--r--src/database.h10
-rw-r--r--src/db/SimpleDatabasePlugin.hxx9
-rw-r--r--src/decoder/_flac_common.h2
-rw-r--r--src/gcc.h19
-rw-r--r--src/ls.c2
-rw-r--r--src/mapper.h23
-rw-r--r--src/output/httpd_client.h3
-rw-r--r--src/output_plugin.h7
-rw-r--r--src/pcm_mix.h3
-rw-r--r--src/pcm_volume.h1
-rw-r--r--src/pipe.h11
-rw-r--r--src/protocol/result.h5
-rw-r--r--src/resolver.h6
-rw-r--r--src/string_util.h8
-rw-r--r--src/strset.c2
-rw-r--r--src/strset.h6
-rw-r--r--src/tag_id3.h9
-rw-r--r--src/update_archive.h9
-rw-r--r--src/uri.h10
-rw-r--r--src/util/bit_reverse.h5
28 files changed, 123 insertions, 92 deletions
diff --git a/src/DatabasePlugin.hxx b/src/DatabasePlugin.hxx
index 45a8c55bf..71ad88ac5 100644
--- a/src/DatabasePlugin.hxx
+++ b/src/DatabasePlugin.hxx
@@ -27,10 +27,7 @@
#define MPD_DATABASE_PLUGIN_HXX
#include "DatabaseVisitor.hxx"
-
-#include <glib.h>
-#include <assert.h>
-#include <stdbool.h>
+#include "gcc.h"
struct config_param;
struct db_selection;
@@ -46,7 +43,7 @@ public:
/**
* Open the database. Read it into memory if applicable.
*/
- virtual bool Open(G_GNUC_UNUSED GError **error_r) {
+ virtual bool Open(gcc_unused GError **error_r) {
return true;
}
diff --git a/src/audio_check.h b/src/audio_check.h
index 9f71cf9c0..e2302126f 100644
--- a/src/audio_check.h
+++ b/src/audio_check.h
@@ -28,7 +28,7 @@
/**
* The GLib quark used for errors reported by this library.
*/
-G_GNUC_CONST
+gcc_const
static inline GQuark
audio_format_quark(void)
{
diff --git a/src/audio_format.h b/src/audio_format.h
index bf77add3b..d86ade5ee 100644
--- a/src/audio_format.h
+++ b/src/audio_format.h
@@ -20,7 +20,8 @@
#ifndef MPD_AUDIO_FORMAT_H
#define MPD_AUDIO_FORMAT_H
-#include <glib.h>
+#include "gcc.h"
+
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
@@ -189,7 +190,7 @@ audio_valid_channel_count(unsigned channels)
* Returns false if the format is not valid for playback with MPD.
* This function performs some basic validity checks.
*/
-G_GNUC_PURE
+gcc_pure
static inline bool audio_format_valid(const struct audio_format *af)
{
return audio_valid_sample_rate(af->sample_rate) &&
@@ -201,7 +202,7 @@ static inline bool audio_format_valid(const struct audio_format *af)
* Returns false if the format mask is not valid for playback with
* MPD. This function performs some basic validity checks.
*/
-G_GNUC_PURE
+gcc_pure
static inline bool audio_format_mask_valid(const struct audio_format *af)
{
return (af->sample_rate == 0 ||
@@ -223,7 +224,7 @@ void
audio_format_mask_apply(struct audio_format *af,
const struct audio_format *mask);
-G_GNUC_CONST
+gcc_const
static inline unsigned
sample_format_size(enum sample_format format)
{
@@ -254,7 +255,7 @@ sample_format_size(enum sample_format format)
/**
* Returns the size of each (mono) sample in bytes.
*/
-G_GNUC_PURE
+gcc_pure
static inline unsigned audio_format_sample_size(const struct audio_format *af)
{
return sample_format_size((enum sample_format)af->format);
@@ -263,7 +264,7 @@ static inline unsigned audio_format_sample_size(const struct audio_format *af)
/**
* Returns the size of each full frame in bytes.
*/
-G_GNUC_PURE
+gcc_pure
static inline unsigned
audio_format_frame_size(const struct audio_format *af)
{
@@ -274,7 +275,7 @@ audio_format_frame_size(const struct audio_format *af)
* Returns the floating point factor which converts a time span to a
* storage size in bytes.
*/
-G_GNUC_PURE
+gcc_pure
static inline double audio_format_time_to_size(const struct audio_format *af)
{
return af->sample_rate * audio_format_frame_size(af);
@@ -287,7 +288,7 @@ static inline double audio_format_time_to_size(const struct audio_format *af)
* @param format a #sample_format enum value
* @return the string
*/
-G_GNUC_PURE G_GNUC_MALLOC
+gcc_pure gcc_malloc
const char *
sample_format_to_string(enum sample_format format);
@@ -299,7 +300,7 @@ sample_format_to_string(enum sample_format format);
* @param s a buffer to print into
* @return the string, or NULL if the #audio_format object is invalid
*/
-G_GNUC_PURE G_GNUC_MALLOC
+gcc_pure gcc_malloc
const char *
audio_format_to_string(const struct audio_format *af,
struct audio_format_string *s);
diff --git a/src/client.h b/src/client.h
index 0302a2e0a..51ad1eb2a 100644
--- a/src/client.h
+++ b/src/client.h
@@ -20,7 +20,8 @@
#ifndef MPD_CLIENT_H
#define MPD_CLIENT_H
-#include <glib.h>
+#include "gcc.h"
+
#include <stdbool.h>
#include <stddef.h>
#include <stdarg.h>
@@ -35,28 +36,28 @@ void client_manager_deinit(void);
void client_new(struct player_control *player_control,
int fd, const struct sockaddr *sa, size_t sa_length, int uid);
-G_GNUC_PURE
+gcc_pure
bool client_is_expired(const struct client *client);
/**
* returns the uid of the client process, or a negative value if the
* uid is unknown
*/
-G_GNUC_PURE
+gcc_pure
int client_get_uid(const struct client *client);
/**
* Is this client running on the same machine, connected with a local
* (UNIX domain) socket?
*/
-G_GNUC_PURE
+gcc_pure
static inline bool
client_is_local(const struct client *client)
{
return client_get_uid(client) > 0;
}
-G_GNUC_PURE
+gcc_pure
unsigned client_get_permission(const struct client *client);
void client_set_permission(struct client *client, unsigned permission);
@@ -74,6 +75,8 @@ void client_vprintf(struct client *client, const char *fmt, va_list args);
/**
* Write a printf-like formatted string to the client.
*/
-G_GNUC_PRINTF(2, 3) void client_printf(struct client *client, const char *fmt, ...);
+gcc_fprintf
+void
+client_printf(struct client *client, const char *fmt, ...);
#endif
diff --git a/src/client_file.h b/src/client_file.h
index 3dcbe7500..439235739 100644
--- a/src/client_file.h
+++ b/src/client_file.h
@@ -20,7 +20,9 @@
#ifndef MPD_CLIENT_FILE_H
#define MPD_CLIENT_FILE_H
-#include <glib.h>
+#include "gcc.h"
+#include "gerror.h"
+
#include <stdbool.h>
struct client;
@@ -35,7 +37,7 @@ struct client;
* @param path_fs the absolute path name in filesystem encoding
* @return true if access is allowed
*/
-G_GNUC_PURE
+gcc_pure
bool
client_allow_file(const struct client *client, const char *path_fs,
GError **error_r);
diff --git a/src/client_message.h b/src/client_message.h
index 38c2e7615..6d1e734be 100644
--- a/src/client_message.h
+++ b/src/client_message.h
@@ -20,10 +20,11 @@
#ifndef MPD_CLIENT_MESSAGE_H
#define MPD_CLIENT_MESSAGE_H
+#include "gcc.h"
+
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
-#include <glib.h>
/**
* A client-to-client message.
@@ -34,11 +35,11 @@ struct client_message {
char *message;
};
-G_GNUC_PURE
+gcc_pure
bool
client_message_valid_channel_name(const char *name);
-G_GNUC_PURE
+gcc_pure
static inline bool
client_message_defined(const struct client_message *msg)
{
@@ -59,7 +60,7 @@ void
client_message_copy(struct client_message *dest,
const struct client_message *src);
-G_GNUC_MALLOC
+gcc_malloc
struct client_message *
client_message_dup(const struct client_message *src);
diff --git a/src/client_subscribe.h b/src/client_subscribe.h
index 09f864417..2dff982ba 100644
--- a/src/client_subscribe.h
+++ b/src/client_subscribe.h
@@ -20,9 +20,11 @@
#ifndef MPD_CLIENT_SUBSCRIBE_H
#define MPD_CLIENT_SUBSCRIBE_H
+#include "gcc.h"
+
#include <stdbool.h>
-#include <glib.h>
+typedef struct _GSList GSList;
struct client;
struct client_message;
@@ -52,7 +54,7 @@ client_unsubscribe_all(struct client *client);
bool
client_push_message(struct client *client, const struct client_message *msg);
-G_GNUC_MALLOC
+gcc_malloc
GSList *
client_read_messages(struct client *client);
diff --git a/src/command.h b/src/command.h
index 68d1f95e4..e2e0cbe82 100644
--- a/src/command.h
+++ b/src/command.h
@@ -22,7 +22,6 @@
#include "ack.h"
-#include <glib.h>
#include <stdbool.h>
enum command_return {
diff --git a/src/database.h b/src/database.h
index f877b74d3..47d52da65 100644
--- a/src/database.h
+++ b/src/database.h
@@ -47,7 +47,7 @@ db_finish(void);
* Returns the root directory object. Returns NULL if there is no
* configured music directory.
*/
-G_GNUC_PURE
+gcc_pure
struct directory *
db_get_root(void);
@@ -55,12 +55,12 @@ db_get_root(void);
* Caller must lock the #db_mutex.
*/
gcc_nonnull(1)
-G_GNUC_PURE
+gcc_pure
struct directory *
db_get_directory(const char *name);
gcc_nonnull(1)
-G_GNUC_PURE
+gcc_pure
struct song *
db_get_song(const char *file);
@@ -82,14 +82,14 @@ db_save(GError **error_r);
bool
db_load(GError **error);
-G_GNUC_PURE
+gcc_pure
time_t
db_get_mtime(void);
/**
* Returns true if there is a valid database file on the disk.
*/
-G_GNUC_PURE
+gcc_pure
static inline bool
db_exists(void)
{
diff --git a/src/db/SimpleDatabasePlugin.hxx b/src/db/SimpleDatabasePlugin.hxx
index e2d247385..6582118d2 100644
--- a/src/db/SimpleDatabasePlugin.hxx
+++ b/src/db/SimpleDatabasePlugin.hxx
@@ -26,7 +26,6 @@
#include <cassert>
#include <string>
-#include <glib.h>
#include <stdbool.h>
#include <time.h>
@@ -40,7 +39,7 @@ class SimpleDatabase : public Database {
time_t mtime;
public:
- G_GNUC_PURE
+ gcc_pure
struct directory *GetRoot() {
assert(root != NULL);
@@ -49,7 +48,7 @@ public:
bool Save(GError **error_r);
- G_GNUC_PURE
+ gcc_pure
time_t GetLastModified() const {
return mtime;
}
@@ -70,12 +69,12 @@ public:
protected:
bool Configure(const struct config_param *param, GError **error_r);
- G_GNUC_PURE
+ gcc_pure
bool Check(GError **error_r) const;
bool Load(GError **error_r);
- G_GNUC_PURE
+ gcc_pure
const struct directory *LookupDirectory(const char *uri) const;
};
diff --git a/src/decoder/_flac_common.h b/src/decoder/_flac_common.h
index 0d90ba656..c898a47cf 100644
--- a/src/decoder/_flac_common.h
+++ b/src/decoder/_flac_common.h
@@ -27,8 +27,6 @@
#include "decoder_api.h"
#include "pcm_buffer.h"
-#include <glib.h>
-
#include <FLAC/stream_decoder.h>
#include <FLAC/metadata.h>
diff --git a/src/gcc.h b/src/gcc.h
index 1d0128cbd..22b712af9 100644
--- a/src/gcc.h
+++ b/src/gcc.h
@@ -32,6 +32,9 @@
*/
#if GCC_CHECK_VERSION(3,0)
+# define gcc_const __attribute__((const))
+# define gcc_pure __attribute__((pure))
+# define gcc_malloc __attribute__((malloc))
# define gcc_must_check __attribute__ ((warn_unused_result))
# define gcc_packed __attribute__ ((packed))
/* these are very useful for type checking */
@@ -41,11 +44,21 @@
# define gcc_fprintf__ __attribute__ ((format(printf,4,5)))
# define gcc_scanf __attribute__ ((format(scanf,1,2)))
# define gcc_used __attribute__ ((used))
+# define gcc_unused __attribute__((unused))
+# define gcc_warn_unused_result __attribute__((warn_unused_result))
/* # define inline inline __attribute__ ((always_inline)) */
# define gcc_noinline __attribute__ ((noinline))
# define gcc_nonnull(...) __attribute__((nonnull(__VA_ARGS__)))
# define gcc_nonnull_all __attribute__((nonnull))
+
+# define gcc_likely(x) __builtin_expect (!!(x), 1)
+# define gcc_unlikely(x) __builtin_expect (!!(x), 0)
+
#else
+# define gcc_unused
+# define gcc_const
+# define gcc_pure
+# define gcc_malloc
# define gcc_must_check
# define gcc_packed
# define gcc_printf
@@ -54,10 +67,16 @@
# define gcc_fprintf__
# define gcc_scanf
# define gcc_used
+# define gcc_unused
+# define gcc_warn_unused_result
/* # define inline */
# define gcc_noinline
# define gcc_nonnull(...)
# define gcc_nonnull_all
+
+# define gcc_likely(x) (x)
+# define gcc_unlikely(x) (x)
+
#endif
#ifdef __cplusplus
diff --git a/src/ls.c b/src/ls.c
index 310c2d7b6..90e5fc66e 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -22,6 +22,8 @@
#include "uri.h"
#include "client.h"
+#include <glib.h>
+
#include <assert.h>
#include <string.h>
diff --git a/src/mapper.h b/src/mapper.h
index da2bf3daf..f57e3c9a8 100644
--- a/src/mapper.h
+++ b/src/mapper.h
@@ -24,10 +24,11 @@
#ifndef MPD_MAPPER_H
#define MPD_MAPPER_H
+#include "gcc.h"
#include "gerror.h"
-#include <glib.h>
#include <stdbool.h>
+#include <stddef.h>
#define PLAYLIST_FILE_SUFFIX ".m3u"
@@ -38,14 +39,14 @@ void mapper_init(const char *_music_dir, const char *_playlist_dir);
void mapper_finish(void);
-G_GNUC_CONST
+gcc_const
const char *
mapper_get_music_directory(void);
/**
* Returns true if a music directory was configured.
*/
-G_GNUC_CONST
+gcc_const
static inline bool
mapper_has_music_directory(void)
{
@@ -57,7 +58,7 @@ mapper_has_music_directory(void)
* this function converts it to a relative path. If not, it returns
* the unmodified string pointer.
*/
-G_GNUC_PURE
+gcc_pure
const char *
map_to_relative_path(const char *path_utf8);
@@ -66,7 +67,7 @@ map_to_relative_path(const char *path_utf8);
* is basically done by converting the URI to the file system charset
* and prepending the music directory.
*/
-G_GNUC_MALLOC
+gcc_malloc
char *
map_uri_fs(const char *uri);
@@ -76,7 +77,7 @@ map_uri_fs(const char *uri);
* @param directory the directory object
* @return the path in file system encoding, or NULL if mapping failed
*/
-G_GNUC_MALLOC
+gcc_malloc
char *
map_directory_fs(const struct directory *directory);
@@ -88,7 +89,7 @@ map_directory_fs(const struct directory *directory);
* @param name the child's name in UTF-8
* @return the path in file system encoding, or NULL if mapping failed
*/
-G_GNUC_MALLOC
+gcc_malloc
char *
map_directory_child_fs(const struct directory *directory, const char *name);
@@ -99,7 +100,7 @@ map_directory_child_fs(const struct directory *directory, const char *name);
* @param song the song object
* @return the path in file system encoding, or NULL if mapping failed
*/
-G_GNUC_MALLOC
+gcc_malloc
char *
map_song_fs(const struct song *song);
@@ -110,14 +111,14 @@ map_song_fs(const struct song *song);
* @param path_fs a path in file system encoding
* @return the relative path in UTF-8, or NULL if mapping failed
*/
-G_GNUC_MALLOC
+gcc_malloc
char *
map_fs_to_utf8(const char *path_fs);
/**
* Returns the playlist directory.
*/
-G_GNUC_CONST
+gcc_const
const char *
map_spl_path(void);
@@ -128,7 +129,7 @@ map_spl_path(void);
*
* @return the path in file system encoding, or NULL if mapping failed
*/
-G_GNUC_PURE
+gcc_pure
char *
map_spl_utf8_to_fs(const char *name);
diff --git a/src/output/httpd_client.h b/src/output/httpd_client.h
index 739163f42..f0df829db 100644
--- a/src/output/httpd_client.h
+++ b/src/output/httpd_client.h
@@ -20,9 +20,8 @@
#ifndef MPD_OUTPUT_HTTPD_CLIENT_H
#define MPD_OUTPUT_HTTPD_CLIENT_H
-#include <glib.h>
-
#include <stdbool.h>
+#include <stddef.h>
struct httpd_client;
struct httpd_output;
diff --git a/src/output_plugin.h b/src/output_plugin.h
index 7ac8e0c4f..a47296566 100644
--- a/src/output_plugin.h
+++ b/src/output_plugin.h
@@ -20,10 +20,9 @@
#ifndef MPD_OUTPUT_PLUGIN_H
#define MPD_OUTPUT_PLUGIN_H
+#include "gcc.h"
#include "gerror.h"
-#include <glib.h>
-
#include <stdbool.h>
#include <stddef.h>
@@ -167,7 +166,7 @@ ao_plugin_test_default_device(const struct audio_output_plugin *plugin)
: false;
}
-G_GNUC_MALLOC
+gcc_malloc
struct audio_output *
ao_plugin_init(const struct audio_output_plugin *plugin,
const struct config_param *param,
@@ -189,7 +188,7 @@ ao_plugin_open(struct audio_output *ao, struct audio_format *audio_format,
void
ao_plugin_close(struct audio_output *ao);
-G_GNUC_PURE
+gcc_pure
unsigned
ao_plugin_delay(struct audio_output *ao);
diff --git a/src/pcm_mix.h b/src/pcm_mix.h
index 0e58d01ee..0cf557680 100644
--- a/src/pcm_mix.h
+++ b/src/pcm_mix.h
@@ -21,6 +21,7 @@
#define PCM_MIX_H
#include "audio_format.h"
+#include "gcc.h"
#include <stdbool.h>
#include <stddef.h>
@@ -41,7 +42,7 @@
*
* @return true on success, false if the format is not supported
*/
-G_GNUC_WARN_UNUSED_RESULT
+gcc_warn_unused_result
bool
pcm_mix(void *buffer1, const void *buffer2, size_t size,
enum sample_format format, float portion1);
diff --git a/src/pcm_volume.h b/src/pcm_volume.h
index 64e3c7641..4a4a4e45a 100644
--- a/src/pcm_volume.h
+++ b/src/pcm_volume.h
@@ -25,6 +25,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <stddef.h>
enum {
/** this value means "100% volume" */
diff --git a/src/pipe.h b/src/pipe.h
index 84b9869e0..6b5bbf0c7 100644
--- a/src/pipe.h
+++ b/src/pipe.h
@@ -20,7 +20,8 @@
#ifndef MPD_PIPE_H
#define MPD_PIPE_H
-#include <glib.h>
+#include "gcc.h"
+
#include <stdbool.h>
#ifndef NDEBUG
@@ -39,7 +40,7 @@ struct music_pipe;
/**
* Creates a new #music_pipe object. It is empty.
*/
-G_GNUC_MALLOC
+gcc_malloc
struct music_pipe *
music_pipe_new(void);
@@ -72,7 +73,7 @@ music_pipe_contains(const struct music_pipe *mp,
* Returns the first #music_chunk from the pipe. Returns NULL if the
* pipe is empty.
*/
-G_GNUC_PURE
+gcc_pure
const struct music_chunk *
music_pipe_peek(const struct music_pipe *mp);
@@ -99,11 +100,11 @@ music_pipe_push(struct music_pipe *mp, struct music_chunk *chunk);
/**
* Returns the number of chunks currently in this pipe.
*/
-G_GNUC_PURE
+gcc_pure
unsigned
music_pipe_size(const struct music_pipe *mp);
-G_GNUC_PURE
+gcc_pure
static inline bool
music_pipe_empty(const struct music_pipe *mp)
{
diff --git a/src/protocol/result.h b/src/protocol/result.h
index 8b9e44bfd..09ea6c418 100644
--- a/src/protocol/result.h
+++ b/src/protocol/result.h
@@ -21,10 +21,9 @@
#define MPD_PROTOCOL_RESULT_H
#include "check.h"
+#include "gcc.h"
#include "ack.h"
-#include <glib.h>
-
struct client;
extern const char *current_command;
@@ -37,7 +36,7 @@ void
command_error_v(struct client *client, enum ack error,
const char *fmt, va_list args);
-G_GNUC_PRINTF(3, 4)
+gcc_fprintf_
void
command_error(struct client *client, enum ack error, const char *fmt, ...);
diff --git a/src/resolver.h b/src/resolver.h
index e5ad06754..666b6d5b2 100644
--- a/src/resolver.h
+++ b/src/resolver.h
@@ -20,12 +20,14 @@
#ifndef MPD_RESOLVER_H
#define MPD_RESOLVER_H
+#include "gcc.h"
+
#include <glib.h>
struct sockaddr;
struct addrinfo;
-G_GNUC_CONST
+gcc_const
static inline GQuark
resolver_quark(void)
{
@@ -42,7 +44,7 @@ resolver_quark(void)
* @param error location to store the error occurring, or NULL to
* ignore errors
*/
-G_GNUC_MALLOC
+gcc_malloc
char *
sockaddr_to_string(const struct sockaddr *sa, size_t length, GError **error);
diff --git a/src/string_util.h b/src/string_util.h
index dc80a46ef..683fada1b 100644
--- a/src/string_util.h
+++ b/src/string_util.h
@@ -20,7 +20,7 @@
#ifndef MPD_STRING_UTIL_H
#define MPD_STRING_UTIL_H
-#include <glib.h>
+#include "gcc.h"
#include <stdbool.h>
@@ -28,7 +28,7 @@
* Remove the "const" attribute from a string pointer. This is a
* dirty hack, don't use it unless you know what you're doing!
*/
-G_GNUC_CONST
+gcc_const
static inline char *
deconst_string(const char *p)
{
@@ -49,14 +49,14 @@ deconst_string(const char *p)
* This is a faster version of g_strchug(), because it does not move
* data.
*/
-G_GNUC_PURE
+gcc_pure
const char *
strchug_fast_c(const char *p);
/**
* Same as strchug_fast_c(), but works with a writable pointer.
*/
-G_GNUC_PURE
+gcc_pure
static inline char *
strchug_fast(char *p)
{
diff --git a/src/strset.c b/src/strset.c
index 5862e4075..f1a5197d1 100644
--- a/src/strset.c
+++ b/src/strset.c
@@ -20,6 +20,8 @@
#include "config.h"
#include "strset.h"
+#include <glib.h>
+
#include <assert.h>
#include <string.h>
#include <stdlib.h>
diff --git a/src/strset.h b/src/strset.h
index 5382e59b8..6965a5823 100644
--- a/src/strset.h
+++ b/src/strset.h
@@ -29,11 +29,13 @@
#ifndef MPD_STRSET_H
#define MPD_STRSET_H
-#include <glib.h>
+#include "gcc.h"
struct strset;
-G_GNUC_MALLOC struct strset *strset_new(void);
+gcc_malloc
+struct strset *
+strset_new(void);
void strset_free(struct strset *set);
diff --git a/src/tag_id3.h b/src/tag_id3.h
index 055d0a3d1..473e33843 100644
--- a/src/tag_id3.h
+++ b/src/tag_id3.h
@@ -21,10 +21,9 @@
#define MPD_TAG_ID3_H
#include "check.h"
+#include "gcc.h"
#include "gerror.h"
-#include <glib.h>
-
#include <stdbool.h>
struct tag_handler;
@@ -52,9 +51,9 @@ tag_id3_load(const char *path_fs, GError **error_r);
#else
static inline bool
-tag_id3_scan(G_GNUC_UNUSED const char *path_fs,
- G_GNUC_UNUSED const struct tag_handler *handler,
- G_GNUC_UNUSED void *handler_ctx)
+tag_id3_scan(gcc_unused const char *path_fs,
+ gcc_unused const struct tag_handler *handler,
+ gcc_unused void *handler_ctx)
{
return false;
}
diff --git a/src/update_archive.h b/src/update_archive.h
index 838697dd9..a9139b0e0 100644
--- a/src/update_archive.h
+++ b/src/update_archive.h
@@ -21,6 +21,7 @@
#define MPD_UPDATE_ARCHIVE_H
#include "check.h"
+#include "gcc.h"
#include <stdbool.h>
#include <sys/stat.h>
@@ -40,10 +41,10 @@ update_archive_file(struct directory *directory,
#include <glib.h>
static inline bool
-update_archive_file(G_GNUC_UNUSED struct directory *directory,
- G_GNUC_UNUSED const char *name,
- G_GNUC_UNUSED const char *suffix,
- G_GNUC_UNUSED const struct stat *st)
+update_archive_file(gcc_unused struct directory *directory,
+ gcc_unused const char *name,
+ gcc_unused const char *suffix,
+ gcc_unused const struct stat *st)
{
return false;
}
diff --git a/src/uri.h b/src/uri.h
index 5a9b472f5..6713f1698 100644
--- a/src/uri.h
+++ b/src/uri.h
@@ -20,7 +20,7 @@
#ifndef MPD_URI_H
#define MPD_URI_H
-#include <glib.h>
+#include "gcc.h"
#include <stdbool.h>
@@ -28,10 +28,10 @@
* Checks whether the specified URI has a scheme in the form
* "scheme://".
*/
-G_GNUC_PURE
+gcc_pure
bool uri_has_scheme(const char *uri);
-G_GNUC_PURE
+gcc_pure
const char *
uri_get_suffix(const char *uri);
@@ -43,7 +43,7 @@ uri_get_suffix(const char *uri);
* - no double slashes
* - no path component begins with a dot
*/
-G_GNUC_PURE
+gcc_pure
bool
uri_safe_local(const char *uri);
@@ -53,7 +53,7 @@ uri_safe_local(const char *uri);
* NULL if nothing needs to be removed, or if the URI is not
* recognized.
*/
-G_GNUC_MALLOC
+gcc_malloc
char *
uri_remove_auth(const char *uri);
diff --git a/src/util/bit_reverse.h b/src/util/bit_reverse.h
index e44693b1d..54cb789bb 100644
--- a/src/util/bit_reverse.h
+++ b/src/util/bit_reverse.h
@@ -20,12 +20,13 @@
#ifndef MPD_BIT_REVERSE_H
#define MPD_BIT_REVERSE_H
-#include <glib.h>
+#include "gcc.h"
+
#include <stdint.h>
extern const uint8_t bit_reverse_table[256];
-G_GNUC_CONST
+gcc_const
static inline uint8_t
bit_reverse(uint8_t x)
{