aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex_test_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/regex/regex_test_lib.c')
-rw-r--r--src/regex/regex_test_lib.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/regex/regex_test_lib.c b/src/regex/regex_test_lib.c
index 15d6c653a..05001b5d2 100644
--- a/src/regex/regex_test_lib.c
+++ b/src/regex/regex_test_lib.c
@@ -72,11 +72,11 @@ c2i (char c, int size)
72 break; 72 break;
73 73
74 case 16: 74 case 16:
75 if ((c >= '0') &&(c <= '9') ) 75 if ((c >= '0') && (c <= '9') )
76 return c - '0'; 76 return c - '0';
77 else if ((c >= 'A') &&(c <= 'F') ) 77 else if ((c >= 'A') && (c <= 'F') )
78 return c - 'A' + 10; 78 return c - 'A' + 10;
79 else if ((c >= 'a') &&(c <= 'f') ) 79 else if ((c >= 'a') && (c <= 'f') )
80 return c - 'a' + 10; 80 return c - 'a' + 10;
81 else 81 else
82 { 82 {
@@ -324,6 +324,7 @@ get_longest_prefix (struct RegexCombineCtx *ctx, const char *regex)
324 return best; 324 return best;
325} 325}
326 326
327
327static void 328static void
328regex_add_multiple (struct RegexCombineCtx *ctx, 329regex_add_multiple (struct RegexCombineCtx *ctx,
329 const char *regex, 330 const char *regex,
@@ -347,7 +348,7 @@ regex_add_multiple (struct RegexCombineCtx *ctx,
347 count = 0; 348 count = 0;
348 for (i = 1UL; i < l; i++) 349 for (i = 1UL; i < l; i++)
349 { 350 {
350 if ((regex[i] != '|') &&(regex[i] != ')') ) 351 if ((regex[i] != '|') && (regex[i] != ')') )
351 { 352 {
352 count++; 353 count++;
353 } 354 }
@@ -361,7 +362,7 @@ regex_add_multiple (struct RegexCombineCtx *ctx,
361 tmp[1] = '\0'; 362 tmp[1] = '\0';
362 for (i = 1UL; i < l; i++) 363 for (i = 1UL; i < l; i++)
363 { 364 {
364 if ((regex[i] != '|') &&(regex[i] != ')') ) 365 if ((regex[i] != '|') && (regex[i] != ')') )
365 { 366 {
366 tmp[0] = regex[i]; 367 tmp[0] = regex[i];
367 newctx = new_regex_ctx (ctx->size); 368 newctx = new_regex_ctx (ctx->size);
@@ -375,6 +376,7 @@ regex_add_multiple (struct RegexCombineCtx *ctx,
375 } 376 }
376} 377}
377 378
379
378/** 380/**
379 * Add a single regex to a context, splitting the exisiting state. 381 * Add a single regex to a context, splitting the exisiting state.
380 * 382 *
@@ -482,7 +484,7 @@ regex_add (struct RegexCombineCtx *ctx, const char *regex)
482 484
483 /* There is no prefix match, add new */ 485 /* There is no prefix match, add new */
484 idx = c2i (regex[0], ctx->size); 486 idx = c2i (regex[0], ctx->size);
485 if ((NULL == ctx->children[idx])&&(NULL != ctx->s)) 487 if ((NULL == ctx->children[idx]) && (NULL != ctx->s))
486 { 488 {
487 /* this was the end before, add empty string */ 489 /* this was the end before, add empty string */
488 newctx = new_regex_ctx (ctx->size); 490 newctx = new_regex_ctx (ctx->size);
@@ -652,4 +654,5 @@ REGEX_TEST_free_from_file (char **regexes)
652 GNUNET_free (regexes); 654 GNUNET_free (regexes);
653} 655}
654 656
657
655/* end of regex_test_lib.c */ 658/* end of regex_test_lib.c */