Coverage Report

Created: 2026-06-15 06:45

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pigeonhole/src/lib-sieve/mcht-is.c
Line
Count
Source
1
/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
2
 */
3
4
/* Match-type ':is':
5
 */
6
7
#include "lib.h"
8
9
#include "sieve-match-types.h"
10
#include "sieve-comparators.h"
11
#include "sieve-match.h"
12
13
#include <string.h>
14
#include <stdio.h>
15
16
/*
17
 * Forward declarations
18
 */
19
20
static int mcht_is_match_key
21
  (struct sieve_match_context *mctx, const char *val, size_t val_size,
22
    const char *key, size_t key_size);
23
24
/*
25
 * Match-type object
26
 */
27
28
const struct sieve_match_type_def is_match_type = {
29
  SIEVE_OBJECT("is",
30
    &match_type_operand, SIEVE_MATCH_TYPE_IS),
31
  .match_key = mcht_is_match_key
32
};
33
34
/*
35
 * Match-type implementation
36
 */
37
38
static int mcht_is_match_key
39
(struct sieve_match_context *mctx ATTR_UNUSED,
40
  const char *val, size_t val_size,
41
  const char *key, size_t key_size)
42
0
{
43
0
  if ( val_size == 0 )
44
0
    return ( key_size == 0 ? 1 : 0 );
45
46
0
  if ( mctx->comparator->def != NULL && mctx->comparator->def->compare != NULL )
47
0
    return (mctx->comparator->def->compare(mctx->comparator,
48
0
      val, val_size, key, key_size) == 0 ? 1 : 0 );
49
50
0
  return 0;
51
0
}
52