summaryrefslogtreecommitdiffstats
path: root/gentokenlookup.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-11 16:46:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-11 16:46:30 +0000
commit8e1187a02b785e56d798660a9a292ca385e1f6aa (patch)
treeb035593aa2ae37c25aeb28b537a3223c52532ab1 /gentokenlookup.py
parentAdding upstream version 1.61.0. (diff)
downloadnghttp2-upstream.tar.xz
nghttp2-upstream.zip
Adding upstream version 1.62.1.upstream/1.62.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gentokenlookup.py')
-rw-r--r--gentokenlookup.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/gentokenlookup.py b/gentokenlookup.py
index 8277858..f23426a 100644
--- a/gentokenlookup.py
+++ b/gentokenlookup.py
@@ -33,10 +33,10 @@ enum {''')
{}MAXIDX,
}};'''.format(prefix))
-def gen_index_header(tokens, prefix, value_type, comp_fun, return_type, fail_value):
+def gen_index_header(tokens, prefix, comp_fun, return_type, fail_value):
print('''\
-{} lookup_token(const {} *name, size_t namelen) {{
- switch (namelen) {{'''.format(return_type, value_type))
+{} lookup_token(const StringRef &name) {{
+ switch (name.size()) {{'''.format(return_type))
b = build_header(tokens)
for size in sorted(b.keys()):
ents = b[size]
@@ -50,7 +50,7 @@ def gen_index_header(tokens, prefix, value_type, comp_fun, return_type, fail_val
case '{}':'''.format(c))
for k in headers:
print('''\
- if ({}("{}", name, {})) {{
+ if ({}("{}"_sr, name, {})) {{
return {};
}}'''.format(comp_fun, k[:-1], size - 1, to_enum_hd(k, prefix)))
print('''\
@@ -63,7 +63,7 @@ def gen_index_header(tokens, prefix, value_type, comp_fun, return_type, fail_val
return {};
}}'''.format(fail_value))
-def gentokenlookup(tokens, prefix, value_type='uint8_t', comp_fun='util::streq_l', return_type='int', fail_value='-1'):
+def gentokenlookup(tokens, prefix, comp_fun='util::streq', return_type='int', fail_value='-1'):
gen_enum(tokens, prefix)
print()
- gen_index_header(tokens, prefix, value_type, comp_fun, return_type, fail_value)
+ gen_index_header(tokens, prefix, comp_fun, return_type, fail_value)