diff options
Diffstat (limited to 'src/string_util.h')
-rw-r--r-- | src/string_util.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/string_util.h b/src/string_util.h index dc80a46ef..c1d316f0c 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,10 +28,13 @@ * 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) { +#ifdef __cplusplus + return const_cast<char *>(p); +#else union { const char *in; char *out; @@ -40,6 +43,7 @@ deconst_string(const char *p) }; return u.out; +#endif } /** @@ -49,14 +53,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) { |