diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-01 20:13:37 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-01 20:13:37 -0700 |
commit | dd7f8a723efa9c9edce951981aef7f3adf814134 (patch) | |
tree | 1c442a63c257f53d0e3f1ff127b98e682c35c4d5 /src/utils.h | |
parent | cf1f842a4c8f760c4c6a41f0dadc6c173a182d4f (diff) | |
parent | 925843cfedcde221207ec1ab78f778dab22325f9 (diff) | |
download | mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.tar.gz mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.tar.xz mpd-dd7f8a723efa9c9edce951981aef7f3adf814134.zip |
Merge branch 'ew/deconst'
* ew/deconst:
use deconst_ptr instead of duplicating deconst logic
provide a generic deconst_ptr function
Diffstat (limited to '')
-rw-r--r-- | src/utils.h | 11 |
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 |