- fix
[oweals/gnunet.git] / src / regex / perf-regex.c
index 9f510b154e5ac45ef00e678877328042ea6c560f..4e339d2282193c6b3a7c6f7dabefa28d09bbc528 100644 (file)
@@ -19,7 +19,7 @@
 */
 
 /**
- * @file src/regex/prof-regex.c
+ * @file src/regex/perf-regex.c
  * @brief Test how long it takes to create a automaton from a string regex.
  * @author Bartlomiej Polot
  */
@@ -38,7 +38,10 @@ usage(void)
 }
 
 /**
- * The main function to obtain peer information.
+ * The main function of the regex performace test.
+ * 
+ * Read a set of regex from a file, combine them and create a DFA from the
+ * resulting combined regex.
  *
  * @param argc number of arguments from the command line
  * @param argv command line arguments
@@ -51,8 +54,6 @@ main (int argc, char *const *argv)
   char **regexes;
   char *buffer;
   char *regex;
-  unsigned int nr;
-  unsigned int i;
   int compression;
   long size;
 
@@ -75,16 +76,14 @@ main (int argc, char *const *argv)
   GNUNET_asprintf (&regex, "GNVPN-0001-PAD(%s)(0|1)*", buffer);
   size = strlen (regex);
 
-  // fprintf (stderr, "Combined regex (%ld bytes):\n%s\n", size, 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;NULL != regexes[i];i++)
-    GNUNET_free_non_null (regexes[i]);
-  GNUNET_free (regexes);
+  GNUNET_REGEX_free_from_file (regexes);
   return 0;
 }