aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index 6a6e562cf..0001ba3c8 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -90,4 +90,15 @@ void xpthread_mutex_destroy(pthread_mutex_t *mutex);
void xpthread_cond_destroy(pthread_cond_t *cond);
+/*
+ * Work-arounds for braindead APIs that require non-const pointers:
+ * ao_play(), free(), vorbis_comment_add_tag(), iconv()
+ */
+static inline void * deconst_ptr(const void *ptr)
+{
+ union { const void *in; void *out; } u;
+ u.in = ptr;
+ return u.out;
+}
+
#endif