Coverage Report

Created: 2025-10-12 06:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/resiprocate/resip/stack/gen/MonthHash.cxx
Line
Count
Source
1
/* C++ code produced by gperf version 3.1 */
2
/* Command-line: gperf -C -D -E -L C++ -t --key-positions='*' --compare-strncmp -Z MonthHash MonthHash.gperf  */
3
4
#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
5
      && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
6
      && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
7
      && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
8
      && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
9
      && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
10
      && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
11
      && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
12
      && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
13
      && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
14
      && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
15
      && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
16
      && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
17
      && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
18
      && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
19
      && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
20
      && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
21
      && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
22
      && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
23
      && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
24
      && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
25
      && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
26
      && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
27
/* The character set is not based on ISO-646.  */
28
#error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
29
#endif
30
31
#line 1 "MonthHash.gperf"
32
33
#include <string.h>
34
#include <ctype.h>
35
#include "resip/stack/DateCategory.hxx"
36
37
namespace resip
38
{
39
#line 9 "MonthHash.gperf"
40
struct months { const char *name; Month type; };
41
/* maximum key range = 41, duplicates = 0 */
42
43
class MonthHash
44
{
45
private:
46
  static inline unsigned int hash (const char *str, size_t len);
47
public:
48
  static const struct months *in_word_set (const char *str, size_t len);
49
};
50
51
inline unsigned int
52
MonthHash::hash (const char *str, size_t len)
53
53
{
54
53
  static const unsigned char asso_values[] =
55
53
    {
56
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
57
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
58
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
59
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
60
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
61
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
62
53
      41, 41, 41, 41, 41, 10, 41, 41,  4, 41,
63
53
       4, 41, 41, 41,  0, 41, 41,  5, 15, 15,
64
53
      41, 41, 41, 15, 41, 41, 41, 41, 41, 41,
65
53
      41, 41, 41, 41, 41, 41, 41,  5,  0, 10,
66
53
      41, 10, 41, 15, 41, 41, 41, 41,  4, 41,
67
53
       0, 15,  5, 41,  5, 41, 10,  0, 10, 41,
68
53
      41,  0, 41, 41, 41, 41, 41, 41, 41, 41,
69
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
70
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
71
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
72
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
73
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
74
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
75
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
76
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
77
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
78
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
79
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
80
53
      41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
81
53
      41, 41, 41, 41, 41, 41
82
53
    };
83
53
  return asso_values[static_cast<unsigned char>(str[2])] + asso_values[static_cast<unsigned char>(str[1])] + asso_values[static_cast<unsigned char>(str[0])];
84
53
}
85
86
const struct months *
87
MonthHash::in_word_set (const char *str, size_t len)
88
344
{
89
344
  enum
90
344
    {
91
344
      TOTAL_KEYWORDS = 12,
92
344
      MIN_WORD_LENGTH = 3,
93
344
      MAX_WORD_LENGTH = 3,
94
344
      MIN_HASH_VALUE = 0,
95
344
      MAX_HASH_VALUE = 40
96
344
    };
97
98
344
  static const struct months wordlist[] =
99
344
    {
100
344
#line 16 "MonthHash.gperf"
101
344
      {"Jun", Jun},
102
344
#line 17 "MonthHash.gperf"
103
344
      {"Jul", Jul},
104
344
#line 11 "MonthHash.gperf"
105
344
      {"Jan", Jan},
106
344
#line 15 "MonthHash.gperf"
107
344
      {"May", May},
108
344
#line 12 "MonthHash.gperf"
109
344
      {"Feb", Feb},
110
344
#line 13 "MonthHash.gperf"
111
344
      {"Mar", Mar},
112
344
#line 14 "MonthHash.gperf"
113
344
      {"Apr", Apr},
114
344
#line 22 "MonthHash.gperf"
115
344
      {"Dec", Dec},
116
344
#line 18 "MonthHash.gperf"
117
344
      {"Aug", Aug},
118
344
#line 19 "MonthHash.gperf"
119
344
      {"Sep", Sep},
120
344
#line 20 "MonthHash.gperf"
121
344
      {"Oct", Oct},
122
344
#line 21 "MonthHash.gperf"
123
344
      {"Nov", Nov}
124
344
    };
125
126
344
  static const signed char lookup[] =
127
344
    {
128
344
       0, -1, -1, -1,  1,  2, -1, -1, -1, -1,  3, -1, -1, -1,
129
344
       4,  5, -1, -1, -1, -1,  6, -1, -1, -1,  7,  8, -1, -1,
130
344
      -1, -1,  9, -1, -1, -1, -1, 10, -1, -1, -1, -1, 11
131
344
    };
132
133
344
  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
134
53
    {
135
53
      unsigned int key = hash (str, len);
136
137
53
      if (key <= MAX_HASH_VALUE)
138
23
        {
139
23
          int index = lookup[key];
140
141
23
          if (index >= 0)
142
22
            {
143
22
              const char *s = wordlist[index].name;
144
145
22
              if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
146
1
                return &wordlist[index];
147
22
            }
148
23
        }
149
53
    }
150
343
  return 0;
151
344
}
152
#line 23 "MonthHash.gperf"
153
154
}