add completion callback for overlay topology configure functions
[oweals/gnunet.git] / src / regex / perf-regex.c
index f1d21f564b2e5498f6469dfb99c0b3a5757fd416..45642db4cac8e8d67e61bc0112549b378295052b 100644 (file)
@@ -51,8 +51,6 @@ main (int argc, char *const *argv)
   char **regexes;
   char *buffer;
   char *regex;
-  unsigned int nr;
-  unsigned int i;
   int compression;
   long size;
 
@@ -65,21 +63,24 @@ main (int argc, char *const *argv)
   }
   regexes = GNUNET_REGEX_read_from_file (argv[1]);
 
+  if (NULL == regexes)
+  {
+    usage();
+    return 2;
+  }
   buffer = GNUNET_REGEX_combine (regexes);
 
   GNUNET_asprintf (&regex, "GNVPN-0001-PAD(%s)(0|1)*", buffer);
   size = strlen (regex);
-  
-  // fprintf (stderr, "Combined regex:\n%s\n", regex);
+
+  // fprintf (stderr, "Combined regex (%ld bytes):\n%s\n", size, regex);
   //   return 0;
 
   compression = atoi (argv[2]);
   dfa = GNUNET_REGEX_construct_dfa (regex, size, compression);
   GNUNET_REGEX_automaton_destroy (dfa);
   GNUNET_free (buffer);
-  for (i=0;i<nr;i++)
-    GNUNET_free_non_null (regexes[i]);
-  GNUNET_array_grow (regexes, nr, 0);
+  GNUNET_REGEX_free_from_file (regexes);
   return 0;
 }