diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-07-16 13:28:28 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2013-11-03 21:59:54 +0100 |
commit | 37388ebb0ef9085c841d7f94e665a5a77cfe0e92 (patch) | |
tree | b47d18bee4e7f661d9e6d794dac0ec1cebcd3a37 /mpvcore/charset_conv.c | |
parent | 891a2a1f474add323145e6b2cd2d29181830e4a4 (diff) | |
download | mpv-37388ebb0ef9085c841d7f94e665a5a77cfe0e92.tar.bz2 mpv-37388ebb0ef9085c841d7f94e665a5a77cfe0e92.tar.xz |
configure: uniform the defines to #define HAVE_xxx (0|1)
The configure followed 5 different convetions of defines because the next guy
always wanted to introduce a new better way to uniform it[1]. For an
hypothetic feature 'hurr' you could have had:
* #define HAVE_HURR 1 / #undef HAVE_DURR
* #define HAVE_HURR / #undef HAVE_DURR
* #define CONFIG_HURR 1 / #undef CONFIG_DURR
* #define HAVE_HURR 1 / #define HAVE_DURR 0
* #define CONFIG_HURR 1 / #define CONFIG_DURR 0
All is now uniform and uses:
* #define HAVE_HURR 1
* #define HAVE_DURR 0
We like definining to 0 as opposed to `undef` bcause it can help spot typos
and is very helpful when doing big reorganizations in the code.
[1]: http://xkcd.com/927/ related
Diffstat (limited to 'mpvcore/charset_conv.c')
-rw-r--r-- | mpvcore/charset_conv.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mpvcore/charset_conv.c b/mpvcore/charset_conv.c index a5c7f559ad..3a6ff67330 100644 --- a/mpvcore/charset_conv.c +++ b/mpvcore/charset_conv.c @@ -27,15 +27,15 @@ #include "mpvcore/mp_msg.h" -#ifdef CONFIG_ENCA +#if HAVE_ENCA #include <enca.h> #endif -#ifdef CONFIG_LIBGUESS +#if HAVE_LIBGUESS #include <libguess.h> #endif -#ifdef CONFIG_ICONV +#if HAVE_ICONV #include <iconv.h> #endif @@ -85,7 +85,7 @@ bool mp_charset_requires_guess(const char *user_cp) (r > 1 && bstrcasecmp0(res[0], "utf8") == 0); } -#ifdef CONFIG_ENCA +#if HAVE_ENCA static const char *enca_guess(bstr buf, const char *language) { if (!language || !language[0]) @@ -117,7 +117,7 @@ static const char *enca_guess(bstr buf, const char *language) } #endif -#ifdef CONFIG_LIBGUESS +#if HAVE_LIBGUESS static const char *libguess_guess(bstr buf, const char *language) { if (!language || !language[0] || strcmp(language, "help") == 0) { @@ -157,11 +157,11 @@ const char *mp_charset_guess(bstr buf, const char *user_cp, int flags) const char *res = NULL; -#ifdef CONFIG_ENCA +#if HAVE_ENCA if (bstrcasecmp0(type, "enca") == 0) res = enca_guess(buf, lang); #endif -#ifdef CONFIG_LIBGUESS +#if HAVE_LIBGUESS if (bstrcasecmp0(type, "guess") == 0) res = libguess_guess(buf, lang); #endif @@ -212,7 +212,7 @@ bstr mp_charset_guess_and_conv_to_utf8(bstr buf, const char *user_cp, int flags) // returns: buf (no conversion), .start==NULL (error), or allocated buffer bstr mp_iconv_to_utf8(bstr buf, const char *cp, int flags) { -#ifdef CONFIG_ICONV +#if HAVE_ICONV if (!cp || !cp[0] || mp_charset_is_utf8(cp)) return buf; |