Coverage Report

Created: 2025-09-04 07:09

/src/tarantool/src/box/coll_id_def.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2010-2017, Tarantool AUTHORS, please see AUTHORS file.
3
 *
4
 * Redistribution and use in source and binary forms, with or
5
 * without modification, are permitted provided that the following
6
 * conditions are met:
7
 *
8
 * 1. Redistributions of source code must retain the above
9
 *    copyright notice, this list of conditions and the
10
 *    following disclaimer.
11
 *
12
 * 2. Redistributions in binary form must reproduce the above
13
 *    copyright notice, this list of conditions and the following
14
 *    disclaimer in the documentation and/or other materials
15
 *    provided with the distribution.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY AUTHORS ``AS IS'' AND
18
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21
 * AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
25
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28
 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29
 * SUCH DAMAGE.
30
 */
31
32
#include "coll_id_def.h"
33
34
static int64_t
35
icu_on_off_from_str(const char *str, uint32_t len)
36
0
{
37
0
  return strnindex(coll_icu_on_off_strs + 1, str, len,
38
0
       coll_icu_on_off_MAX - 1) + 1;
39
0
}
40
41
static int64_t
42
icu_alternate_handling_from_str(const char *str, uint32_t len)
43
0
{
44
0
  return strnindex(coll_icu_alternate_handling_strs + 1, str, len,
45
0
       coll_icu_alternate_handling_MAX - 1) + 1;
46
0
}
47
48
static int64_t
49
icu_case_first_from_str(const char *str, uint32_t len)
50
0
{
51
0
  return strnindex(coll_icu_case_first_strs + 1, str, len,
52
0
       coll_icu_case_first_MAX - 1) + 1;
53
0
}
54
55
static int64_t
56
icu_strength_from_str(const char *str, uint32_t len)
57
0
{
58
0
  return strnindex(coll_icu_strength_strs + 1, str, len,
59
0
       coll_icu_strength_MAX - 1) + 1;
60
0
}
61
62
const struct opt_def coll_icu_opts_reg[] = {
63
  OPT_DEF_ENUM("french_collation", coll_icu_on_off, struct coll_icu_def,
64
         french_collation, icu_on_off_from_str),
65
  OPT_DEF_ENUM("alternate_handling", coll_icu_alternate_handling, struct coll_icu_def,
66
         alternate_handling, icu_alternate_handling_from_str),
67
  OPT_DEF_ENUM("case_first", coll_icu_case_first, struct coll_icu_def,
68
         case_first, icu_case_first_from_str),
69
  OPT_DEF_ENUM("case_level", coll_icu_on_off, struct coll_icu_def,
70
         case_level, icu_on_off_from_str),
71
  OPT_DEF_ENUM("normalization_mode", coll_icu_on_off, struct coll_icu_def,
72
         normalization_mode, icu_on_off_from_str),
73
  OPT_DEF_ENUM("strength", coll_icu_strength, struct coll_icu_def,
74
         strength, icu_strength_from_str),
75
  OPT_DEF_ENUM("numeric_collation", coll_icu_on_off, struct coll_icu_def,
76
         numeric_collation, icu_on_off_from_str),
77
  OPT_END,
78
};