string_util: use const_cast in C++ mode

This commit is contained in:
Max Kellermann 2013-01-02 20:21:57 +01:00
parent a654f146d1
commit 4b0b8315a9

View File

@ -32,6 +32,9 @@ gcc_const
static inline char * static inline char *
deconst_string(const char *p) deconst_string(const char *p)
{ {
#ifdef __cplusplus
return const_cast<char *>(p);
#else
union { union {
const char *in; const char *in;
char *out; char *out;
@ -40,6 +43,7 @@ deconst_string(const char *p)
}; };
return u.out; return u.out;
#endif
} }
/** /**