aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex_test_lib.c
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-12-19 06:00:23 +0000
committerLRN <lrn1986@gmail.com>2013-12-19 06:00:23 +0000
commite0ca7357cd0bfedc5c29cb731b56279fef8da059 (patch)
treeecfd47cf59bc00e656b53fd59c58f5038e342d65 /src/regex/regex_test_lib.c
parent92fd84dc7ef98452f848a62677c61a2b80b5835e (diff)
downloadgnunet-e0ca7357cd0bfedc5c29cb731b56279fef8da059.tar.gz
gnunet-e0ca7357cd0bfedc5c29cb731b56279fef8da059.zip
malloc -> new
Diffstat (limited to 'src/regex/regex_test_lib.c')
-rw-r--r--src/regex/regex_test_lib.c8
1 files changed, 4 insertions, 4 deletions
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)
245 len = strlen (p->s); 245 len = strlen (p->s);
246 if (prefix_l < len) /* only partial match, split existing state */ 246 if (prefix_l < len) /* only partial match, split existing state */
247 { 247 {
248 newctx = GNUNET_malloc (sizeof (struct RegexCombineCtx)); 248 newctx = GNUNET_new (struct RegexCombineCtx);
249 newctx->head = p->head; 249 newctx->head = p->head;
250 newctx->tail = p->tail; 250 newctx->tail = p->tail;
251 newctx->s = GNUNET_malloc(len - prefix_l + 1); 251 newctx->s = GNUNET_malloc(len - prefix_l + 1);
@@ -262,14 +262,14 @@ regex_add (struct RegexCombineCtx *ctx, const char *regex)
262 if (NULL == ctx->head && NULL != ctx->s) 262 if (NULL == ctx->head && NULL != ctx->s)
263 { 263 {
264 /* this was the end before, add empty string */ 264 /* this was the end before, add empty string */
265 newctx = GNUNET_malloc (sizeof (struct RegexCombineCtx)); 265 newctx = GNUNET_new (struct RegexCombineCtx);
266 newctx->s = GNUNET_strdup (""); 266 newctx->s = GNUNET_strdup ("");
267 GNUNET_CONTAINER_DLL_insert (ctx->head, ctx->tail, newctx); 267 GNUNET_CONTAINER_DLL_insert (ctx->head, ctx->tail, newctx);
268 } 268 }
269 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " no match\n"); 269 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " no match\n");
270 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " new state %s\n", regex); 270 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " new state %s\n", regex);
271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " under %s\n", ctx->s); 271 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " under %s\n", ctx->s);
272 newctx = GNUNET_malloc (sizeof (struct RegexCombineCtx)); 272 newctx = GNUNET_new (struct RegexCombineCtx);
273 newctx->s = GNUNET_strdup (regex); 273 newctx->s = GNUNET_strdup (regex);
274 GNUNET_CONTAINER_DLL_insert (ctx->head, ctx->tail, newctx); 274 GNUNET_CONTAINER_DLL_insert (ctx->head, ctx->tail, newctx);
275} 275}
@@ -312,7 +312,7 @@ REGEX_TEST_combine (char * const regexes[])
312 const char *current; 312 const char *current;
313 struct RegexCombineCtx *ctx; 313 struct RegexCombineCtx *ctx;
314 314
315 ctx = GNUNET_malloc (sizeof (struct RegexCombineCtx)); 315 ctx = GNUNET_new (struct RegexCombineCtx);
316 for (i = 0; regexes[i]; i++) 316 for (i = 0; regexes[i]; i++)
317 { 317 {
318 current = regexes[i]; 318 current = regexes[i];