aboutsummaryrefslogtreecommitdiff
path: root/src/regex/regex_block_lib.c
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/regex_block_lib.c
parent62a31bd538959fc4defa7548a92ce25de6a07a19 (diff)
- Add show parent key for every edge (grep friendlyness++)
Diffstat (limited to 'src/regex/regex_block_lib.c')
-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 3f7c9473a8..2c0e185f1e 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -40,6 +40,11 @@ struct regex_block_xquery_ctx
* Has any edge matched the xquery so far? (GNUNET_OK / GNUNET_NO)
*/
int found;
+
+ /**
+ * Key of the block we are iterating (for debug purposes).
+ */
+ char *key;
};
@@ -61,8 +66,10 @@ check_edge (void *cls,
{
struct regex_block_xquery_ctx *ctx = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " edge %.*s [%u]\n",
- (int) len, token, len);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " edge %.*s [%u]: %s->%s\n",
+ (int) len, token, len, ctx->key, GNUNET_h2s(key));
+
if (NULL == ctx->xquery)
return GNUNET_YES;
if (strlen (ctx->xquery) < len)
@@ -101,7 +108,9 @@ GNUNET_REGEX_block_check (const struct RegexBlock *block,
return GNUNET_OK;
ctx.xquery = xquery;
ctx.found = GNUNET_NO;
+ ctx.key = GNUNET_strdup (GNUNET_h2s (&block->key));
res = GNUNET_REGEX_block_iterate (block, size, &check_edge, &ctx);
+ GNUNET_free (ctx.key);
if (GNUNET_SYSERR == res)
return GNUNET_SYSERR;
if (NULL == xquery)