Skip to content

Commit

Permalink
lib-sieve: match types: Fixed match function return values to be int …
Browse files Browse the repository at this point in the history
…rather than bool.

Found with clang -Wstrict-bool.
  • Loading branch information
stephanbosch committed Oct 14, 2016
1 parent 44b80a9 commit 671796f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/lib-sieve/mcht-contains.c
Expand Up @@ -50,17 +50,17 @@ static int mcht_contains_match_key
const char *kp = key;

if ( val_size == 0 )
return ( key_size == 0 );
return ( key_size == 0 ? 1 : 0 );

if ( cmp->def == NULL || cmp->def->char_match == NULL )
return FALSE;
return 0;

while ( (vp < vend) && (kp < kend) ) {
if ( !cmp->def->char_match(cmp, &vp, vend, &kp, kend) )
vp++;
}

return (kp == kend);
return ( kp == kend ? 1 : 0 );
}


4 changes: 2 additions & 2 deletions src/lib-sieve/mcht-is.c
Expand Up @@ -41,12 +41,12 @@ static int mcht_is_match_key
const char *key, size_t key_size)
{
if ( val_size == 0 )
return ( key_size == 0 );
return ( key_size == 0 ? 1 : 0 );

if ( mctx->comparator->def != NULL && mctx->comparator->def->compare != NULL )
return (mctx->comparator->def->compare(mctx->comparator,
val, val_size, key, key_size) == 0);

return FALSE;
return 0;
}

6 changes: 3 additions & 3 deletions src/lib-sieve/mcht-matches.c
Expand Up @@ -95,7 +95,7 @@ static int mcht_matches_match_key
unsigned int key_offset = 0;

if ( cmp->def == NULL || cmp->def->char_match == NULL )
return FALSE;
return 0;

/* Key sections */
section = t_str_new(32); /* Section (after beginning or *) */
Expand Down Expand Up @@ -428,11 +428,11 @@ static int mcht_matches_match_key
/* Commit new match values */
sieve_match_values_commit(mctx->runenv, &mvalues);
}
return TRUE;
return 1;
}

/* No match; drop collected match values */
sieve_match_values_abort(&mvalues);
return FALSE;
return 0;
}

0 comments on commit 671796f

Please sign in to comment.