OLD | NEW |
1 /* C++ code produced by gperf version 3.0.3 */ | 1 /* C++ code produced by gperf version 3.0.3 */ |
2 /* Command-line: gperf -a -L C++ -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_
Test2 -P -K name_offset -Q stringpool2 -D -T effective_tld_names_unittest2.gperf
*/ | 2 /* Command-line: gperf -a -L C++ -C -c -o -t -k '*' -NFindDomain |
| 3 * -ZPerfect_Hash_Test2 -P -K name_offset -Q stringpool2 -D -T |
| 4 * effective_tld_names_unittest2.gperf */ |
3 | 5 |
4 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 6 #if !( \ |
5 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | 7 (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) && ('%' == 37) && \ |
6 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | 8 ('&' == 38) && ('\'' == 39) && ('(' == 40) && (')' == 41) && \ |
7 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | 9 ('*' == 42) && ('+' == 43) && (',' == 44) && ('-' == 45) && ('.' == 46) && \ |
8 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | 10 ('/' == 47) && ('0' == 48) && ('1' == 49) && ('2' == 50) && ('3' == 51) && \ |
9 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | 11 ('4' == 52) && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) && \ |
10 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | 12 ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) && ('=' == 61) && \ |
11 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | 13 ('>' == 62) && ('?' == 63) && ('A' == 65) && ('B' == 66) && ('C' == 67) && \ |
12 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | 14 ('D' == 68) && ('E' == 69) && ('F' == 70) && ('G' == 71) && ('H' == 72) && \ |
13 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | 15 ('I' == 73) && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) && \ |
14 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | 16 ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) && ('R' == 82) && \ |
15 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | 17 ('S' == 83) && ('T' == 84) && ('U' == 85) && ('V' == 86) && ('W' == 87) && \ |
16 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | 18 ('X' == 88) && ('Y' == 89) && ('Z' == 90) && ('[' == 91) && \ |
17 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | 19 ('\\' == 92) && (']' == 93) && ('^' == 94) && ('_' == 95) && \ |
18 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | 20 ('a' == 97) && ('b' == 98) && ('c' == 99) && ('d' == 100) && \ |
19 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | 21 ('e' == 101) && ('f' == 102) && ('g' == 103) && ('h' == 104) && \ |
20 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | 22 ('i' == 105) && ('j' == 106) && ('k' == 107) && ('l' == 108) && \ |
21 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | 23 ('m' == 109) && ('n' == 110) && ('o' == 111) && ('p' == 112) && \ |
22 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | 24 ('q' == 113) && ('r' == 114) && ('s' == 115) && ('t' == 116) && \ |
23 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | 25 ('u' == 117) && ('v' == 118) && ('w' == 119) && ('x' == 120) && \ |
24 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | 26 ('y' == 121) && ('z' == 122) && ('{' == 123) && ('|' == 124) && \ |
25 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | 27 ('}' == 125) && ('~' == 126)) |
26 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | |
27 /* The character set is not based on ISO-646. */ | 28 /* The character set is not based on ISO-646. */ |
28 #error "gperf generated tables don't work with this execution character set. Ple
ase report a bug to <bug-gnu-gperf@gnu.org>." | 29 #error \ |
| 30 "gperf generated tables don't work with this execution character set. Please
report a bug to <bug-gnu-gperf@gnu.org>." |
29 #endif | 31 #endif |
30 | 32 |
31 #line 1 "effective_tld_names_unittest2.gperf" | 33 #line 1 "effective_tld_names_unittest2.gperf" |
32 | 34 |
33 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 35 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
34 // Use of this source code is governed by a BSD-style license that can be | 36 // Use of this source code is governed by a BSD-style license that can be |
35 // found in the LICENSE file. | 37 // found in the LICENSE file. |
36 // Test file used by registry_controlled_domain_unittest. | 38 // Test file used by registry_controlled_domain_unittest. |
37 // We edit this file manually, then run | 39 // We edit this file manually, then run |
38 // gperf -a -L "C++" -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_Test2 -P -K
name_offset -Q stringpool2 -D -T effective_tld_names_unittest2.gperf > effectiv
e_tld_names_unittest2.cc | 40 // gperf -a -L "C++" -C -c -o -t -k '*' -NFindDomain -ZPerfect_Hash_Test2 -P -K |
| 41 // name_offset -Q stringpool2 -D -T effective_tld_names_unittest2.gperf > |
| 42 // effective_tld_names_unittest2.cc |
39 // to generate the perfect hashmap. | 43 // to generate the perfect hashmap. |
40 | 44 |
41 #define TOTAL_KEYWORDS 2 | 45 #define TOTAL_KEYWORDS 2 |
42 #define MIN_WORD_LENGTH 2 | 46 #define MIN_WORD_LENGTH 2 |
43 #define MAX_WORD_LENGTH 6 | 47 #define MAX_WORD_LENGTH 6 |
44 #define MIN_HASH_VALUE 2 | 48 #define MIN_HASH_VALUE 2 |
45 #define MAX_HASH_VALUE 6 | 49 #define MAX_HASH_VALUE 6 |
46 /* maximum key range = 5, duplicates = 0 */ | 50 /* maximum key range = 5, duplicates = 0 */ |
47 | 51 |
48 class Perfect_Hash_Test2 | 52 class Perfect_Hash_Test2 { |
49 { | 53 private: |
50 private: | 54 static inline unsigned int hash(const char* str, unsigned int len); |
51 static inline unsigned int hash (const char *str, unsigned int len); | 55 |
52 public: | 56 public: |
53 static const struct DomainRule *FindDomain (const char *str, unsigned int len)
; | 57 static const struct DomainRule* FindDomain(const char* str, unsigned int len); |
54 }; | 58 }; |
55 | 59 |
56 inline unsigned int | 60 inline unsigned int Perfect_Hash_Test2::hash(register const char* str, |
57 Perfect_Hash_Test2::hash (register const char *str, register unsigned int len) | 61 register unsigned int len) { |
58 { | 62 static const unsigned char asso_values[] = { |
59 static const unsigned char asso_values[] = | 63 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
60 { | 64 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, |
61 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 65 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
62 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 66 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, |
63 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 67 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 0, 7, 0, 7, 7, 7, 7, 7, |
64 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | 68 7, 7, 7, 7, 7, 7, 7, 7, 7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7, 7, 7, 7, 7, | |
84 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | |
85 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, | |
86 7, 7, 7, 7, 7, 7 | |
87 }; | |
88 register int hval = len; | 74 register int hval = len; |
89 | 75 |
90 switch (hval) | 76 switch (hval) { |
91 { | 77 default: |
92 default: | 78 hval += asso_values[(unsigned char)str[5]]; |
93 hval += asso_values[(unsigned char)str[5]]; | 79 /*FALLTHROUGH*/ |
94 /*FALLTHROUGH*/ | 80 case 5: |
95 case 5: | 81 hval += asso_values[(unsigned char)str[4]]; |
96 hval += asso_values[(unsigned char)str[4]]; | 82 /*FALLTHROUGH*/ |
97 /*FALLTHROUGH*/ | 83 case 4: |
98 case 4: | 84 hval += asso_values[(unsigned char)str[3]]; |
99 hval += asso_values[(unsigned char)str[3]]; | 85 /*FALLTHROUGH*/ |
100 /*FALLTHROUGH*/ | 86 case 3: |
101 case 3: | 87 hval += asso_values[(unsigned char)str[2]]; |
102 hval += asso_values[(unsigned char)str[2]]; | 88 /*FALLTHROUGH*/ |
103 /*FALLTHROUGH*/ | 89 case 2: |
104 case 2: | 90 hval += asso_values[(unsigned char)str[1]]; |
105 hval += asso_values[(unsigned char)str[1]]; | 91 /*FALLTHROUGH*/ |
106 /*FALLTHROUGH*/ | 92 case 1: |
107 case 1: | 93 hval += asso_values[(unsigned char)str[0]]; |
108 hval += asso_values[(unsigned char)str[0]]; | 94 break; |
109 break; | 95 } |
110 } | |
111 return hval; | 96 return hval; |
112 } | 97 } |
113 | 98 |
114 struct stringpool2_t | 99 struct stringpool2_t { |
115 { | 100 char stringpool2_str0[sizeof("jp")]; |
116 char stringpool2_str0[sizeof("jp")]; | 101 char stringpool2_str1[sizeof("bar.jp")]; |
117 char stringpool2_str1[sizeof("bar.jp")]; | 102 }; |
118 }; | 103 static const struct stringpool2_t stringpool2_contents = {"jp", "bar.jp"}; |
119 static const struct stringpool2_t stringpool2_contents = | 104 #define stringpool2 ((const char*)&stringpool2_contents) |
120 { | 105 const struct DomainRule* Perfect_Hash_Test2::FindDomain( |
121 "jp", | 106 register const char* str, |
122 "bar.jp" | 107 register unsigned int len) { |
123 }; | 108 static const struct DomainRule wordlist[] = { |
124 #define stringpool2 ((const char *) &stringpool2_contents) | |
125 const struct DomainRule * | |
126 Perfect_Hash_Test2::FindDomain (register const char *str, register unsigned int
len) | |
127 { | |
128 static const struct DomainRule wordlist[] = | |
129 { | |
130 #line 15 "effective_tld_names_unittest2.gperf" | 109 #line 15 "effective_tld_names_unittest2.gperf" |
131 {(int)(long)&((struct stringpool2_t *)0)->stringpool2_str0, 0}, | 110 {(int)(long)&((struct stringpool2_t*)0)->stringpool2_str0, 0}, |
132 #line 16 "effective_tld_names_unittest2.gperf" | 111 #line 16 "effective_tld_names_unittest2.gperf" |
133 {(int)(long)&((struct stringpool2_t *)0)->stringpool2_str1, 0} | 112 {(int)(long)&((struct stringpool2_t*)0)->stringpool2_str1, 0}}; |
134 }; | |
135 | 113 |
136 static const signed char lookup[] = | 114 static const signed char lookup[] = {-1, -1, 0, -1, -1, -1, 1}; |
137 { | |
138 -1, -1, 0, -1, -1, -1, 1 | |
139 }; | |
140 | 115 |
141 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | 116 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) { |
142 { | 117 register int key = hash(str, len); |
143 register int key = hash (str, len); | |
144 | 118 |
145 if (key <= MAX_HASH_VALUE && key >= 0) | 119 if (key <= MAX_HASH_VALUE && key >= 0) { |
146 { | 120 register int index = lookup[key]; |
147 register int index = lookup[key]; | |
148 | 121 |
149 if (index >= 0) | 122 if (index >= 0) { |
150 { | 123 register const char* s = wordlist[index].name_offset + stringpool2; |
151 register const char *s = wordlist[index].name_offset + stringpool2
; | |
152 | 124 |
153 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] ==
'\0') | 125 if (*str == *s && !strncmp(str + 1, s + 1, len - 1) && s[len] == '\0') |
154 return &wordlist[index]; | 126 return &wordlist[index]; |
155 } | 127 } |
156 } | |
157 } | 128 } |
| 129 } |
158 return 0; | 130 return 0; |
159 } | 131 } |
160 #line 17 "effective_tld_names_unittest2.gperf" | 132 #line 17 "effective_tld_names_unittest2.gperf" |
161 | |
OLD | NEW |