aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-02-27 17:41:12 +0000
committerBart Polot <bart@net.in.tum.de>2013-02-27 17:41:12 +0000
commit2d3c37674ed1cda083ec30b2e21e858a06eb1f3c (patch)
treed2e6bfda88855ebc1ce1c94bd59d4e706d090c25 /src
parentf7f6d5a8ea75b488a84b5ed1e550c6ac7ef82724 (diff)
downloadgnunet-2d3c37674ed1cda083ec30b2e21e858a06eb1f3c.tar.gz
gnunet-2d3c37674ed1cda083ec30b2e21e858a06eb1f3c.zip
- Unify log format
Diffstat (limited to 'src')
-rw-r--r--src/regex/regex_block_lib.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/regex/regex_block_lib.c b/src/regex/regex_block_lib.c
index 95361ca95..deb496fd9 100644
--- a/src/regex/regex_block_lib.c
+++ b/src/regex/regex_block_lib.c
@@ -24,6 +24,7 @@
24#include "platform.h" 24#include "platform.h"
25#include "regex_block_lib.h" 25#include "regex_block_lib.h"
26 26
27#define LOG(kind,...) GNUNET_log_from (kind,"regex-bck",__VA_ARGS__)
27 28
28/** 29/**
29 * Struct to keep track of the xquery while iterating all the edges in a block. 30 * Struct to keep track of the xquery while iterating all the edges in a block.
@@ -138,51 +139,51 @@ GNUNET_REGEX_block_iterate (const struct RegexBlock *block,
138 char *aux; 139 char *aux;
139 140
140 offset = sizeof (struct RegexBlock); 141 offset = sizeof (struct RegexBlock);
141 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 142 LOG (GNUNET_ERROR_TYPE_DEBUG,
142 "* Start iterating block of size %u, off %u\n", 143 "* Start iterating block of size %u, off %u\n",
143 size, offset); 144 size, offset);
144 if (offset > size) // Is it safe to access the regex block? 145 if (offset > size) // Is it safe to access the regex block?
145 { 146 {
146 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 147 LOG (GNUNET_ERROR_TYPE_WARNING,
147 "* Block is smaller than struct RegexBlock, END\n"); 148 "* Block is smaller than struct RegexBlock, END\n");
148 GNUNET_break_op (0); 149 GNUNET_break_op (0);
149 return GNUNET_SYSERR; 150 return GNUNET_SYSERR;
150 } 151 }
151 n = ntohl (block->n_proof); 152 n = ntohl (block->n_proof);
152 offset += n; 153 offset += n;
153 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 154 LOG (GNUNET_ERROR_TYPE_DEBUG,
154 "* Proof length: %u, off %u\n", n, offset); 155 "* Proof length: %u, off %u\n", n, offset);
155 if (offset > size) // Is it safe to access the regex proof? 156 if (offset > size) // Is it safe to access the regex proof?
156 { 157 {
157 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 158 LOG (GNUNET_ERROR_TYPE_WARNING,
158 "* Block is smaller than Block + proof, END\n"); 159 "* Block is smaller than Block + proof, END\n");
159 GNUNET_break_op (0); 160 GNUNET_break_op (0);
160 return GNUNET_SYSERR; 161 return GNUNET_SYSERR;
161 } 162 }
162 aux = (char *) &block[1]; // Skip regex block 163 aux = (char *) &block[1]; // Skip regex block
163 aux = &aux[n]; // Skip regex proof 164 aux = &aux[n]; // Skip regex proof
164 n = ntohl (block->n_edges); 165 n = ntohl (block->n_edges);
165 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Edges: %u\n", n); 166 LOG (GNUNET_ERROR_TYPE_DEBUG, "* Edges: %u\n", n);
166 for (i = 0; i < n; i++) // aux always points at the end of the previous block 167 for (i = 0; i < n; i++) // aux always points at the end of the previous block
167 { 168 {
168 offset += sizeof (struct RegexEdge); 169 offset += sizeof (struct RegexEdge);
169 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "* Edge %u, off %u\n", i, offset); 170 LOG (GNUNET_ERROR_TYPE_DEBUG, "* Edge %u, off %u\n", i, offset);
170 if (offset > size) // Is it safe to access the next edge block? 171 if (offset > size) // Is it safe to access the next edge block?
171 { 172 {
172 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 173 LOG (GNUNET_ERROR_TYPE_WARNING,
173 "* Size not enough for RegexEdge, END\n"); 174 "* Size not enough for RegexEdge, END\n");
174 GNUNET_break_op (0); 175 GNUNET_break_op (0);
175 return GNUNET_SYSERR; 176 return GNUNET_SYSERR;
176 } 177 }
177 edge = (struct RegexEdge *) aux; 178 edge = (struct RegexEdge *) aux;
178 n_token = ntohl (edge->n_token); 179 n_token = ntohl (edge->n_token);
179 offset += n_token; 180 offset += n_token;
180 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 181 LOG (GNUNET_ERROR_TYPE_DEBUG,
181 "* Token lenght %u, off %u\n", n_token, offset); 182 "* Token lenght %u, off %u\n", n_token, offset);
182 if (offset > size) // Is it safe to access the edge token? 183 if (offset > size) // Is it safe to access the edge token?
183 { 184 {
184 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 185 LOG (GNUNET_ERROR_TYPE_WARNING,
185 "* Size not enough for edge token, END\n"); 186 "* Size not enough for edge token, END\n");
186 GNUNET_break_op (0); 187 GNUNET_break_op (0);
187 return GNUNET_SYSERR; 188 return GNUNET_SYSERR;
188 } 189 }
@@ -197,12 +198,11 @@ GNUNET_REGEX_block_iterate (const struct RegexBlock *block,
197 // assumed correct. 198 // assumed correct.
198 if (offset == size || SIZE_MAX == size) 199 if (offset == size || SIZE_MAX == size)
199 { 200 {
200 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 201 LOG (GNUNET_ERROR_TYPE_DEBUG, "* Block processed, END OK\n");
201 "* Block processed, END OK\n");
202 return GNUNET_OK; 202 return GNUNET_OK;
203 } 203 }
204 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 204 LOG (GNUNET_ERROR_TYPE_WARNING,
205 "* Size %u (%d), read %u END KO\n", size, size, offset); 205 "* Size %u (%d), read %u END KO\n", size, size, offset);
206 GNUNET_break_op (0); 206 GNUNET_break_op (0);
207 return GNUNET_SYSERR; 207 return GNUNET_SYSERR;
208} 208}