aboutsummaryrefslogtreecommitdiff
path: root/src/regex/plugin_block_regex.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-26 15:54:54 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-26 15:54:54 +0000
commit7706f0a08b2425622121c23a7d2054794f2d677c (patch)
treed4b658006d8b0418b2afabe51bfae14c3f59bb97 /src/regex/plugin_block_regex.c
parent133a5ecf306d35f9e86fb5a1f8b120783f6afdf9 (diff)
downloadgnunet-7706f0a08b2425622121c23a7d2054794f2d677c.tar.gz
gnunet-7706f0a08b2425622121c23a7d2054794f2d677c.zip
-removing unnecessary key from regex blocks, compacting some of the other fields
Diffstat (limited to 'src/regex/plugin_block_regex.c')
-rw-r--r--src/regex/plugin_block_regex.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index e17b34d33..9eeb13190 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -80,7 +80,7 @@ rdebug (void *cls,
80 */ 80 */
81static enum GNUNET_BLOCK_EvaluationResult 81static enum GNUNET_BLOCK_EvaluationResult
82evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type, 82evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type,
83 const struct GNUNET_HashCode * query, 83 const struct GNUNET_HashCode *query,
84 struct GNUNET_CONTAINER_BloomFilter **bf, 84 struct GNUNET_CONTAINER_BloomFilter **bf,
85 int32_t bf_mutator, const void *xquery, 85 int32_t bf_mutator, const void *xquery,
86 size_t xquery_size, const void *reply_block, 86 size_t xquery_size, const void *reply_block,
@@ -106,15 +106,16 @@ evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type,
106 106
107 GNUNET_break_op (0); 107 GNUNET_break_op (0);
108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
109 "Block with no xquery, key: %s, %u edges\n", 109 "Block with no xquery, query: %s, %u edges\n",
110 GNUNET_h2s (&rblock->key), 110 GNUNET_h2s (query),
111 ntohl (rblock->n_edges)); 111 ntohl (rblock->n_edges));
112 REGEX_BLOCK_iterate (rblock, reply_block_size, &rdebug, NULL); 112 REGEX_BLOCK_iterate (rblock, reply_block_size, &rdebug, NULL);
113 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; 113 return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
114 } 114 }
115 switch (REGEX_BLOCK_check (reply_block, 115 switch (REGEX_BLOCK_check (reply_block,
116 reply_block_size, 116 reply_block_size,
117 xquery)) 117 query,
118 xquery))
118 { 119 {
119 case GNUNET_SYSERR: 120 case GNUNET_SYSERR:
120 GNUNET_break_op(0); 121 GNUNET_break_op(0);
@@ -276,12 +277,15 @@ block_plugin_regex_get_key (void *cls, enum GNUNET_BLOCK_Type type,
276 const void *block, size_t block_size, 277 const void *block, size_t block_size,
277 struct GNUNET_HashCode * key) 278 struct GNUNET_HashCode * key)
278{ 279{
280 int ret;
281
279 switch (type) 282 switch (type)
280 { 283 {
281 case GNUNET_BLOCK_TYPE_REGEX: 284 case GNUNET_BLOCK_TYPE_REGEX:
282 GNUNET_assert (sizeof (struct RegexBlock) <= block_size); 285 ret = REGEX_BLOCK_get_key (block, block_size,
283 *key = ((struct RegexBlock *) block)->key; 286 key);
284 return GNUNET_OK; 287 GNUNET_break_op (GNUNET_OK == ret);
288 return ret;
285 case GNUNET_BLOCK_TYPE_REGEX_ACCEPT: 289 case GNUNET_BLOCK_TYPE_REGEX_ACCEPT:
286 GNUNET_assert (sizeof (struct RegexAccept) <= block_size); 290 GNUNET_assert (sizeof (struct RegexAccept) <= block_size);
287 *key = ((struct RegexAccept *) block)->key; 291 *key = ((struct RegexAccept *) block)->key;