configure.ac, Makefile.am, pcre.c, regexp.c: Overhaul conditional building.
[anag] / regexp.c
index c930ea5..cd12f15 100644 (file)
--- a/regexp.c
+++ b/regexp.c
 
 /*----- Header files ------------------------------------------------------*/
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
-
-#ifndef HAVE_REGCOMP
-  extern int dummy;
-#else
-
 #include "anag.h"
+
 #include <regex.h>
 
 /*----- Data structures ---------------------------------------------------*/
@@ -52,19 +45,17 @@ typedef struct node_regexp {
 static int n_regexp(node *nn, const char *p, size_t sz)
 {
   node_regexp *n = (node_regexp *)nn;
+  char buf[256];
   int e;
 
   switch (e = regexec(&n->rx, p, 0, 0, 0)) {
-    case 0:
-      return 1;
-    case REG_NOMATCH:
-      return 0;
-    default: {
-      char buf[256];
+    case 0: return 1;
+    case REG_NOMATCH: return 0;
+    default:
       regerror(e, &n->rx, buf, sizeof(buf));
       die("error matching regexp `%s' against `%s': %s",
          n->s, p, buf);
-    } break;
+      break;
   }
   return (0);
 }
@@ -74,11 +65,12 @@ static int n_regexp(node *nn, const char *p, size_t sz)
 node *regexp(const char *const *av)
 {
   node_regexp *n = xmalloc(sizeof(*n));
+  char buf[256];
   int e;
+
   n->n.func = n_regexp;
   if ((e = regcomp(&n->rx, av[0],
                   REG_EXTENDED | REG_ICASE | REG_NOSUB)) != 0) {
-    char buf[256];
     regerror(e, &n->rx, buf, sizeof(buf));
     die("bad regular expression `%s': %s", av[0], buf);
   }
@@ -86,5 +78,3 @@ node *regexp(const char *const *av)
 }
 
 /*----- That's all, folks -------------------------------------------------*/
-
-#endif