diff options
author | Clint Adams <clint@users.sourceforge.net> | 2007-04-05 16:20:11 +0000 |
---|---|---|
committer | Clint Adams <clint@users.sourceforge.net> | 2007-04-05 16:20:11 +0000 |
commit | aeaf47aeebccd71f533bdd926cb054e0bd8fb0aa (patch) | |
tree | 662e323747f1f6f5420b2142b29add52bd8580a6 /Src/Modules | |
parent | 54949051daa89260b53b12fb571c59a855cdc76a (diff) | |
download | zsh-aeaf47aeebccd71f533bdd926cb054e0bd8fb0aa.tar.gz zsh-aeaf47aeebccd71f533bdd926cb054e0bd8fb0aa.tar.xz zsh-aeaf47aeebccd71f533bdd926cb054e0bd8fb0aa.zip |
23264: don't add the -pcre-match operator unless the pcre functions are available.
Diffstat (limited to 'Src/Modules')
-rw-r--r-- | Src/Modules/pcre.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Src/Modules/pcre.c b/Src/Modules/pcre.c index 3ed536671..c19c8c137 100644 --- a/Src/Modules/pcre.c +++ b/Src/Modules/pcre.c @@ -189,13 +189,16 @@ cond_pcre_match(char **a, int id) return 0; } +static struct conddef cotab[] = { + CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN) +}; + /**/ #else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ # define bin_pcre_compile bin_notavail # define bin_pcre_study bin_notavail # define bin_pcre_match bin_notavail -# define cond_pcre_match cond_match /**/ #endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ @@ -206,10 +209,6 @@ static struct builtin bintab[] = { BUILTIN("pcre_match", 0, bin_pcre_match, 1, 2, 0, "a", NULL) }; -static struct conddef cotab[] = { - CONDDEF("pcre-match", CONDF_INFIX, cond_pcre_match, 0, 0, CPCRE_PLAIN) -}; - /**/ int @@ -222,8 +221,12 @@ setup_(UNUSED(Module m)) int boot_(Module m) { +#if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC) return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)) || !addconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab)); +#else /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ + return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); +#endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ } /**/ @@ -231,7 +234,9 @@ int cleanup_(Module m) { deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab)); +#if defined(HAVE_PCRE_COMPILE) && defined(HAVE_PCRE_EXEC) deleteconddefs(m->nam, cotab, sizeof(cotab)/sizeof(*cotab)); +#endif /* !(HAVE_PCRE_COMPILE && HAVE_PCRE_EXEC) */ return 0; } |