diff options
-rw-r--r-- | compton.c | 14 | ||||
-rw-r--r-- | compton.h | 29 |
2 files changed, 33 insertions, 10 deletions
@@ -3071,7 +3071,7 @@ open_config_file(char *cpath, char **ppath) { */ static void parse_config(char *cpath, struct options_tmp *pcfgtmp) { - char *path = NULL, *parent = NULL; + char *path = NULL; FILE *f; config_t cfg; int ival = 0; @@ -3085,9 +3085,11 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) { } config_init(&cfg); - parent = dirname(path); +#ifndef CONFIG_LIBCONFIG_LEGACY + char *parent = dirname(path); if (parent) config_set_include_dir(&cfg, parent); +#endif if (CONFIG_FALSE == config_read(&cfg, f)) { printf("Error when reading configuration file \"%s\", line %d: %s\n", @@ -3104,7 +3106,7 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) { // right now. It will be done later // -D (fade_delta) - if (config_lookup_int(&cfg, "fade-delta", &ival)) + if (lcfg_lookup_int(&cfg, "fade-delta", &ival)) opts.fade_delta = ival; // -I (fade_in_step) if (config_lookup_float(&cfg, "fade-in-step", &dval)) @@ -3113,13 +3115,13 @@ parse_config(char *cpath, struct options_tmp *pcfgtmp) { if (config_lookup_float(&cfg, "fade-out-step", &dval)) opts.fade_out_step = normalize_d(dval) * OPAQUE; // -r (shadow_radius) - config_lookup_int(&cfg, "shadow-radius", &opts.shadow_radius); + lcfg_lookup_int(&cfg, "shadow-radius", &opts.shadow_radius); // -o (shadow_opacity) config_lookup_float(&cfg, "shadow-opacity", &opts.shadow_opacity); // -l (shadow_offset_x) - config_lookup_int(&cfg, "shadow-offset-x", &opts.shadow_offset_x); + lcfg_lookup_int(&cfg, "shadow-offset-x", &opts.shadow_offset_x); // -t (shadow_offset_y) - config_lookup_int(&cfg, "shadow-offset-y", &opts.shadow_offset_y); + lcfg_lookup_int(&cfg, "shadow-offset-y", &opts.shadow_offset_y); // -i (inactive_opacity) if (config_lookup_float(&cfg, "inactive-opacity", &dval)) opts.inactive_opacity = normalize_d(dval) * OPAQUE; @@ -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); |