aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-03-11 16:34:25 +0000
committerBart Polot <bart@net.in.tum.de>2013-03-11 16:34:25 +0000
commite2b8b97e769f8963876b7e820601d792058e9b55 (patch)
tree5c7154478e313b139bbb0caf4017da86694663c6 /src/regex
parent62a31bd538959fc4defa7548a92ce25de6a07a19 (diff)
downloadgnunet-e2b8b97e769f8963876b7e820601d792058e9b55.tar.gz
gnunet-e2b8b97e769f8963876b7e820601d792058e9b55.zip
- Add show parent key for every edge (grep friendlyness++)
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/regex_block_lib.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c
index 3f7c9473a..2c0e185f1 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -40,6 +40,11 @@ struct regex_block_xquery_ctx
40 * Has any edge matched the xquery so far? (GNUNET_OK / GNUNET_NO) 40 * Has any edge matched the xquery so far? (GNUNET_OK / GNUNET_NO)
41 */ 41 */
42 int found; 42 int found;
43
44 /**
45 * Key of the block we are iterating (for debug purposes).
46 */
47 char *key;
43}; 48};
44 49
45 50
@@ -61,8 +66,10 @@ check_edge (void *cls,
61{ 66{
62 struct regex_block_xquery_ctx *ctx = cls; 67 struct regex_block_xquery_ctx *ctx = cls;
63 68
64 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " edge %.*s [%u]\n", 69
65 (int) len, token, len); 70 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " edge %.*s [%u]: %s->%s\n",
71 (int) len, token, len, ctx->key, GNUNET_h2s(key));
72
66 if (NULL == ctx->xquery) 73 if (NULL == ctx->xquery)
67 return GNUNET_YES; 74 return GNUNET_YES;
68 if (strlen (ctx->xquery) < len) 75 if (strlen (ctx->xquery) < len)
@@ -101,7 +108,9 @@ GNUNET_REGEX_block_check (const struct RegexBlock *block,
101 return GNUNET_OK; 108 return GNUNET_OK;
102 ctx.xquery = xquery; 109 ctx.xquery = xquery;
103 ctx.found = GNUNET_NO; 110 ctx.found = GNUNET_NO;
111 ctx.key = GNUNET_strdup (GNUNET_h2s (&block->key));
104 res = GNUNET_REGEX_block_iterate (block, size, &check_edge, &ctx); 112 res = GNUNET_REGEX_block_iterate (block, size, &check_edge, &ctx);
113 GNUNET_free (ctx.key);
105 if (GNUNET_SYSERR == res) 114 if (GNUNET_SYSERR == res)
106 return GNUNET_SYSERR; 115 return GNUNET_SYSERR;
107 if (NULL == xquery) 116 if (NULL == xquery)