Skip to content

Commit

Permalink
Make sure no assertion expression has side effects
Browse files Browse the repository at this point in the history
  • Loading branch information
rg3 committed Jun 6, 2015
1 parent 49ee4b4 commit 5f575e3
Show file tree
Hide file tree
Showing 8 changed files with 1,417 additions and 482 deletions.
538 changes: 380 additions & 158 deletions database.c

Large diffs are not rendered by default.

255 changes: 172 additions & 83 deletions database_test.c

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions messages.c
Expand Up @@ -113,17 +113,18 @@ void init_tokens(struct tokens *t)
static int tokenize_callout(pcre_callout_block *b)
{
struct tokens *t;
int ret;

t = (struct tokens *)(b->callout_data);

/* Too many tokens. */
if (t->counter >= MAX_TOKENS)
return PCRE_ERROR_CALLOUT;

assert(pcre_copy_substring(b->subject, b->offset_vector,
b->callout_number + 1, b->callout_number,
t->token[t->counter], MESSAGE_BUFFER_SIZE)
>= 0);
ret = pcre_copy_substring(b->subject, b->offset_vector,
b->callout_number + 1, b->callout_number,
t->token[t->counter], MESSAGE_BUFFER_SIZE);
assert(ret >= 0);
t->counter += 1;
return 0;
}
Expand Down

0 comments on commit 5f575e3

Please sign in to comment.