added helper for handling the "view" in rps
[oweals/gnunet.git] / src / regex / gnunet-regex-simulation-profiler.c
index 32b09eaeedbf6edfee0d395be496b08c469fc79e..4555b1f14e0198cf1ab8680f845cf98f6da16aa7 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2011, 2012 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2011, 2012 Christian Grothoff (and other contributing authors)
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
  * @file regex/gnunet-regex-simulation-profiler.c
  * @brief Regex profiler that dumps all DFAs into a database instead of
- *        using the DHT (with mesh).
+ *        using the DHT (with cadet).
  * @author Maximilian Szengel
  *
  */
 
 #include "platform.h"
 #include "gnunet_util_lib.h"
-#include "gnunet_regex_lib.h"
+#include "regex_internal_lib.h"
 #include "gnunet_mysql_lib.h"
 #include <mysql/mysql.h>
 
@@ -91,17 +91,17 @@ static struct ProgressMeter *meter;
 /**
  * Abort task identifier.
  */
-static GNUNET_SCHEDULER_TaskIdentifier abort_task;
+static struct GNUNET_SCHEDULER_Task * abort_task;
 
 /**
  * Shutdown task identifier.
  */
-static GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
+static struct GNUNET_SCHEDULER_Task * shutdown_task;
 
 /**
  * Scan task identifier;
  */
-static GNUNET_SCHEDULER_TaskIdentifier scan_task;
+static struct GNUNET_SCHEDULER_Task * scan_task;
 
 /**
  * Global testing status.
@@ -179,7 +179,7 @@ create_meter (unsigned int total, char *start_string, int print)
 {
   struct ProgressMeter *ret;
 
-  ret = GNUNET_malloc (sizeof (struct ProgressMeter));
+  ret = GNUNET_new (struct ProgressMeter);
   ret->print = print;
   ret->total = total;
   ret->modnum = total / 4;
@@ -276,8 +276,8 @@ free_meter (struct ProgressMeter *meter)
 static void
 do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  shutdown_task = GNUNET_SCHEDULER_NO_TASK;
-  if (GNUNET_SCHEDULER_NO_TASK != abort_task)
+  shutdown_task = NULL;
+  if (NULL != abort_task)
     GNUNET_SCHEDULER_cancel (abort_task);
   if (NULL != mysql_ctx)
     GNUNET_MYSQL_context_destroy (mysql_ctx);
@@ -298,9 +298,9 @@ static void
 do_abort (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Aborting\n");
-  abort_task = GNUNET_SCHEDULER_NO_TASK;
+  abort_task = NULL;
   GNUNET_SCHEDULER_cancel (scan_task);
-  scan_task = GNUNET_SCHEDULER_NO_TASK;
+  scan_task = NULL;
   result = GNUNET_SYSERR;
   GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
 }
@@ -335,7 +335,7 @@ return_ok (void *cls, unsigned int num_values, MYSQL_BIND * values)
 static void
 regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof,
                 int accepting, unsigned int num_edges,
-                const struct GNUNET_REGEX_Edge *edges)
+                const struct REGEX_BLOCK_Edge *edges)
 {
   unsigned int i;
   int result;
@@ -460,10 +460,10 @@ regex_iterator (void *cls, const struct GNUNET_HashCode *key, const char *proof,
 static int
 announce_regex (const char *regex)
 {
-  struct GNUNET_REGEX_Automaton *dfa;
+  struct REGEX_INTERNAL_Automaton *dfa;
 
   dfa =
-      GNUNET_REGEX_construct_dfa (regex, strlen (regex), max_path_compression);
+      REGEX_INTERNAL_construct_dfa (regex, strlen (regex), max_path_compression);
 
   if (NULL == dfa)
   {
@@ -473,9 +473,9 @@ announce_regex (const char *regex)
     return GNUNET_SYSERR;
   }
 
-  GNUNET_REGEX_iterate_all_edges (dfa, &regex_iterator, NULL);
+  REGEX_INTERNAL_iterate_all_edges (dfa, &regex_iterator, NULL);
 
-  GNUNET_REGEX_automaton_destroy (dfa);
+  REGEX_INTERNAL_automaton_destroy (dfa);
 
   return GNUNET_OK;
 }
@@ -489,7 +489,7 @@ announce_regex (const char *regex)
  * @return GNUNET_OK to continue to iterate,
  *  GNUNET_SYSERR to abort iteration with error!
  */
-int
+static int
 policy_filename_cb (void *cls, const char *filename)
 {
   char *regex;