Coverage Report

Created: 2025-12-31 06:34

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/resiprocate/resip/stack/gen/MethodHash.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 MethodHash MethodHash.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 "MethodHash.gperf"
32
33
#include <string.h>
34
#include <ctype.h>
35
#include "resip/stack/MethodTypes.hxx"
36
37
namespace resip
38
{
39
#line 9 "MethodHash.gperf"
40
struct methods { const char *name; MethodTypes type; };
41
/* maximum key range = 31, duplicates = 0 */
42
43
class MethodHash
44
{
45
private:
46
  static inline unsigned int hash (const char *str, size_t len);
47
public:
48
  static const struct methods *in_word_set (const char *str, size_t len);
49
};
50
51
inline unsigned int
52
MethodHash::hash (const char *str, size_t len)
53
3.40k
{
54
3.40k
  static const unsigned char asso_values[] =
55
3.40k
    {
56
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
57
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
58
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
59
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
60
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
61
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
62
3.40k
      35, 35, 35, 35, 35,  5, 10,  5,  5,  0,
63
3.40k
       0, 15,  0,  0, 35,  0,  0,  0,  0,  0,
64
3.40k
       0, 35,  0,  0,  0,  0,  0, 35, 35,  5,
65
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
66
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
67
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
68
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
69
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
70
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
71
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
72
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
73
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
74
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
75
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
76
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
77
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
78
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
79
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
80
3.40k
      35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
81
3.40k
      35, 35, 35, 35, 35, 35
82
3.40k
    };
83
3.40k
  unsigned int hval = len;
84
85
3.40k
  switch (hval)
86
3.40k
    {
87
116
      default:
88
116
        hval += asso_values[static_cast<unsigned char>(str[8])];
89
      /*FALLTHROUGH*/
90
419
      case 8:
91
419
        hval += asso_values[static_cast<unsigned char>(str[7])];
92
      /*FALLTHROUGH*/
93
570
      case 7:
94
570
        hval += asso_values[static_cast<unsigned char>(str[6])];
95
      /*FALLTHROUGH*/
96
782
      case 6:
97
782
        hval += asso_values[static_cast<unsigned char>(str[5])];
98
      /*FALLTHROUGH*/
99
957
      case 5:
100
957
        hval += asso_values[static_cast<unsigned char>(str[4])];
101
      /*FALLTHROUGH*/
102
1.25k
      case 4:
103
1.25k
        hval += asso_values[static_cast<unsigned char>(str[3])];
104
      /*FALLTHROUGH*/
105
3.40k
      case 3:
106
3.40k
        hval += asso_values[static_cast<unsigned char>(str[2])];
107
      /*FALLTHROUGH*/
108
3.40k
      case 2:
109
3.40k
        hval += asso_values[static_cast<unsigned char>(str[1])];
110
      /*FALLTHROUGH*/
111
3.40k
      case 1:
112
3.40k
        hval += asso_values[static_cast<unsigned char>(str[0])];
113
3.40k
        break;
114
3.40k
    }
115
3.40k
  return hval;
116
3.40k
}
117
118
const struct methods *
119
MethodHash::in_word_set (const char *str, size_t len)
120
6.37k
{
121
6.37k
  enum
122
6.37k
    {
123
6.37k
      TOTAL_KEYWORDS = 16,
124
6.37k
      MIN_WORD_LENGTH = 3,
125
6.37k
      MAX_WORD_LENGTH = 9,
126
6.37k
      MIN_HASH_VALUE = 4,
127
6.37k
      MAX_HASH_VALUE = 34
128
6.37k
    };
129
130
6.37k
  static const struct methods wordlist[] =
131
6.37k
    {
132
6.37k
#line 24 "MethodHash.gperf"
133
6.37k
      {"INFO", INFO},
134
6.37k
#line 19 "MethodHash.gperf"
135
6.37k
      {"REFER", REFER},
136
6.37k
#line 14 "MethodHash.gperf"
137
6.37k
      {"INVITE", INVITE},
138
6.37k
#line 16 "MethodHash.gperf"
139
6.37k
      {"OPTIONS", OPTIONS},
140
6.37k
#line 22 "MethodHash.gperf"
141
6.37k
      {"RESPONSE", RESPONSE},
142
6.37k
#line 15 "MethodHash.gperf"
143
6.37k
      {"NOTIFY", NOTIFY},
144
6.37k
#line 25 "MethodHash.gperf"
145
6.37k
      {"SERVICE", SERVICE},
146
6.37k
#line 11 "MethodHash.gperf"
147
6.37k
      {"ACK", ACK},
148
6.37k
#line 17 "MethodHash.gperf"
149
6.37k
      {"PRACK", PRACK},
150
6.37k
#line 26 "MethodHash.gperf"
151
6.37k
      {"UPDATE", UPDATE},
152
6.37k
#line 18 "MethodHash.gperf"
153
6.37k
      {"PUBLISH", PUBLISH},
154
6.37k
#line 12 "MethodHash.gperf"
155
6.37k
      {"BYE", BYE},
156
6.37k
#line 13 "MethodHash.gperf"
157
6.37k
      {"CANCEL", CANCEL},
158
6.37k
#line 20 "MethodHash.gperf"
159
6.37k
      {"REGISTER", REGISTER},
160
6.37k
#line 23 "MethodHash.gperf"
161
6.37k
      {"MESSAGE", MESSAGE},
162
6.37k
#line 21 "MethodHash.gperf"
163
6.37k
      {"SUBSCRIBE", SUBSCRIBE}
164
6.37k
    };
165
166
6.37k
  static const signed char lookup[] =
167
6.37k
    {
168
6.37k
      -1, -1, -1, -1,  0,  1,  2,  3,  4, -1, -1,  5,  6,  7,
169
6.37k
      -1,  8,  9, 10, 11, -1, -1, 12, -1, 13, -1, -1, -1, 14,
170
6.37k
      -1, -1, -1, -1, -1, -1, 15
171
6.37k
    };
172
173
6.37k
  if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
174
3.40k
    {
175
3.40k
      unsigned int key = hash (str, len);
176
177
3.40k
      if (key <= MAX_HASH_VALUE)
178
59
        {
179
59
          int index = lookup[key];
180
181
59
          if (index >= 0)
182
55
            {
183
55
              const char *s = wordlist[index].name;
184
185
55
              if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
186
1
                return &wordlist[index];
187
55
            }
188
59
        }
189
3.40k
    }
190
6.37k
  return 0;
191
6.37k
}
192
#line 27 "MethodHash.gperf"
193
194
}