Skip to content

Commit 775fb31

Browse files
committed
[ci skip] Add missing patch files
1 parent 7d5b754 commit 775fb31

File tree

2 files changed

+168
-0
lines changed

2 files changed

+168
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
From 24b52ec63eb55adb1c039e58dd3e1156f01083b2 Mon Sep 17 00:00:00 2001
2+
From: Niels Dossche <[email protected]>
3+
Date: Wed, 29 Nov 2023 21:26:47 +0100
4+
Subject: [PATCH 1/2] Remove unused upper case tag static data
5+
6+
---
7+
source/lexbor/tag/res.h | 2 ++
8+
source/lexbor/tag/tag.c | 2 ++
9+
2 files changed, 4 insertions(+)
10+
11+
diff --git a/source/lexbor/tag/res.h b/source/lexbor/tag/res.h
12+
index c7190c5..4ad1f37 100644
13+
--- a/source/lexbor/tag/res.h
14+
+++ b/source/lexbor/tag/res.h
15+
@@ -224,6 +224,7 @@ static const lxb_tag_data_t lxb_tag_res_data_default[LXB_TAG__LAST_ENTRY] =
16+
{{.u.short_str = "xmp", .length = 3, .next = NULL}, LXB_TAG_XMP, 1, true}
17+
};
18+
19+
+#if 0
20+
static const lxb_tag_data_t lxb_tag_res_data_upper_default[LXB_TAG__LAST_ENTRY] =
21+
{
22+
{{.u.short_str = "#UNDEF", .length = 6, .next = NULL}, LXB_TAG__UNDEF, 1, true},
23+
@@ -423,6 +424,7 @@ static const lxb_tag_data_t lxb_tag_res_data_upper_default[LXB_TAG__LAST_ENTRY]
24+
{{.u.short_str = "WBR", .length = 3, .next = NULL}, LXB_TAG_WBR, 1, true},
25+
{{.u.short_str = "XMP", .length = 3, .next = NULL}, LXB_TAG_XMP, 1, true}
26+
};
27+
+#endif
28+
29+
static const lexbor_shs_entry_t lxb_tag_res_shs_data_default[] =
30+
{
31+
diff --git a/source/lexbor/tag/tag.c b/source/lexbor/tag/tag.c
32+
index f8fcdf0..0571957 100755
33+
--- a/source/lexbor/tag/tag.c
34+
+++ b/source/lexbor/tag/tag.c
35+
@@ -92,6 +92,7 @@ lxb_tag_data_by_name(lexbor_hash_t *hash, const lxb_char_t *name, size_t len)
36+
lexbor_hash_search_lower, name, len);
37+
}
38+
39+
+#if 0
40+
const lxb_tag_data_t *
41+
lxb_tag_data_by_name_upper(lexbor_hash_t *hash,
42+
const lxb_char_t *name, size_t len)
43+
@@ -114,6 +115,7 @@ lxb_tag_data_by_name_upper(lexbor_hash_t *hash,
44+
return (const lxb_tag_data_t *) lexbor_hash_search(hash,
45+
lexbor_hash_search_upper, name, len);
46+
}
47+
+#endif
48+
49+
/*
50+
* No inline functions for ABI.
51+
--
52+
2.43.0
53+
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
From 7fde66f32dcfbdc5df97fbffe411c0d7fd60fa50 Mon Sep 17 00:00:00 2001
2+
From: Niels Dossche <[email protected]>
3+
Date: Wed, 29 Nov 2023 21:29:31 +0100
4+
Subject: [PATCH 2/2] Shrink size of static binary search tree
5+
6+
This also makes it more efficient on the data cache.
7+
---
8+
source/lexbor/core/sbst.h | 10 +++++-----
9+
source/lexbor/html/tokenizer/state.c | 2 +-
10+
utils/lexbor/html/tmp/tokenizer_res.h | 2 +-
11+
utils/lexbor/html/tokenizer_entities_bst.py | 8 ++++----
12+
utils/lexbor/lexbor/LXB.py | 2 +-
13+
5 files changed, 12 insertions(+), 12 deletions(-)
14+
15+
diff --git a/source/lexbor/core/sbst.h b/source/lexbor/core/sbst.h
16+
index b0fbc54..40e0e91 100755
17+
--- a/source/lexbor/core/sbst.h
18+
+++ b/source/lexbor/core/sbst.h
19+
@@ -19,12 +19,12 @@ extern "C" {
20+
typedef struct {
21+
lxb_char_t key;
22+
23+
- void *value;
24+
- size_t value_len;
25+
+ lxb_char_t value[6];
26+
+ unsigned char value_len;
27+
28+
- size_t left;
29+
- size_t right;
30+
- size_t next;
31+
+ unsigned short left;
32+
+ unsigned short right;
33+
+ unsigned short next;
34+
}
35+
lexbor_sbst_entry_static_t;
36+
37+
diff --git a/source/lexbor/html/tokenizer/state.c b/source/lexbor/html/tokenizer/state.c
38+
index 70ca391..2f3414f 100755
39+
--- a/source/lexbor/html/tokenizer/state.c
40+
+++ b/source/lexbor/html/tokenizer/state.c
41+
@@ -1815,7 +1815,7 @@ lxb_html_tokenizer_state_char_ref_named(lxb_html_tokenizer_t *tkz,
42+
goto done;
43+
}
44+
45+
- if (entry->value != NULL) {
46+
+ if (entry->value[0] != 0) {
47+
tkz->entity_end = (tkz->pos + (data - begin)) - tkz->start;
48+
tkz->entity_match = entry;
49+
}
50+
diff --git a/utils/lexbor/html/tmp/tokenizer_res.h b/utils/lexbor/html/tmp/tokenizer_res.h
51+
index b3701d5..73ab66e 100755
52+
--- a/utils/lexbor/html/tmp/tokenizer_res.h
53+
+++ b/utils/lexbor/html/tmp/tokenizer_res.h
54+
@@ -6,7 +6,7 @@
55+
56+
/*
57+
* Caution!!! Important!!!
58+
- * This file generated by the script
59+
+ * This file is generated by the script
60+
* "utils/lexbor/html/tokenizer_entities_bst.py"!
61+
* Do not change this file!
62+
*/
63+
diff --git a/utils/lexbor/html/tokenizer_entities_bst.py b/utils/lexbor/html/tokenizer_entities_bst.py
64+
index ee7dcb4..7cd1335 100755
65+
--- a/utils/lexbor/html/tokenizer_entities_bst.py
66+
+++ b/utils/lexbor/html/tokenizer_entities_bst.py
67+
@@ -1,6 +1,6 @@
68+
69+
import json
70+
-import sys, re, os
71+
+import sys, os
72+
73+
# Find and append run script run dir to module search path
74+
ABS_PATH = os.path.dirname(os.path.abspath(__file__))
75+
@@ -62,7 +62,7 @@ def entities_bst_create_layer(name, entry, index):
76+
77+
def entities_bst_create(index):
78+
bst = {}
79+
- bst[0] = ["\0", 0, 0, 0, "NULL"]
80+
+ bst[0] = ["\0", 0, 0, 0, "{0}"]
81+
82+
begin = 1
83+
idx = end = entities_bst_create_tree(index, bst, begin)
84+
@@ -114,7 +114,7 @@ def entities_bst_create_tree(index, bst, idx):
85+
assert len(index[ split[0] ]['values']) < 2, 'Double values'
86+
87+
if len(index[ split[0] ]['values']) == 0:
88+
- value = "NULL"
89+
+ value = "{0}"
90+
else:
91+
value = '"{}"'.format(toHex(index[ split[0] ]['values'][0]['characters']))
92+
93+
@@ -210,5 +210,5 @@ def entities_bst_print(bst):
94+
95+
if __name__ == "__main__":
96+
entities_bst("tmp/tokenizer_res.h",
97+
- "../../../source/lexbor/html/tokenizer_res.h",
98+
+ "../../../source/lexbor/html/tokenizer/res.h",
99+
"data/entities.json");
100+
diff --git a/utils/lexbor/lexbor/LXB.py b/utils/lexbor/lexbor/LXB.py
101+
index 3e75812..b068ea3 100755
102+
--- a/utils/lexbor/lexbor/LXB.py
103+
+++ b/utils/lexbor/lexbor/LXB.py
104+
@@ -27,7 +27,7 @@ class Temp:
105+
106+
for line in fh:
107+
for name in self.patterns:
108+
- line = re.sub(name, '\n'.join(self.patterns[name]), line)
109+
+ line = line.replace(name, '\n'.join(self.patterns[name]))
110+
self.buffer.append(line)
111+
fh.close()
112+
113+
--
114+
2.43.0
115+

0 commit comments

Comments
 (0)