summaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/gnunet-regex-simulation-profiler.c2
-rw-r--r--src/regex/plugin_block_regex.c2
-rw-r--r--src/regex/regex_internal.c14
-rw-r--r--src/regex/regex_internal_dht.c8
-rw-r--r--src/regex/regex_test_lib.c8
5 files changed, 17 insertions, 17 deletions
diff --git a/src/regex/gnunet-regex-simulation-profiler.c b/src/regex/gnunet-regex-simulation-profiler.c
index fdbc918c2..4b3cf5bcd 100644
--- a/src/regex/gnunet-regex-simulation-profiler.c
+++ b/src/regex/gnunet-regex-simulation-profiler.c
@@ -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;
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 1db1d0d5e..ac9eee07c 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -320,7 +320,7 @@ libgnunet_plugin_block_regex_init (void *cls)
};
struct GNUNET_BLOCK_PluginFunctions *api;
- api = GNUNET_malloc (sizeof (struct GNUNET_BLOCK_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions);
api->evaluate = &block_plugin_regex_evaluate;
api->get_key = &block_plugin_regex_get_key;
api->types = types;
diff --git a/src/regex/regex_internal.c b/src/regex/regex_internal.c
index 4e0d5acc5..2eeb48b3b 100644
--- a/src/regex/regex_internal.c
+++ b/src/regex/regex_internal.c
@@ -132,7 +132,7 @@ state_add_transition (struct REGEX_INTERNAL_Context *ctx,
break;
}
- t = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Transition));
+ t = GNUNET_new (struct REGEX_INTERNAL_Transition);
if (NULL != ctx)
t->id = ctx->transition_id++;
if (NULL != label)
@@ -1774,7 +1774,7 @@ dfa_state_create (struct REGEX_INTERNAL_Context *ctx,
struct REGEX_INTERNAL_Transition *ctran;
unsigned int i;
- s = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_State));
+ s = GNUNET_new (struct REGEX_INTERNAL_State);
s->id = ctx->state_id++;
s->index = -1;
s->lowlink = -1;
@@ -2143,7 +2143,7 @@ dfa_add_multi_strides_helper (void *cls, const unsigned int depth, char *label,
if (depth == ctx->stride)
{
- t = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Transition));
+ t = GNUNET_new (struct REGEX_INTERNAL_Transition);
t->label = GNUNET_strdup (label);
t->to_state = s;
t->from_state = start;
@@ -2258,7 +2258,7 @@ dfa_compress_paths_helper (struct REGEX_INTERNAL_Automaton *dfa,
max_len == strlen (label)) ||
(start == dfa->start && GNUNET_REGEX_INITIAL_BYTES == strlen (label))))
{
- t = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Transition));
+ t = GNUNET_new (struct REGEX_INTERNAL_Transition);
t->label = GNUNET_strdup (label);
t->to_state = cur;
t->from_state = start;
@@ -2375,7 +2375,7 @@ nfa_fragment_create (struct REGEX_INTERNAL_State *start,
{
struct REGEX_INTERNAL_Automaton *n;
- n = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Automaton));
+ n = GNUNET_new (struct REGEX_INTERNAL_Automaton);
n->type = NFA;
n->start = NULL;
@@ -2448,7 +2448,7 @@ nfa_state_create (struct REGEX_INTERNAL_Context *ctx, int accepting)
{
struct REGEX_INTERNAL_State *s;
- s = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_State));
+ s = GNUNET_new (struct REGEX_INTERNAL_State);
s->id = ctx->state_id++;
s->accepting = accepting;
s->marked = GNUNET_NO;
@@ -3043,7 +3043,7 @@ REGEX_INTERNAL_construct_dfa (const char *regex, const size_t len,
return NULL;
}
- dfa = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Automaton));
+ dfa = GNUNET_new (struct REGEX_INTERNAL_Automaton);
dfa->type = DFA;
dfa->regex = GNUNET_strdup (regex);
diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c
index e87881902..f7d383406 100644
--- a/src/regex/regex_internal_dht.c
+++ b/src/regex/regex_internal_dht.c
@@ -187,7 +187,7 @@ REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht,
struct REGEX_INTERNAL_Announcement *h;
GNUNET_assert (NULL != dht);
- h = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Announcement));
+ h = GNUNET_new (struct REGEX_INTERNAL_Announcement);
h->regex = regex;
h->dht = dht;
h->stats = stats;
@@ -614,7 +614,7 @@ regex_next_edge (const struct RegexBlock *block,
}
hash = &ctx->hash;
- new_ctx = GNUNET_malloc (sizeof (struct RegexSearchContext));
+ new_ctx = GNUNET_new (struct RegexSearchContext);
new_ctx->info = info;
new_ctx->position = ctx->position + ctx->longest_match;
GNUNET_array_append (info->contexts, info->n_contexts, new_ctx);
@@ -693,7 +693,7 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht,
LOG (GNUNET_ERROR_TYPE_INFO, "REGEX_INTERNAL_search: %s\n", string);
GNUNET_assert (NULL != dht);
GNUNET_assert (NULL != callback);
- h = GNUNET_malloc (sizeof (struct REGEX_INTERNAL_Search));
+ h = GNUNET_new (struct REGEX_INTERNAL_Search);
h->dht = dht;
h->description = GNUNET_strdup (string);
h->callback = callback;
@@ -708,7 +708,7 @@ REGEX_INTERNAL_search (struct GNUNET_DHT_Handle *dht,
LOG (GNUNET_ERROR_TYPE_INFO,
" initial key for %s: %s (%.*s)\n",
string, GNUNET_h2s (&key), size, string);
- ctx = GNUNET_malloc (sizeof (struct RegexSearchContext));
+ ctx = GNUNET_new (struct RegexSearchContext);
ctx->position = size;
ctx->info = h;
GNUNET_array_append (h->contexts, h->n_contexts, ctx);
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c
index 09d608e65..2f3abdc65 100644
--- a/src/regex/regex_test_lib.c
+++ b/src/regex/regex_test_lib.c
@@ -245,7 +245,7 @@ regex_add (struct RegexCombineCtx *ctx, const char *regex)
len = strlen (p->s);
if (prefix_l < len) /* only partial match, split existing state */
{
- newctx = GNUNET_malloc (sizeof (struct RegexCombineCtx));
+ newctx = GNUNET_new (struct RegexCombineCtx);
newctx->head = p->head;
newctx->tail = p->tail;
newctx->s = GNUNET_malloc(len - prefix_l + 1);
@@ -262,14 +262,14 @@ regex_add (struct RegexCombineCtx *ctx, const char *regex)
if (NULL == ctx->head && NULL != ctx->s)
{
/* this was the end before, add empty string */
- newctx = GNUNET_malloc (sizeof (struct RegexCombineCtx));
+ newctx = GNUNET_new (struct RegexCombineCtx);
newctx->s = GNUNET_strdup ("");
GNUNET_CONTAINER_DLL_insert (ctx->head, ctx->tail, newctx);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " no match\n");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " new state %s\n", regex);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " under %s\n", ctx->s);
- newctx = GNUNET_malloc (sizeof (struct RegexCombineCtx));
+ newctx = GNUNET_new (struct RegexCombineCtx);
newctx->s = GNUNET_strdup (regex);
GNUNET_CONTAINER_DLL_insert (ctx->head, ctx->tail, newctx);
}
@@ -312,7 +312,7 @@ REGEX_TEST_combine (char * const regexes[])
const char *current;
struct RegexCombineCtx *ctx;
- ctx = GNUNET_malloc (sizeof (struct RegexCombineCtx));
+ ctx = GNUNET_new (struct RegexCombineCtx);
for (i = 0; regexes[i]; i++)
{
current = regexes[i];