summaryrefslogtreecommitdiffstats
path: root/compton.h
diff options
context:
space:
mode:
authorRichard Grenville <[email protected]>2012-09-28 09:10:34 +0800
committerRichard Grenville <[email protected]>2012-09-28 09:19:53 +0800
commitdebc0035cd5cc315e6fe5941e9b36e1eb3548f5f (patch)
tree24446437eeaae3d2556481dd3aa49fed0d942dd2 /compton.h
parent4deb30a903f7be941f0aacab25f2ec285e815325 (diff)
downloadtdebase-debc0035cd5cc315e6fe5941e9b36e1eb3548f5f.tar.gz
tdebase-debc0035cd5cc315e6fe5941e9b36e1eb3548f5f.zip
Bug fix: #48: Compilation failure with old libconfig/libpcre
- Fix compilation failure with <libpcre-8.20 and <libconfig-1.4. Tested with libpcre-8.12 and libconfig-1.3.2, but not extensively tested. libconfig-1.3* probably has more limitations on configuration file syntax (enforces comma at the end of a setting?) and does not support @include. - Make it possible to turn off PCRE and libconfig support using environment variable "CFG". Not well tested. CMake might provide a better solution.
Diffstat (limited to 'compton.h')
-rw-r--r--compton.h29
1 files changed, 25 insertions, 4 deletions
diff --git a/compton.h b/compton.h
index 0c6457c62..51118e8db 100644
--- a/compton.h
+++ b/compton.h
@@ -20,12 +20,12 @@
// Whether to enable PCRE regular expression support in blacklists, enabled
// by default
-#define CONFIG_REGEX_PCRE 1
+// #define CONFIG_REGEX_PCRE 1
// Whether to enable JIT support of libpcre. This may cause problems on PaX
// kernels.
-#define CONFIG_REGEX_PCRE_JIT 1
+// #define CONFIG_REGEX_PCRE_JIT 1
// Whether to enable parsing of configuration files using libconfig
-#define CONFIG_LIBCONFIG 1
+// #define CONFIG_LIBCONFIG 1
// === Includes ===
@@ -49,6 +49,12 @@
#ifdef CONFIG_REGEX_PCRE
#include <pcre.h>
+
+// For compatiblity with <libpcre-8.20
+#ifndef PCRE_STUDY_JIT_COMPILE
+#define PCRE_STUDY_JIT_COMPILE 0
+#endif
+
#endif
#ifdef CONFIG_LIBCONFIG
@@ -923,7 +929,7 @@ static void
fork_after(void);
#ifdef CONFIG_LIBCONFIG
-static void
+static inline void
lcfg_lookup_bool(const config_t *config, const char *path, Bool *value) {
int ival;
@@ -931,6 +937,21 @@ lcfg_lookup_bool(const config_t *config, const char *path, Bool *value) {
*value = ival;
}
+static inline int
+lcfg_lookup_int(const config_t *config, const char *path, int *value) {
+#ifndef CONFIG_LIBCONFIG_LEGACY
+ return config_lookup_int(config, path, value);
+#else
+ long lval;
+ int ret;
+
+ if ((ret = config_lookup_int(config, path, &lval)))
+ *value = lval;
+
+ return ret;
+#endif
+}
+
static FILE *
open_config_file(char *cpath, char **path);