Debian Codegraph @

lib/pat.c

raw symbols SCIP
1 /*
2 Copyright (C) 2009-2018 Brazil
3 Copyright (C) 2018-2026 Sutou Kouhei <[email protected]>
4 Copyright (C) 2025 Horimoto Yasuhiro <[email protected]>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #include "grn.h"cxx . . $ `<file>/lib/grn.h`/
22 #include "grn_ctx_impl.h"cxx . . $ `<file>/lib/grn_ctx_impl.h`/
23 #include "grn_pat.h"cxx . . $ `<file>/lib/grn_pat.h`/
24 #include "grn_obj.h"cxx . . $ `<file>/lib/grn_obj.h`/
25 #include "grn_output.h"cxx . . $ `<file>/lib/grn_output.h`/
26 #include "grn_util.h"cxx . . $ `<file>/lib/grn_util.h`/
27 #include "grn_normalizer.h"cxx . . $ `<file>/lib/grn_normalizer.h`/
28 #include "grn_wal.h"cxx . . $ `<file>/lib/grn_wal.h`/
29 #include "grn_portability.h"cxx . . $ `<file>/lib/grn_portability.h`/
30
31 #include <limits.h>
32 #include <math.h>
33 #include <string.h>
34
35 #define GRN_PAT_DELETEDcxx . . $ `lib/pat.c:35:9`! (GRN_ID_MAX + 1)
36
37 #define GRN_PAT_SEGMENT_SIZEcxx . . $ `lib/pat.c:37:9`! 0x400000
38 #define W_OF_KEY_IN_A_SEGMENTcxx . . $ `lib/pat.c:38:9`! 22
39 #define W_OF_PAT_IN_A_SEGMENTcxx . . $ `lib/pat.c:39:9`! 18
40 #define W_OF_SIS_IN_A_SEGMENTcxx . . $ `lib/pat.c:40:9`! 19
41 #define KEY_MASK_IN_A_SEGMENTcxx . . $ `lib/pat.c:41:9`! 0x3fffff
42 #define PAT_MASK_IN_A_SEGMENTcxx . . $ `lib/pat.c:42:9`! 0x3ffff
43 #define SIS_MASK_IN_A_SEGMENTcxx . . $ `lib/pat.c:43:9`! 0x7ffff
44 #define SEG_NOT_ASSIGNEDcxx . . $ `lib/pat.c:44:9`! 0xffff
45 #define GRN_PAT_MAX_SEGMENTcxx . . $ `lib/pat.c:45:9`! 0x1000
46 /* If we use GRN_PAT_MAX_N_SEGMENTS, max total key size is 4GiB:
47 GRN_PAT_SEGMENT_SIZE * 0x400 = 4GiB */
48 #define GRN_PAT_MAX_N_SEGMENTScxx . . $ `lib/pat.c:48:9`! 0x400
49 /* If we use GRN_PAT_MAX_N_SEGMENTS_LARGE, max total key size is 1TiB:
50 GRN_PAT_SEGMENT_SIZE * 0x40000 = 1TiB */
51 #define GRN_PAT_MAX_N_SEGMENTS_LARGEcxx . . $ `lib/pat.c:51:9`! 0x40000
52 #define GRN_PAT_MAX_TOTAL_KEY_SIZEcxx . . $ `lib/pat.c:52:9`! (UINT32_MAXcxx . . $ `<external>/3415975807581488833/stdint.h:124:10`! - 1)
53 #define GRN_PAT_MAX_TOTAL_KEY_SIZE_LARGEcxx . . $ `lib/pat.c:53:9`! \
54 ((uint64_t)GRN_PAT_SEGMENT_SIZEcxx . . $ `lib/pat.c:37:9`! * (uint64_t)GRN_PAT_MAX_N_SEGMENTS_LARGEcxx . . $ `lib/pat.c:51:9`! - \
55 1) // 1TiB - 1 (-1 is initial curr_key value)
56 #define GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`! (GRN_PAT_NDELINFOScxx . . $ `lib/grn_pat.h:52:9`! - 1)
57
58 #define GRN_PAT_BIN_KEYcxx . . $ `lib/pat.c:58:9`! 0x70000
59
60 #define GRN_PAT_SEGMENT_SIZE_IN_BITcxx . . $ `lib/pat.c:60:9`! 22 /* log2(GRN_PAT_SEGMENT_SIZE) == 22 */
61
62 typedef enumcxx . . $ $anonymous_type_d195c43ed9cfff57_0# {
63 DIRECTION_LEFTcxx . . $ DIRECTION_LEFT. = 0,
64 DIRECTION_RIGHTcxx . . $ DIRECTION_RIGHT. = 1,
65 } pat_node_directioncxx . . $ pat_node_direction#;
66
67 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_1# {
68 /*
69 lr[0]: the left node.
70 lr[1]: the right node.
71
72 The left node has 0 at the nth bit at the nth byte.
73 The right node has 1 at the nth bit at the nth byte.
74 'check' value indicate 'at the nth bit at the nth byte'.
75
76 The both available nodes has larger check value rather
77 than the current node.
78
79 The first node (PAT_AT(pat, GRN_ID_NIL, node)) has only
80 the right node and the node is the start point.
81 */
82 grn_idcxx . . $ grn_id# lrcxx . . $ $anonymous_type_d195c43ed9cfff57_1#lr.[2];
83 /*
84 pat_node_is_key_immediate(pat, node) == false: key bytes offset in memory
85 map.
86 pat_node_is_key_immediate(pat, node) == true: the key bytes.
87 */
88 uint32_tcxx . . $ uint32_t# keycxx . . $ $anonymous_type_d195c43ed9cfff57_1#key.;
89 /*
90 nth byte: 12, nth bit: 3, terminated: 1
91
92 nth byte is different in key bytes: (check >> 4): max == 4095
93 the left most byte is the 0th byte and the right most byte is the 11th byte.
94
95 nth bit is different in nth byte: ((check >> 1) & 0b111)
96 the left most bit is the 0th bit and the right most bit is the 7th bit.
97
98 terminated: (check & 0b1)
99 terminated == 1: key is terminated.
100 */
101 uint16_tcxx . . $ uint16_t# checkcxx . . $ $anonymous_type_d195c43ed9cfff57_1#check.;
102 /* length: 13, immediate: 1, deleting: 1 */
103 uint16_tcxx . . $ uint16_t# bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits.;
104 } pat_nodecxx . . $ pat_node#;
105
106 /*
107 This struct is almost the same as `pat_node`.
108 We only use this struct when we specify `KEY_LARGE`
109 This struct is different from pat_node only in that the size of key.
110 The size of pat_node.key is uint32_t.
111 The size of pat_node_large.key is uint64_t.
112 */
113 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_2# {
114 grn_idcxx . . $ grn_id# lrcxx . . $ $anonymous_type_d195c43ed9cfff57_2#lr.[2];
115 uint64_tcxx . . $ uint64_t# keycxx . . $ $anonymous_type_d195c43ed9cfff57_2#key.;
116 uint16_tcxx . . $ uint16_t# checkcxx . . $ $anonymous_type_d195c43ed9cfff57_2#check.;
117 uint16_tcxx . . $ uint16_t# bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits.;
118 } pat_node_largecxx . . $ pat_node_large#;
119
120 typedef unioncxx . . $ $anonymous_type_d195c43ed9cfff57_3# {
121 pat_nodecxx . . $ pat_node# nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node.;
122 pat_node_largecxx . . $ pat_node_large# node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large.;
123 } pat_node_commoncxx . . $ pat_node_common#;
124
125 #define PAT_DELETINGcxx . . $ `lib/pat.c:125:9`! (1 << 1)
126 #define PAT_IMMEDIATEcxx . . $ `lib/pat.c:126:9`! (1 << 2)
127
128 static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
129 pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(grn_patcxx . . $ grn_pat# *pat)
130 {
131 return (pat->headercxx . . $ _grn_pat#header.->flagscxx . . $ grn_pat_header#flags. & GRN_OBJ_KEY_LARGEcxx . . $ `include/groonga/groonga.h:831:9`!) == GRN_OBJ_KEY_LARGEcxx . . $ `include/groonga/groonga.h:831:9`!;
132 }
133
134 static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
135 pat_key_is_embeddablecxx . . $ pat_key_is_embeddable(fdc76bbf99fb1c5e).(grn_patcxx . . $ grn_pat# *pat, uint32_tcxx . . $ uint32_t# key_size)
136 {
137 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
138 return key_size <= sizeof(uint64_tcxx . . $ uint64_t#);
139 } else {
140 return key_size <= sizeof(uint32_tcxx . . $ uint32_t#);
141 }
142 }
143
144 static inline uint32_tcxx . . $ uint32_t#
145 pat_key_storage_sizecxx . . $ pat_key_storage_size(19404736c0f9c973).(grn_patcxx . . $ grn_pat# *pat, uint32_tcxx . . $ uint32_t# key_size)
146 {
147 return pat_key_is_embeddablecxx . . $ pat_key_is_embeddable(fdc76bbf99fb1c5e).(pat, key_size) ? 0 : key_size;
148 }
149
150 static inline grn_idcxx . . $ grn_id#
151 pat_node_get_childcxx . . $ pat_node_get_child(eb8bfb37bfad0e1c).(grn_patcxx . . $ grn_pat# *pat,
152 pat_node_commoncxx . . $ pat_node_common# *node,
153 pat_node_directioncxx . . $ pat_node_direction# direction)
154 {
155 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
156 return node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..lrcxx . . $ $anonymous_type_d195c43ed9cfff57_2#lr.[direction];
157 } else {
158 return node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..lrcxx . . $ $anonymous_type_d195c43ed9cfff57_1#lr.[direction];
159 }
160 }
161 static inline grn_idcxx . . $ grn_id#
162 pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
163 {
164 return pat_node_get_childcxx . . $ pat_node_get_child(eb8bfb37bfad0e1c).(pat, node, DIRECTION_RIGHTcxx . . $ DIRECTION_RIGHT.);
165 }
166 static inline grn_idcxx . . $ grn_id#
167 pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
168 {
169 return pat_node_get_childcxx . . $ pat_node_get_child(eb8bfb37bfad0e1c).(pat, node, DIRECTION_LEFTcxx . . $ DIRECTION_LEFT.);
170 }
171
172 static inline grn_idcxx . . $ grn_id# *
173 pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(grn_patcxx . . $ grn_pat# *pat,
174 pat_node_commoncxx . . $ pat_node_common# *node,
175 pat_node_directioncxx . . $ pat_node_direction# direction)
176 {
177 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
178 return &(node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..lrcxx . . $ $anonymous_type_d195c43ed9cfff57_2#lr.[direction]);
179 } else {
180 return &(node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..lrcxx . . $ $anonymous_type_d195c43ed9cfff57_1#lr.[direction]);
181 }
182 }
183
184 static inline grn_idcxx . . $ grn_id# *
185 pat_node_get_right_addresscxx . . $ pat_node_get_right_address(611d92fad5637a27).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
186 {
187 return pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat, node, DIRECTION_RIGHTcxx . . $ DIRECTION_RIGHT.);
188 }
189
190 static inline grn_idcxx . . $ grn_id# *
191 pat_node_get_left_addresscxx . . $ pat_node_get_left_address(611d92fad5637a27).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
192 {
193 return pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat, node, DIRECTION_LEFTcxx . . $ DIRECTION_LEFT.);
194 }
195
196 static inline void
197 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(grn_patcxx . . $ grn_pat# *pat,
198 pat_node_commoncxx . . $ pat_node_common# *node,
199 pat_node_directioncxx . . $ pat_node_direction# direction,
200 grn_idcxx . . $ grn_id# id)
201 {
202 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
203 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..lrcxx . . $ $anonymous_type_d195c43ed9cfff57_2#lr.[direction] = id;
204 } else {
205 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..lrcxx . . $ $anonymous_type_d195c43ed9cfff57_1#lr.[direction] = id;
206 }
207 }
208
209 static inline void
210 pat_node_set_rightcxx . . $ pat_node_set_right(17210a70016b3f10).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node, grn_idcxx . . $ grn_id# id)
211 {
212 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(pat, node, DIRECTION_RIGHTcxx . . $ DIRECTION_RIGHT., id);
213 }
214
215 static inline void
216 pat_node_set_leftcxx . . $ pat_node_set_left(17210a70016b3f10).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node, grn_idcxx . . $ grn_id# id)
217 {
218 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(pat, node, DIRECTION_LEFTcxx . . $ DIRECTION_LEFT., id);
219 }
220
221 static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
222 pat_node_is_deletingcxx . . $ pat_node_is_deleting(e829a7c3dd493304).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
223 {
224 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
225 return node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits. & PAT_DELETINGcxx . . $ `lib/pat.c:125:9`!;
226 } else {
227 return node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits. & PAT_DELETINGcxx . . $ `lib/pat.c:125:9`!;
228 }
229 }
230 static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
231 pat_node_is_key_immediatecxx . . $ pat_node_is_key_immediate(e829a7c3dd493304).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
232 {
233 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
234 return node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits. & PAT_IMMEDIATEcxx . . $ `lib/pat.c:126:9`!;
235 } else {
236 return node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits. & PAT_IMMEDIATEcxx . . $ `lib/pat.c:126:9`!;
237 }
238 }
239
240 static inline uint32_tcxx . . $ uint32_t#
241 pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
242 {
243 uint16_tcxx . . $ uint16_t# bits;
244 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
245 bits = node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits.;
246 } else {
247 bits = node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits.;
248 }
249 return (uint32_tcxx . . $ uint32_t#)((bits >> 3) + 1);
250 }
251 static inline uint16_tcxx . . $ uint16_t#
252 pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
253 {
254 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
255 return node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_2#check.;
256 } else {
257 return node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_1#check.;
258 }
259 }
260 static inline void
261 pat_node_set_deleting_oncxx . . $ pat_node_set_deleting_on(23a3c3d6b85e9ec6).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
262 {
263 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
264 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits. |= PAT_DELETINGcxx . . $ `lib/pat.c:125:9`!;
265 } else {
266 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits. |= PAT_DELETINGcxx . . $ `lib/pat.c:125:9`!;
267 }
268 }
269
270 static inline void
271 pat_node_set_key_immediate_oncxx . . $ pat_node_set_key_immediate_on(23a3c3d6b85e9ec6).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
272 {
273 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
274 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits. |= PAT_IMMEDIATEcxx . . $ `lib/pat.c:126:9`!;
275 } else {
276 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits. |= PAT_IMMEDIATEcxx . . $ `lib/pat.c:126:9`!;
277 }
278 }
279 static inline void
280 pat_node_set_deleting_offcxx . . $ pat_node_set_deleting_off(23a3c3d6b85e9ec6).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
281 {
282 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
283 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits. &= ~PAT_DELETINGcxx . . $ `lib/pat.c:125:9`!;
284 } else {
285 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits. &= ~PAT_DELETINGcxx . . $ `lib/pat.c:125:9`!;
286 }
287 }
288 static inline void
289 pat_node_set_key_immediate_offcxx . . $ pat_node_set_key_immediate_off(23a3c3d6b85e9ec6).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
290 {
291 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
292 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits. &= ~PAT_IMMEDIATEcxx . . $ `lib/pat.c:126:9`!;
293 } else {
294 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits. &= ~PAT_IMMEDIATEcxx . . $ `lib/pat.c:126:9`!;
295 }
296 }
297
298 static inline void
299 pat_node_set_key_lengthcxx . . $ pat_node_set_key_length(17210a70016b3f10).(grn_patcxx . . $ grn_pat# *pat,
300 pat_node_commoncxx . . $ pat_node_common# *node,
301 uint32_tcxx . . $ uint32_t# key_length)
302 {
303 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
304 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits. =
305 (node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_2#bits. & ((1 << 3) - 1)) | ((key_length - 1) << 3);
306 } else {
307 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits. =
308 (node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..bitscxx . . $ $anonymous_type_d195c43ed9cfff57_1#bits. & ((1 << 3) - 1)) | ((key_length - 1) << 3);
309 }
310 }
311 static inline void
312 pat_node_set_checkcxx . . $ pat_node_set_check(18b96d60ead2a18e).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node, uint16_tcxx . . $ uint16_t# check)
313 {
314 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
315 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_2#check. = check;
316 } else {
317 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_1#check. = check;
318 }
319 }
320
321 #define PAT_CHECK_BYTE_DIFFERENCES_SHIFTcxx . . $ `lib/pat.c:321:9`! 4
322 #define PAT_CHECK_BIT_DIFFERENCES_SHIFTcxx . . $ `lib/pat.c:322:9`! 1
323 #define PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(byte_differences, bit_differences, terminated) \
324 (((byte_differences) << PAT_CHECK_BYTE_DIFFERENCES_SHIFTcxx . . $ `lib/pat.c:321:9`!) + \
325 ((bit_differences) << PAT_CHECK_BIT_DIFFERENCES_SHIFTcxx . . $ `lib/pat.c:322:9`!) + \
326 ((terminated) ? 1 : 0))
327 #define PAT_CHECK_BYTE_DIFFERENCEScxx . . $ `lib/pat.c:327:9`!(check) \
328 ((check) >> PAT_CHECK_BYTE_DIFFERENCES_SHIFTcxx . . $ `lib/pat.c:321:9`!)
329 #define PAT_CHECK_BIT_DIFFERENCEScxx . . $ `lib/pat.c:329:9`!(check) \
330 (((check) >> PAT_CHECK_BIT_DIFFERENCES_SHIFTcxx . . $ `lib/pat.c:322:9`!) & 0b111)
331 #define PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check) ((check) & 1)
332 #define PAT_CHECK_ADD_BIT_DIFFERENCEScxx . . $ `lib/pat.c:332:9`!(check, n) \
333 ((check) + ((n) << PAT_CHECK_BIT_DIFFERENCES_SHIFTcxx . . $ `lib/pat.c:322:9`!))
334
335 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_4# {
336 grn_idcxx . . $ grn_id# childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children.;
337 grn_idcxx . . $ grn_id# siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling.;
338 } sis_nodecxx . . $ sis_node#;
339
340 enumcxx . . $ $anonymous_type_d195c43ed9cfff57_5# {
341 SEGMENT_KEYcxx . . $ SEGMENT_KEY. = 0,
342 SEGMENT_PATcxx . . $ SEGMENT_PAT. = 1,
343 SEGMENT_SIScxx . . $ SEGMENT_SIS. = 2
344 };
345
346 void
347 grn_p_pat_nodecxx . . $ grn_p_pat_node(5d69d58db8d4c089).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node);
348
349 /* WAL operation */
350
351 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_6# {
352 grn_patcxx . . $ grn_pat# *patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.;
353 uint64_tcxx . . $ uint64_t# wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.;
354 const char *tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.;
355 grn_wal_eventcxx . . $ grn_wal_event# eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.;
356 grn_idcxx . . $ grn_id# record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.;
357 pat_node_directioncxx . . $ pat_node_direction# record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction.;
358 const uint8_tcxx . . $ uint8_t# *keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
359 uint32_tcxx . . $ uint32_t# key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
360 uint64_tcxx . . $ uint64_t# key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset.;
361 uint32_tcxx . . $ uint32_t# shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#shared_key_offset.;
362 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_6#is_shared.;
363 uint16_tcxx . . $ uint16_t# checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.;
364 grn_idcxx . . $ grn_id# parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.;
365 pat_node_directioncxx . . $ pat_node_direction# parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_direction.;
366 uint16_tcxx . . $ uint16_t# parent_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_check.;
367 grn_idcxx . . $ grn_id# grandparent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#grandparent_record_id.;
368 grn_idcxx . . $ grn_id# otherside_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#otherside_record_id.;
369 uint16_tcxx . . $ uint16_t# otherside_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#otherside_check.;
370 grn_idcxx . . $ grn_id# left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#left_record_id.;
371 grn_idcxx . . $ grn_id# right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#right_record_id.;
372 grn_idcxx . . $ grn_id# next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#next_garbage_record_id.;
373 uint32_tcxx . . $ uint32_t# n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages.;
374 uint32_tcxx . . $ uint32_t# n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries.;
375 uint32_tcxx . . $ uint32_t# delete_info_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_index.;
376 uint32_tcxx . . $ uint32_t# delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase1_index.;
377 uint32_tcxx . . $ uint32_t# delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase2_index.;
378 uint32_tcxx . . $ uint32_t# delete_info_phase3_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase3_index.;
379 grn_idcxx . . $ grn_id# previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#previous_record_id.;
380 } grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data#;
381
382 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_7# {
383 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id.;
384 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_direction.;
385 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! keycxx . . $ $anonymous_type_d195c43ed9cfff57_7#key.;
386 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_size.;
387 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_offset.;
388 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#shared_key_offset.;
389 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_7#is_shared.;
390 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check.;
391 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_id.;
392 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_direction.;
393 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! parent_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_check.;
394 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! grandparent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#grandparent_record_id.;
395 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! otherside_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#otherside_record_id.;
396 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! otherside_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#otherside_check.;
397 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#left_record_id.;
398 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#right_record_id.;
399 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#next_garbage_record_id.;
400 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_garbages.;
401 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_entries.;
402 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! delete_info_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_index.;
403 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase1_index.;
404 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase2_index.;
405 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! delete_info_phase3_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase3_index.;
406 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#previous_record_id.;
407 } grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used#;
408
409 static grn_rccxx . . $ grn_rc#
410 grn_pat_wal_add_entry_add_entrycxx . . $ grn_pat_wal_add_entry_add_entry(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
411 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
412 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
413 {
414 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
415 used->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_direction. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
416 used->keycxx . . $ $anonymous_type_d195c43ed9cfff57_7#key. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
417 used->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_size. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
418 used->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_offset. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
419 used->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
420 used->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
421 used->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_entries. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
422 used->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#previous_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
423 const void *key = data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
424 size_t key_size = data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
425 uint32_tcxx . . $ uint32_t# record_direction = data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction.;
426 uint32_tcxx . . $ uint32_t# check = data->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.;
427 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
428 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
429 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
430 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
431 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
432
433 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
434 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
435 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
436
437 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
438 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
439 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
440
441 GRN_WAL_KEY_RECORD_DIRECTIONcxx . . $ GRN_WAL_KEY_RECORD_DIRECTION.,
442 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
443 record_direction,
444
445 GRN_WAL_KEY_KEYcxx . . $ GRN_WAL_KEY_KEY.,
446 GRN_WAL_VALUE_BINARYcxx . . $ GRN_WAL_VALUE_BINARY.,
447 key,
448 key_size,
449
450 GRN_WAL_KEY_KEY_OFFSETcxx . . $ GRN_WAL_KEY_KEY_OFFSET.,
451 GRN_WAL_VALUE_UINT64cxx . . $ GRN_WAL_VALUE_UINT64.,
452 data->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset.,
453
454 GRN_WAL_KEY_CHECKcxx . . $ GRN_WAL_KEY_CHECK.,
455 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
456 check,
457
458 GRN_WAL_KEY_PARENT_RECORD_IDcxx . . $ GRN_WAL_KEY_PARENT_RECORD_ID.,
459 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
460 data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.,
461
462 GRN_WAL_KEY_N_ENTRIEScxx . . $ GRN_WAL_KEY_N_ENTRIES.,
463 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
464 data->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries.,
465
466 GRN_WAL_KEY_PREVIOUS_RECORD_IDcxx . . $ GRN_WAL_KEY_PREVIOUS_RECORD_ID.,
467 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
468 data->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#previous_record_id.,
469
470 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
471 }
472
473 static grn_rccxx . . $ grn_rc#
474 grn_pat_wal_add_entry_add_shared_entrycxx . . $ grn_pat_wal_add_entry_add_shared_entry(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
475 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
476 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
477 {
478 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
479 used->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_direction. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
480 used->keycxx . . $ $anonymous_type_d195c43ed9cfff57_7#key. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
481 used->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_size. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
482 used->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#shared_key_offset. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
483 used->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
484 used->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
485 used->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_entries. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
486 used->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#previous_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
487 const void *key = data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
488 size_t key_size = data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
489 uint32_tcxx . . $ uint32_t# check = data->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.;
490 uint32_tcxx . . $ uint32_t# record_direction = data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction.;
491 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
492 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
493 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
494 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
495 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
496
497 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
498 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
499 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
500
501 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
502 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
503 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
504
505 GRN_WAL_KEY_RECORD_DIRECTIONcxx . . $ GRN_WAL_KEY_RECORD_DIRECTION.,
506 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
507 record_direction,
508
509 GRN_WAL_KEY_KEYcxx . . $ GRN_WAL_KEY_KEY.,
510 GRN_WAL_VALUE_BINARYcxx . . $ GRN_WAL_VALUE_BINARY.,
511 key,
512 key_size,
513
514 GRN_WAL_KEY_SHARED_KEY_OFFSETcxx . . $ GRN_WAL_KEY_SHARED_KEY_OFFSET.,
515 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
516 data->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#shared_key_offset.,
517
518 GRN_WAL_KEY_CHECKcxx . . $ GRN_WAL_KEY_CHECK.,
519 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
520 check,
521
522 GRN_WAL_KEY_PARENT_RECORD_IDcxx . . $ GRN_WAL_KEY_PARENT_RECORD_ID.,
523 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
524 data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.,
525
526 GRN_WAL_KEY_N_ENTRIEScxx . . $ GRN_WAL_KEY_N_ENTRIES.,
527 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
528 data->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries.,
529
530 GRN_WAL_KEY_PREVIOUS_RECORD_IDcxx . . $ GRN_WAL_KEY_PREVIOUS_RECORD_ID.,
531 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
532 data->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#previous_record_id.,
533
534 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
535 }
536
537 static grn_rccxx . . $ grn_rc#
538 grn_pat_wal_add_entry_reuse_entrycxx . . $ grn_pat_wal_add_entry_reuse_entry(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
539 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
540 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
541 {
542 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
543 used->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_direction. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
544 used->keycxx . . $ $anonymous_type_d195c43ed9cfff57_7#key. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
545 used->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_size. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
546 used->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
547 used->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
548 used->next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#next_garbage_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
549 used->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_garbages. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
550 used->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_entries. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
551 used->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#previous_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
552 const void *key = data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
553 size_t key_size = data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
554 uint32_tcxx . . $ uint32_t# record_direction = data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction.;
555 uint32_tcxx . . $ uint32_t# check = data->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.;
556 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
557 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
558 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
559 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
560 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
561
562 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
563 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
564 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
565
566 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
567 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
568 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
569
570 GRN_WAL_KEY_RECORD_DIRECTIONcxx . . $ GRN_WAL_KEY_RECORD_DIRECTION.,
571 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
572 record_direction,
573
574 GRN_WAL_KEY_KEYcxx . . $ GRN_WAL_KEY_KEY.,
575 GRN_WAL_VALUE_BINARYcxx . . $ GRN_WAL_VALUE_BINARY.,
576 key,
577 key_size,
578
579 GRN_WAL_KEY_CHECKcxx . . $ GRN_WAL_KEY_CHECK.,
580 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
581 check,
582
583 GRN_WAL_KEY_NEXT_GARBAGE_RECORD_IDcxx . . $ GRN_WAL_KEY_NEXT_GARBAGE_RECORD_ID.,
584 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
585 data->next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#next_garbage_record_id.,
586
587 GRN_WAL_KEY_PARENT_RECORD_IDcxx . . $ GRN_WAL_KEY_PARENT_RECORD_ID.,
588 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
589 data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.,
590
591 GRN_WAL_KEY_N_GARBAGEScxx . . $ GRN_WAL_KEY_N_GARBAGES.,
592 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
593 data->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages.,
594
595 GRN_WAL_KEY_N_ENTRIEScxx . . $ GRN_WAL_KEY_N_ENTRIES.,
596 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
597 data->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries.,
598
599 GRN_WAL_KEY_PREVIOUS_RECORD_IDcxx . . $ GRN_WAL_KEY_PREVIOUS_RECORD_ID.,
600 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
601 data->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#previous_record_id.,
602
603 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
604 }
605
606 static grn_rccxx . . $ grn_rc#
607 grn_pat_wal_add_entry_reuse_shared_entrycxx . . $ grn_pat_wal_add_entry_reuse_shared_entry(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
608 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
609 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
610 {
611 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
612 used->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_direction. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
613 used->keycxx . . $ $anonymous_type_d195c43ed9cfff57_7#key. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
614 used->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_size. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
615 used->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#shared_key_offset. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
616 used->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
617 used->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
618 used->next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#next_garbage_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
619 used->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_garbages. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
620 used->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_entries. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
621 used->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#previous_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
622 const void *key = data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
623 size_t key_size = data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
624 uint32_tcxx . . $ uint32_t# check = data->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.;
625 uint32_tcxx . . $ uint32_t# record_direction = data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction.;
626 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
627 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
628 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
629 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
630 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
631
632 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
633 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
634 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
635
636 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
637 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
638 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
639
640 GRN_WAL_KEY_RECORD_DIRECTIONcxx . . $ GRN_WAL_KEY_RECORD_DIRECTION.,
641 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
642 record_direction,
643
644 GRN_WAL_KEY_KEYcxx . . $ GRN_WAL_KEY_KEY.,
645 GRN_WAL_VALUE_BINARYcxx . . $ GRN_WAL_VALUE_BINARY.,
646 key,
647 key_size,
648
649 GRN_WAL_KEY_SHARED_KEY_OFFSETcxx . . $ GRN_WAL_KEY_SHARED_KEY_OFFSET.,
650 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
651 data->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#shared_key_offset.,
652
653 GRN_WAL_KEY_CHECKcxx . . $ GRN_WAL_KEY_CHECK.,
654 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
655 check,
656
657 GRN_WAL_KEY_PARENT_RECORD_IDcxx . . $ GRN_WAL_KEY_PARENT_RECORD_ID.,
658 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
659 data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.,
660
661 GRN_WAL_KEY_NEXT_GARBAGE_RECORD_IDcxx . . $ GRN_WAL_KEY_NEXT_GARBAGE_RECORD_ID.,
662 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
663 data->next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#next_garbage_record_id.,
664
665 GRN_WAL_KEY_N_GARBAGEScxx . . $ GRN_WAL_KEY_N_GARBAGES.,
666 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
667 data->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages.,
668
669 GRN_WAL_KEY_N_ENTRIEScxx . . $ GRN_WAL_KEY_N_ENTRIES.,
670 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
671 data->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries.,
672
673 GRN_WAL_KEY_PREVIOUS_RECORD_IDcxx . . $ GRN_WAL_KEY_PREVIOUS_RECORD_ID.,
674 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
675 data->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#previous_record_id.,
676
677 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
678 }
679
680 static grn_rccxx . . $ grn_rc#
681 grn_pat_wal_add_entry_delete_info_phase1cxx . . $ grn_pat_wal_add_entry_delete_info_phase1(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
682 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
683 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
684 {
685 used->is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_7#is_shared. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
686 used->delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase1_index. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
687 int is_shared = data->is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_6#is_shared.;
688 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
689 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
690 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
691 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
692 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
693
694 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
695 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
696 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
697
698 GRN_WAL_KEY_IS_SHAREDcxx . . $ GRN_WAL_KEY_IS_SHARED.,
699 GRN_WAL_VALUE_BOOLEANcxx . . $ GRN_WAL_VALUE_BOOLEAN.,
700 is_shared,
701
702 GRN_WAL_KEY_DELETE_INFO_PHASE1_INDEXcxx . . $ GRN_WAL_KEY_DELETE_INFO_PHASE1_INDEX.,
703 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
704 data->delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase1_index.,
705
706 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
707 }
708
709 static grn_rccxx . . $ grn_rc#
710 grn_pat_wal_add_entry_delete_info_phase2cxx . . $ grn_pat_wal_add_entry_delete_info_phase2(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
711 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
712 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
713 {
714 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
715 used->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_size. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
716 used->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
717 used->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
718 used->left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#left_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
719 used->right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#right_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
720 used->delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase2_index. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
721 uint32_tcxx . . $ uint32_t# check = data->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.;
722 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
723 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
724 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
725 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
726 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
727
728 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
729 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
730 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
731
732 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
733 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
734 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
735
736 GRN_WAL_KEY_KEY_SIZEcxx . . $ GRN_WAL_KEY_KEY_SIZE.,
737 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
738 data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.,
739
740 GRN_WAL_KEY_CHECKcxx . . $ GRN_WAL_KEY_CHECK.,
741 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
742 check,
743
744 GRN_WAL_KEY_PARENT_RECORD_IDcxx . . $ GRN_WAL_KEY_PARENT_RECORD_ID.,
745 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
746 data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.,
747
748 GRN_WAL_KEY_LEFT_RECORD_IDcxx . . $ GRN_WAL_KEY_LEFT_RECORD_ID.,
749 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
750 data->left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#left_record_id.,
751
752 GRN_WAL_KEY_RIGHT_RECORD_IDcxx . . $ GRN_WAL_KEY_RIGHT_RECORD_ID.,
753 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
754 data->right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#right_record_id.,
755
756 GRN_WAL_KEY_DELETE_INFO_PHASE2_INDEXcxx . . $ GRN_WAL_KEY_DELETE_INFO_PHASE2_INDEX.,
757 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
758 data->delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase2_index.,
759
760 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
761 }
762
763 static grn_rccxx . . $ grn_rc#
764 grn_pat_wal_add_entry_delete_info_phase3cxx . . $ grn_pat_wal_add_entry_delete_info_phase3(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
765 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
766 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
767 {
768 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
769 used->is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_7#is_shared. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
770 used->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
771 used->next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#next_garbage_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
772 used->delete_info_phase3_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase3_index. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
773 int is_shared = data->is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_6#is_shared.;
774 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
775 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
776 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
777 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
778 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
779
780 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
781 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
782 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
783
784 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
785 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
786 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
787
788 GRN_WAL_KEY_IS_SHAREDcxx . . $ GRN_WAL_KEY_IS_SHARED.,
789 GRN_WAL_VALUE_BOOLEANcxx . . $ GRN_WAL_VALUE_BOOLEAN.,
790 is_shared,
791
792 GRN_WAL_KEY_NEXT_GARBAGE_RECORD_IDcxx . . $ GRN_WAL_KEY_NEXT_GARBAGE_RECORD_ID.,
793 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
794 data->next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#next_garbage_record_id.,
795
796 GRN_WAL_KEY_DELETE_INFO_PHASE3_INDEXcxx . . $ GRN_WAL_KEY_DELETE_INFO_PHASE3_INDEX.,
797 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
798 data->delete_info_phase3_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase3_index.,
799
800 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
801 }
802
803 static grn_rccxx . . $ grn_rc#
804 grn_pat_wal_add_entry_delete_entrycxx . . $ grn_pat_wal_add_entry_delete_entry(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
805 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
806 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
807 {
808 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
809 used->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_direction. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
810 used->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
811 used->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
812 used->parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_direction. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
813 used->parent_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
814 used->grandparent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#grandparent_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
815 used->otherside_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#otherside_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
816 used->otherside_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#otherside_check. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
817 used->left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#left_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
818 used->right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#right_record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
819 used->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_garbages. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
820 used->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_entries. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
821 used->delete_info_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_index. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
822 used->delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase1_index. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
823 used->delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase2_index. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
824 uint32_tcxx . . $ uint32_t# check = data->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.;
825 uint32_tcxx . . $ uint32_t# parent_check = data->parent_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_check.;
826 uint32_tcxx . . $ uint32_t# otherside_check = data->otherside_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#otherside_check.;
827 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
828 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
829 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
830 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
831 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
832
833 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
834 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
835 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
836
837 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
838 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
839 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
840
841 GRN_WAL_KEY_RECORD_DIRECTIONcxx . . $ GRN_WAL_KEY_RECORD_DIRECTION.,
842 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
843 data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction.,
844
845 GRN_WAL_KEY_CHECKcxx . . $ GRN_WAL_KEY_CHECK.,
846 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
847 check,
848
849 GRN_WAL_KEY_PARENT_RECORD_IDcxx . . $ GRN_WAL_KEY_PARENT_RECORD_ID.,
850 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
851 data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.,
852
853 GRN_WAL_KEY_PARENT_CHECKcxx . . $ GRN_WAL_KEY_PARENT_CHECK.,
854 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
855 parent_check,
856
857 GRN_WAL_KEY_PARENT_RECORD_DIRECTIONcxx . . $ GRN_WAL_KEY_PARENT_RECORD_DIRECTION.,
858 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
859 data->parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_direction.,
860
861 GRN_WAL_KEY_GRANDPARENT_RECORD_IDcxx . . $ GRN_WAL_KEY_GRANDPARENT_RECORD_ID.,
862 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
863 data->grandparent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#grandparent_record_id.,
864
865 GRN_WAL_KEY_OTHERSIDE_RECORD_IDcxx . . $ GRN_WAL_KEY_OTHERSIDE_RECORD_ID.,
866 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
867 data->otherside_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#otherside_record_id.,
868
869 GRN_WAL_KEY_OTHERSIDE_CHECKcxx . . $ GRN_WAL_KEY_OTHERSIDE_CHECK.,
870 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
871 otherside_check,
872
873 GRN_WAL_KEY_LEFT_RECORD_IDcxx . . $ GRN_WAL_KEY_LEFT_RECORD_ID.,
874 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
875 data->left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#left_record_id.,
876
877 GRN_WAL_KEY_RIGHT_RECORD_IDcxx . . $ GRN_WAL_KEY_RIGHT_RECORD_ID.,
878 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
879 data->right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#right_record_id.,
880
881 GRN_WAL_KEY_N_GARBAGEScxx . . $ GRN_WAL_KEY_N_GARBAGES.,
882 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
883 data->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages.,
884
885 GRN_WAL_KEY_N_ENTRIEScxx . . $ GRN_WAL_KEY_N_ENTRIES.,
886 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
887 data->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries.,
888
889 GRN_WAL_KEY_DELETE_INFO_INDEXcxx . . $ GRN_WAL_KEY_DELETE_INFO_INDEX.,
890 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
891 data->delete_info_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_index.,
892
893 GRN_WAL_KEY_DELETE_INFO_PHASE1_INDEXcxx . . $ GRN_WAL_KEY_DELETE_INFO_PHASE1_INDEX.,
894 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
895 data->delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase1_index.,
896
897 GRN_WAL_KEY_DELETE_INFO_PHASE2_INDEXcxx . . $ GRN_WAL_KEY_DELETE_INFO_PHASE2_INDEX.,
898 GRN_WAL_VALUE_UINT32cxx . . $ GRN_WAL_VALUE_UINT32.,
899 data->delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase2_index.,
900
901 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
902 }
903
904 static grn_rccxx . . $ grn_rc#
905 grn_pat_wal_add_entry_defrag_keycxx . . $ grn_pat_wal_add_entry_defrag_key(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
906 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
907 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
908 {
909 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
910 used->keycxx . . $ $anonymous_type_d195c43ed9cfff57_7#key. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
911 used->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_size. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
912 used->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_offset. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
913 const void *key = data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
914 size_t key_size = data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
915 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
916 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
917 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
918 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
919 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
920
921 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
922 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
923 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
924
925 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
926 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
927 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
928
929 GRN_WAL_KEY_KEYcxx . . $ GRN_WAL_KEY_KEY.,
930 GRN_WAL_VALUE_BINARYcxx . . $ GRN_WAL_VALUE_BINARY.,
931 key,
932 key_size,
933
934 GRN_WAL_KEY_KEY_OFFSETcxx . . $ GRN_WAL_KEY_KEY_OFFSET.,
935 GRN_WAL_VALUE_UINT64cxx . . $ GRN_WAL_VALUE_UINT64.,
936 data->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset.,
937
938 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
939 }
940
941 static grn_rccxx . . $ grn_rc#
942 grn_pat_wal_add_entry_defrag_current_keycxx . . $ grn_pat_wal_add_entry_defrag_current_key(b5ad7ad745fcc1e).(grn_ctxcxx . . $ grn_ctx# *ctx,
943 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
944 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used)
945 {
946 // `record_id` is the max grn_id alive at the time of defragmentation.
947 used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
948 used->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_offset. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
949 return grn_wal_add_entrycxx . . $ grn_wal_add_entry(f55418730f3bb4ba).(ctx,
950 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
951 falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!,
952 &(data->wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.),
953 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
954
955 GRN_WAL_KEY_EVENTcxx . . $ GRN_WAL_KEY_EVENT.,
956 GRN_WAL_VALUE_EVENTcxx . . $ GRN_WAL_VALUE_EVENT.,
957 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
958
959 GRN_WAL_KEY_RECORD_IDcxx . . $ GRN_WAL_KEY_RECORD_ID.,
960 GRN_WAL_VALUE_RECORD_IDcxx . . $ GRN_WAL_VALUE_RECORD_ID.,
961 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
962
963 GRN_WAL_KEY_KEY_OFFSETcxx . . $ GRN_WAL_KEY_KEY_OFFSET.,
964 GRN_WAL_VALUE_UINT64cxx . . $ GRN_WAL_VALUE_UINT64.,
965 data->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset.,
966
967 GRN_WAL_KEY_ENDcxx . . $ GRN_WAL_KEY_END.);
968 }
969
970 static void
971 grn_pat_wal_add_entry_format_detailscxx . . $ grn_pat_wal_add_entry_format_details(c38605ca382ee63f).(grn_ctxcxx . . $ grn_ctx# *ctx,
972 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
973 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# *used,
974 grn_objcxx . . $ grn_obj# *details)
975 {
976 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
977 details,
978 "event:%u<%s> ",
979 data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.,
980 grn_wal_event_to_stringcxx . . $ grn_wal_event_to_string(5385ed4c101a64de).(data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.));
981 if (used->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_id.) {
982 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, details, "record-id:%u ", data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.);
983 }
984 if (used->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#record_direction.) {
985 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
986 details,
987 "record-direction:%s ",
988 data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction. == DIRECTION_LEFTcxx . . $ DIRECTION_LEFT. ? "left"
989 : "right");
990 }
991 if (used->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_size.) {
992 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, details, "key-size:%u ", data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.);
993 }
994 if (used->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#key_offset.) {
995 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
996 details,
997 "key-offset:%" GRN_FMT_INT64Ucxx . . $ `lib/grn.h:370:11`! " ",
998 data->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset.);
999 }
1000 if (used->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_7#shared_key_offset.) {
1001 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1002 details,
1003 "shared-key-offset:%u ",
1004 data->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#shared_key_offset.);
1005 }
1006 if (used->is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_7#is_shared.) {
1007 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1008 details,
1009 "is-shared:%s ",
1010 data->is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_6#is_shared. ? "true" : "false");
1011 }
1012 if (used->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#check.) {
1013 uint16_tcxx . . $ uint16_t# check = data->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.;
1014 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1015 details,
1016 "check:<%u|%u|%s>(%u) ",
1017 PAT_CHECK_BYTE_DIFFERENCEScxx . . $ `lib/pat.c:327:9`!(check),
1018 PAT_CHECK_BIT_DIFFERENCEScxx . . $ `lib/pat.c:329:9`!(check),
1019 PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check) ? "true" : "false",
1020 check);
1021 }
1022 if (used->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_id.) {
1023 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1024 details,
1025 "parent-record-id:%u ",
1026 data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.);
1027 }
1028 if (used->parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_record_direction.) {
1029 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1030 details,
1031 "parent-record-direction:%s ",
1032 data->parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_direction. == DIRECTION_LEFTcxx . . $ DIRECTION_LEFT. ? "left"
1033 : "right");
1034 }
1035 if (used->grandparent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#grandparent_record_id.) {
1036 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1037 details,
1038 "grandparent-record-id:%u ",
1039 data->grandparent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#grandparent_record_id.);
1040 }
1041 if (used->parent_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#parent_check.) {
1042 uint16_tcxx . . $ uint16_t# check = data->parent_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_check.;
1043 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1044 details,
1045 "parent-check:<%u|%u|%s>(%u) ",
1046 PAT_CHECK_BYTE_DIFFERENCEScxx . . $ `lib/pat.c:327:9`!(check),
1047 PAT_CHECK_BIT_DIFFERENCEScxx . . $ `lib/pat.c:329:9`!(check),
1048 PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check) ? "true" : "false",
1049 check);
1050 }
1051 if (used->otherside_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#otherside_record_id.) {
1052 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1053 details,
1054 "otherside-record-id:%u ",
1055 data->otherside_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#otherside_record_id.);
1056 }
1057 if (used->otherside_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_7#otherside_check.) {
1058 uint16_tcxx . . $ uint16_t# check = data->otherside_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#otherside_check.;
1059 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1060 details,
1061 "otherside-check:<%u|%u|%s>(%u) ",
1062 PAT_CHECK_BYTE_DIFFERENCEScxx . . $ `lib/pat.c:327:9`!(check),
1063 PAT_CHECK_BIT_DIFFERENCEScxx . . $ `lib/pat.c:329:9`!(check),
1064 PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check) ? "true" : "false",
1065 check);
1066 }
1067 if (used->left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#left_record_id.) {
1068 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, details, "left-record-id:%u ", data->left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#left_record_id.);
1069 }
1070 if (used->right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#right_record_id.) {
1071 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, details, "right-record-id:%u ", data->right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#right_record_id.);
1072 }
1073 if (used->next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#next_garbage_record_id.) {
1074 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1075 details,
1076 "next-garbage-record-id:%u ",
1077 data->next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#next_garbage_record_id.);
1078 }
1079 if (used->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_garbages.) {
1080 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, details, "n-garbages:%u ", data->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages.);
1081 }
1082 if (used->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_7#n_entries.) {
1083 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, details, "n-entries:%u ", data->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries.);
1084 }
1085 if (used->delete_info_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_index.) {
1086 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1087 details,
1088 "delete-info-index:%u ",
1089 data->delete_info_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_index.);
1090 }
1091 if (used->delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase1_index.) {
1092 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1093 details,
1094 "delete-info-phase1-index:%u ",
1095 data->delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase1_index.);
1096 }
1097 if (used->delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase2_index.) {
1098 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1099 details,
1100 "delete-info-phase2-index:%u ",
1101 data->delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase2_index.);
1102 }
1103 if (used->delete_info_phase3_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_7#delete_info_phase3_index.) {
1104 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1105 details,
1106 "delete-info-phase3-index:%u ",
1107 data->delete_info_phase3_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase3_index.);
1108 }
1109 if (used->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_7#previous_record_id.) {
1110 grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx,
1111 details,
1112 "previous-record-id:%u ",
1113 data->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#previous_record_id.);
1114 }
1115 }
1116
1117 static inline grn_rccxx . . $ grn_rc#
1118 grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data)
1119 {
1120 if (GRN_CTX_GET_WAL_ROLEcxx . . $ `lib/grn_ctx_impl.h:233:9`!(ctx) == GRN_WAL_ROLE_NONEcxx . . $ GRN_WAL_ROLE_NONE.) {
1121 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1122 }
1123
1124 if (data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.->iocxx . . $ _grn_pat#io.->pathcxx . . $ _grn_io#path.[0] == '\0') {
1125 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1126 }
1127
1128 grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1129 const char *usage = "";
1130 grn_pat_wal_add_entry_usedcxx . . $ grn_pat_wal_add_entry_used# used = {0};
1131
1132 switch (data->eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event.) {
1133 case GRN_WAL_EVENT_ADD_ENTRYcxx . . $ GRN_WAL_EVENT_ADD_ENTRY.:
1134 usage = "adding entry";
1135 rc = grn_pat_wal_add_entry_add_entrycxx . . $ grn_pat_wal_add_entry_add_entry(b5ad7ad745fcc1e).(ctx, data, &used);
1136 break;
1137 case GRN_WAL_EVENT_ADD_SHARED_ENTRYcxx . . $ GRN_WAL_EVENT_ADD_SHARED_ENTRY.:
1138 usage = "adding shared entry";
1139 rc = grn_pat_wal_add_entry_add_shared_entrycxx . . $ grn_pat_wal_add_entry_add_shared_entry(b5ad7ad745fcc1e).(ctx, data, &used);
1140 break;
1141 case GRN_WAL_EVENT_REUSE_ENTRYcxx . . $ GRN_WAL_EVENT_REUSE_ENTRY.:
1142 usage = "reusing entry";
1143 rc = grn_pat_wal_add_entry_reuse_entrycxx . . $ grn_pat_wal_add_entry_reuse_entry(b5ad7ad745fcc1e).(ctx, data, &used);
1144 break;
1145 case GRN_WAL_EVENT_REUSE_SHARED_ENTRYcxx . . $ GRN_WAL_EVENT_REUSE_SHARED_ENTRY.:
1146 usage = "reusing shared entry";
1147 rc = grn_pat_wal_add_entry_reuse_shared_entrycxx . . $ grn_pat_wal_add_entry_reuse_shared_entry(b5ad7ad745fcc1e).(ctx, data, &used);
1148 break;
1149 case GRN_WAL_EVENT_DELETE_INFO_PHASE1cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE1.:
1150 usage = "deleting info phase1";
1151 rc = grn_pat_wal_add_entry_delete_info_phase1cxx . . $ grn_pat_wal_add_entry_delete_info_phase1(b5ad7ad745fcc1e).(ctx, data, &used);
1152 break;
1153 case GRN_WAL_EVENT_DELETE_INFO_PHASE2cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE2.:
1154 usage = "deleting info phase2";
1155 rc = grn_pat_wal_add_entry_delete_info_phase2cxx . . $ grn_pat_wal_add_entry_delete_info_phase2(b5ad7ad745fcc1e).(ctx, data, &used);
1156 break;
1157 case GRN_WAL_EVENT_DELETE_INFO_PHASE3cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE3.:
1158 usage = "deleting info phase3";
1159 rc = grn_pat_wal_add_entry_delete_info_phase3cxx . . $ grn_pat_wal_add_entry_delete_info_phase3(b5ad7ad745fcc1e).(ctx, data, &used);
1160 break;
1161 case GRN_WAL_EVENT_DELETE_ENTRYcxx . . $ GRN_WAL_EVENT_DELETE_ENTRY.:
1162 usage = "deleting entry";
1163 rc = grn_pat_wal_add_entry_delete_entrycxx . . $ grn_pat_wal_add_entry_delete_entry(b5ad7ad745fcc1e).(ctx, data, &used);
1164 break;
1165 case GRN_WAL_EVENT_DEFRAG_KEYcxx . . $ GRN_WAL_EVENT_DEFRAG_KEY.:
1166 usage = "defrag key";
1167 rc = grn_pat_wal_add_entry_defrag_keycxx . . $ grn_pat_wal_add_entry_defrag_key(b5ad7ad745fcc1e).(ctx, data, &used);
1168 break;
1169 case GRN_WAL_EVENT_DEFRAG_CURRENT_KEYcxx . . $ GRN_WAL_EVENT_DEFRAG_CURRENT_KEY.:
1170 usage = "defrag current key";
1171 rc = grn_pat_wal_add_entry_defrag_current_keycxx . . $ grn_pat_wal_add_entry_defrag_current_key(b5ad7ad745fcc1e).(ctx, data, &used);
1172 break;
1173 default:
1174 usage = "not implemented event";
1175 rc = GRN_FUNCTION_NOT_IMPLEMENTEDcxx . . $ GRN_FUNCTION_NOT_IMPLEMENTED.;
1176 break;
1177 }
1178
1179 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1180 grn_objcxx . . $ grn_obj# details;
1181 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&details, 0);
1182 grn_pat_wal_add_entry_format_detailscxx . . $ grn_pat_wal_add_entry_format_details(c38605ca382ee63f).(ctx, data, &used, &details);
1183 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
1184 (grn_objcxx . . $ grn_obj# *)(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.),
1185 rc,
1186 data->record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
1187 data->tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
1188 "failed to add WAL entry for %s: %.*s",
1189 usage,
1190 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&details),
1191 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&details));
1192 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &details);
1193 }
1194
1195 return rc;
1196 }
1197
1198 static inline void
1199 grn_pat_wal_add_entry_data_set_record_directioncxx . . $ grn_pat_wal_add_entry_data_set_record_direction(c756cf9716742472).(
1200 grn_ctxcxx . . $ grn_ctx# *ctx,
1201 grn_patcxx . . $ grn_pat# *pat,
1202 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *data,
1203 grn_idcxx . . $ grn_id# parent_record_id,
1204 pat_node_commoncxx . . $ pat_node_common# *parent_node,
1205 grn_idcxx . . $ grn_id# *id_location)
1206 {
1207 data->grandparent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#grandparent_record_id. = data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id.;
1208 data->parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_direction. = data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction.;
1209 data->parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id. = parent_record_id;
1210 if (id_location == pat_node_get_left_addresscxx . . $ pat_node_get_left_address(611d92fad5637a27).(pat, parent_node)) {
1211 data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction. = DIRECTION_LEFTcxx . . $ DIRECTION_LEFT.;
1212 } else {
1213 data->record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction. = DIRECTION_RIGHTcxx . . $ DIRECTION_RIGHT.;
1214 }
1215 data->previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#previous_record_id. = *id_location;
1216 }
1217
1218 /* bit operation */
1219
1220 #define nth_bitcxx . . $ `lib/pat.c:1220:9`!(key, check) \
1221 ((((key)[PAT_CHECK_BYTE_DIFFERENCEScxx . . $ `lib/pat.c:327:9`!((check))]) >> \
1222 (0b111 - PAT_CHECK_BIT_DIFFERENCEScxx . . $ `lib/pat.c:329:9`!((check)))) & \
1223 1)
1224
1225 /* segment operation */
1226
1227 /* patricia array operation */
1228
1229 #define PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, n) \
1230 do { \
1231 int flags = 0; \
1232 n = grn_io_array_at(ctx, pat->io, SEGMENT_PAT, id, &flags); \
1233 } while (0)
1234
1235 static inline pat_node_commoncxx . . $ pat_node_common# *
1236 pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id)
1237 {
1238 if (id > GRN_ID_MAXcxx . . $ `include/groonga/groonga.h:56:9`!) {
1239 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1240 }
1241 int flags = GRN_TABLE_ADDcxx . . $ `lib/grn_io.h:188:9`!;
1242 return grn_io_array_atcxx . . $ grn_io_array_at(7522d479c8449f23).(ctx, pat->iocxx . . $ _grn_pat#io., SEGMENT_PATcxx . . $ SEGMENT_PAT., id, &flags);
1243 }
1244
1245 /* sis operation */
1246
1247 static inline sis_nodecxx . . $ sis_node# *
1248 sis_atcxx . . $ sis_at(59e5564d0351a00f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id)
1249 {
1250 int flags = 0;
1251 if (id > GRN_ID_MAXcxx . . $ `include/groonga/groonga.h:56:9`!) {
1252 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1253 }
1254 return grn_io_array_atcxx . . $ grn_io_array_at(7522d479c8449f23).(ctx, pat->iocxx . . $ _grn_pat#io., SEGMENT_SIScxx . . $ SEGMENT_SIS., id, &flags);
1255 }
1256
1257 static inline sis_nodecxx . . $ sis_node# *
1258 sis_getcxx . . $ sis_get(59e5564d0351a00f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id)
1259 {
1260 int flags = GRN_TABLE_ADDcxx . . $ `lib/grn_io.h:188:9`!;
1261 if (id > GRN_ID_MAXcxx . . $ `include/groonga/groonga.h:56:9`!) {
1262 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1263 }
1264 return grn_io_array_atcxx . . $ grn_io_array_at(7522d479c8449f23).(ctx, pat->iocxx . . $ _grn_pat#io., SEGMENT_SIScxx . . $ SEGMENT_SIS., id, &flags);
1265 }
1266
1267 #define MAX_LEVELcxx . . $ `lib/pat.c:1267:9`! 16
1268
1269 static void
1270 sis_collectcxx . . $ sis_collect(ba654b20daabaf48).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_hashcxx . . $ grn_hash# *h, grn_idcxx . . $ grn_id# id, uint32_tcxx . . $ uint32_t# level)
1271 {
1272 uint32_tcxx . . $ uint32_t# *offset;
1273 sis_nodecxx . . $ sis_node# *sl = sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, pat, id);
1274 if (sl) {
1275 grn_idcxx . . $ grn_id# sid = sl->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children.;
1276 while (sid && sid != id) {
1277 if (grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx, h, &sid, sizeof(grn_idcxx . . $ grn_id#), (void **)&offset, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)) {
1278 *offset = level;
1279 if (level < MAX_LEVELcxx . . $ `lib/pat.c:1267:9`!) {
1280 sis_collectcxx . . $ sis_collect(ba654b20daabaf48).(ctx, pat, h, sid, level + 1);
1281 }
1282 if (!(sl = sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, pat, sid))) {
1283 break;
1284 }
1285 sid = sl->siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling.;
1286 } else {
1287 /* todo : must be handled */
1288 }
1289 }
1290 }
1291 }
1292
1293 /* key operation */
1294
1295 #define KEY_ATcxx . . $ `lib/pat.c:1295:9`!(pat, pos, ptr, addp) \
1296 do { \
1297 int flags = addp; \
1298 ptr = grn_io_array_at(ctx, pat->io, SEGMENT_KEY, pos, &flags); \
1299 } while (0)
1300
1301 static inline void
1302 pat_update_total_key_sizecxx . . $ pat_update_total_key_size(ad3bb8074492b44e).(grn_ctxcxx . . $ grn_ctx# *ctx,
1303 grn_patcxx . . $ grn_pat# *pat,
1304 uint64_tcxx . . $ uint64_t# new_total_key_size)
1305 {
1306 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
1307 pat->headercxx . . $ _grn_pat#header.->curr_key_largecxx . . $ grn_pat_header#curr_key_large. = new_total_key_size;
1308 } else {
1309 pat->headercxx . . $ _grn_pat#header.->curr_keycxx . . $ grn_pat_header#curr_key. = new_total_key_size;
1310 }
1311 }
1312
1313 static inline uint64_tcxx . . $ uint64_t#
1314 key_putcxx . . $ key_put(60c0e901dcd2d119).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, const uint8_tcxx . . $ uint8_t# *key, uint32_tcxx . . $ uint32_t# len)
1315 {
1316 // if (len >= GRN_PAT_SEGMENT_SIZE) { return 0; /* error */ }
1317 uint64_tcxx . . $ uint64_t# res = grn_pat_total_key_sizecxx . . $ grn_pat_total_key_size(3626315f4fc444a).(ctx, pat);
1318 if (res < grn_pat_max_total_key_sizecxx . . $ grn_pat_max_total_key_size(3626315f4fc444a).(ctx, pat) &&
1319 len > grn_pat_max_total_key_sizecxx . . $ grn_pat_max_total_key_size(3626315f4fc444a).(ctx, pat) - res) {
1320 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(pat);
1321 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_NOT_ENOUGH_SPACE,
1322 "[pat][key][put] total key size is over: <%.*s>: "
1323 "max=%" GRN_FMT_INT64Ucxx . . $ `lib/grn.h:370:11`! ": current=%" GRN_FMT_INT64Ucxx . . $ `lib/grn.h:370:11`! ": new key size=%u",
1324 name_size,
1325 name,
1326 grn_pat_max_total_key_size(ctx, pat),
1327 res,
1328 len);
1329 return 0;
1330 }
1331
1332 /* Check if the key to be added can fit in the current segment. */
1333 uint64_tcxx . . $ uint64_t# end_segment = (res + len - 1) >> W_OF_KEY_IN_A_SEGMENTcxx . . $ `lib/pat.c:38:9`!;
1334 if (res >> W_OF_KEY_IN_A_SEGMENTcxx . . $ `lib/pat.c:38:9`! != end_segment) {
1335 /* If it does not fit, update `curr_key`(`res`) to add it to the next
1336 * segment. */
1337 res = end_segment << W_OF_KEY_IN_A_SEGMENTcxx . . $ `lib/pat.c:38:9`!;
1338 pat_update_total_key_sizecxx . . $ pat_update_total_key_size(ad3bb8074492b44e).(ctx, pat, res);
1339 }
1340 {
1341 uint8_tcxx . . $ uint8_t# *dest;
1342 KEY_ATcxx . . $ `lib/pat.c:1295:9`!(pat, res, dest, GRN_TABLE_ADDcxx . . $ `lib/grn_io.h:188:9`!);
1343 if (!dest) {
1344 GRN_DEFINE_NAMEcxx . . $ `lib/grn_db.h:90:9`!(pat);
1345 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_NO_MEMORY_AVAILABLE,
1346 "[pat][key][put] failed to allocate memory for new key: <%.*s>: "
1347 "new offset:%" GRN_FMT_INT64Ucxx . . $ `lib/grn.h:370:11`! " key size:%u",
1348 name_size,
1349 name,
1350 res,
1351 len);
1352 return 0;
1353 }
1354 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(dest, key, len);
1355 }
1356 pat_update_total_key_sizecxx . . $ pat_update_total_key_size(ad3bb8074492b44e).(ctx, pat, grn_pat_total_key_sizecxx . . $ grn_pat_total_key_size(3626315f4fc444a).(ctx, pat) + len);
1357 return res;
1358 }
1359
1360 static inline void
1361 pat_node_set_key_positioncxx . . $ pat_node_set_key_position(51f1878679485402).(grn_patcxx . . $ grn_pat# *pat,
1362 pat_node_commoncxx . . $ pat_node_common# *node,
1363 uint64_tcxx . . $ uint64_t# position)
1364 {
1365 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
1366 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..keycxx . . $ $anonymous_type_d195c43ed9cfff57_2#key. = position;
1367 } else {
1368 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_1#key. = position;
1369 }
1370 }
1371
1372 /*
1373 * We must not call this function when pat_node_is_key_immediate() is true.
1374 * If pat_node_is_key_immediate() is true, this function does not return the
1375 * key offset but the value of the key directly.
1376 */
1377 static inline uint64_tcxx . . $ uint64_t#
1378 pat_node_get_key_offsetcxx . . $ pat_node_get_key_offset(c391a6707c7f46d8).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
1379 {
1380 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
1381 return node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..keycxx . . $ $anonymous_type_d195c43ed9cfff57_2#key.;
1382 } else {
1383 return node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_1#key.;
1384 }
1385 }
1386
1387 static inline void
1388 pat_node_set_key_offsetcxx . . $ pat_node_set_key_offset(51f1878679485402).(grn_patcxx . . $ grn_pat# *pat,
1389 pat_node_commoncxx . . $ pat_node_common# *node,
1390 uint64_tcxx . . $ uint64_t# key_offset)
1391 {
1392 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
1393 node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..keycxx . . $ $anonymous_type_d195c43ed9cfff57_2#key. = key_offset;
1394 } else {
1395 node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_1#key. = (uint32_tcxx . . $ uint32_t#)key_offset;
1396 }
1397 }
1398
1399 static inline uint64_tcxx . . $ uint64_t# *
1400 pat_node_get_key_addresscxx . . $ pat_node_get_key_address(72e7e8b769f3f5ed).(grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
1401 {
1402 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
1403 return &(node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..keycxx . . $ $anonymous_type_d195c43ed9cfff57_2#key.);
1404 } else {
1405 return (uint64_tcxx . . $ uint64_t# *)&(node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_1#key.);
1406 }
1407 }
1408
1409 static inline uint8_tcxx . . $ uint8_t# *
1410 pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
1411 {
1412 if (pat_node_is_key_immediatecxx . . $ pat_node_is_key_immediate(e829a7c3dd493304).(pat, node)) {
1413 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
1414 return (uint8_tcxx . . $ uint8_t# *)&(node->node_largecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node_large..keycxx . . $ $anonymous_type_d195c43ed9cfff57_2#key.);
1415 } else {
1416 return (uint8_tcxx . . $ uint8_t# *)&(node->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_3#node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_1#key.);
1417 }
1418 } else {
1419 uint8_tcxx . . $ uint8_t# *res;
1420 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
1421 KEY_ATcxx . . $ `lib/pat.c:1295:9`!(pat, node->node_large.key, res, 0);
1422 } else {
1423 KEY_ATcxx . . $ `lib/pat.c:1295:9`!(pat, node->node.key, res, 0);
1424 }
1425 return res;
1426 }
1427 }
1428
1429 static inline grn_rccxx . . $ grn_rc#
1430 pat_node_set_keycxx . . $ pat_node_set_key(54fc9b08b0515954).(grn_ctxcxx . . $ grn_ctx# *ctx,
1431 grn_patcxx . . $ grn_pat# *pat,
1432 pat_node_commoncxx . . $ pat_node_common# *node,
1433 const uint8_tcxx . . $ uint8_t# *key,
1434 uint32_tcxx . . $ uint32_t# len)
1435 {
1436 if (!key || !len) {
1437 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
1438 }
1439 pat_node_set_key_lengthcxx . . $ pat_node_set_key_length(17210a70016b3f10).(pat, node, len);
1440 if (pat_key_is_embeddablecxx . . $ pat_key_is_embeddable(fdc76bbf99fb1c5e).(pat, len)) {
1441 pat_node_set_key_immediate_oncxx . . $ pat_node_set_key_immediate_on(23a3c3d6b85e9ec6).(pat, node);
1442 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(pat_node_get_key_address(pat, node), key, len);
1443 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1444 } else {
1445 pat_node_set_key_immediate_offcxx . . $ pat_node_set_key_immediate_off(23a3c3d6b85e9ec6).(pat, node);
1446 pat_node_set_key_offsetcxx . . $ pat_node_set_key_offset(51f1878679485402).(pat, node, key_putcxx . . $ key_put(60c0e901dcd2d119).(ctx, pat, key, len));
1447 return ctx->rccxx . . $ _grn_ctx#rc.;
1448 }
1449 }
1450
1451 static inline void
1452 pat_node_set_shared_keycxx . . $ pat_node_set_shared_key(9345e9543d2f8e53).(grn_ctxcxx . . $ grn_ctx# *ctx,
1453 grn_patcxx . . $ grn_pat# *pat,
1454 pat_node_commoncxx . . $ pat_node_common# *node,
1455 uint32_tcxx . . $ uint32_t# key_size,
1456 uint32_tcxx . . $ uint32_t# shared_key_offset)
1457 {
1458 pat_node_set_key_immediate_offcxx . . $ pat_node_set_key_immediate_off(23a3c3d6b85e9ec6).(pat, node);
1459 pat_node_set_key_lengthcxx . . $ pat_node_set_key_length(17210a70016b3f10).(pat, node, key_size);
1460 pat_node_set_key_offsetcxx . . $ pat_node_set_key_offset(51f1878679485402).(pat, node, shared_key_offset);
1461 }
1462
1463 /* delinfo operation */
1464
1465 enumcxx . . $ $anonymous_type_d195c43ed9cfff57_8# {
1466 /* The delinfo is currently not used. */
1467 DL_EMPTYcxx . . $ DL_EMPTY. = 0,
1468 /*
1469 * stat->d refers to a deleting node (in a tree).
1470 * The deletion requires an additional operation.
1471 */
1472 DL_PHASE1cxx . . $ DL_PHASE1.,
1473 /*
1474 * stat->d refers to a deleted node (not in a tree).
1475 * The node is pending for safety.
1476 */
1477 DL_PHASE2cxx . . $ DL_PHASE2.
1478 };
1479
1480 static inline grn_idcxx . . $ grn_id# *
1481 grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(grn_ctxcxx . . $ grn_ctx# *ctx,
1482 grn_patcxx . . $ grn_pat# *pat,
1483 pat_node_commoncxx . . $ pat_node_common# *node,
1484 const uint8_tcxx . . $ uint8_t# *key,
1485 uint16_tcxx . . $ uint16_t# check,
1486 int32_tcxx . . $ int32_t# check_max)
1487 {
1488 if (PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check)) {
1489 /* check + 1: delete terminated flag and increment bit differences */
1490 if (check + 1 < check_max) {
1491 return pat_node_get_right_addresscxx . . $ pat_node_get_right_address(611d92fad5637a27).(pat, node);
1492 } else {
1493 return pat_node_get_left_addresscxx . . $ pat_node_get_left_address(611d92fad5637a27).(pat, node);
1494 }
1495 } else {
1496 return pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat, node, nth_bitcxx . . $ `lib/pat.c:1220:9`!(key, check));
1497 }
1498 }
1499
1500 static inline grn_pat_delinfocxx . . $ grn_pat_delinfo# *
1501 delinfo_searchcxx . . $ delinfo_search(340dd5cf2b90da95).(grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id, uint32_tcxx . . $ uint32_t# *index)
1502 {
1503 uint32_tcxx . . $ uint32_t# i;
1504 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di;
1505 for (i = (pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2.) & GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`!;
1506 i != pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del.;
1507 i = (i + 1) & GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`!) {
1508 di = &pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[i];
1509 if (di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. != DL_PHASE1cxx . . $ DL_PHASE1.) {
1510 continue;
1511 }
1512 if (di->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld. == id || di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. == id) {
1513 if (index) {
1514 *index = i;
1515 }
1516 return di;
1517 }
1518 }
1519 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1520 }
1521
1522 static inline uint32_tcxx . . $ uint32_t#
1523 delinfo_turn_1_precxx . . $ delinfo_turn_1_pre(c0bb13f07a06745c).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_pat_delinfocxx . . $ grn_pat_delinfo# **di)
1524 {
1525 *di = &pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del.];
1526 return (pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del. + 1) & GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`!;
1527 }
1528
1529 static inline void
1530 delinfo_turn_1_postcxx . . $ delinfo_turn_1_post(ce502570eadde858).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, uint32_tcxx . . $ uint32_t# next_delete_info_index)
1531 {
1532 pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del. = next_delete_info_index;
1533 }
1534
1535 static inline grn_rccxx . . $ grn_rc#
1536 delinfo_turn_2_internalcxx . . $ delinfo_turn_2_internal(8ef28dccac5628c).(grn_ctxcxx . . $ grn_ctx# *ctx,
1537 grn_patcxx . . $ grn_pat# *pat,
1538 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di,
1539 pat_node_commoncxx . . $ pat_node_common# *ln,
1540 pat_node_commoncxx . . $ pat_node_common# *dn)
1541 {
1542 grn_idcxx . . $ grn_id# d = di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d.;
1543 grn_idcxx . . $ grn_id# *p = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1544 pat_node_set_deleting_offcxx . . $ pat_node_set_deleting_off(23a3c3d6b85e9ec6).(pat, ln);
1545 pat_node_set_deleting_offcxx . . $ pat_node_set_deleting_off(23a3c3d6b85e9ec6).(pat, dn);
1546 {
1547 grn_idcxx . . $ grn_id# *p0;
1548 pat_node_commoncxx . . $ pat_node_common# *rn;
1549 int32_tcxx . . $ int32_t# c0 = -1, c;
1550 int32_tcxx . . $ int32_t# check_max =
1551 PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(pat_node_get_key_length(pat, dn), 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
1552 const uint8_tcxx . . $ uint8_t# *key = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, dn);
1553 if (!key) {
1554 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
1555 }
1556 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, rn);
1557 p0 = pat_node_get_right_addresscxx . . $ pat_node_get_right_address(611d92fad5637a27).(pat, rn);
1558 for (;;) {
1559 grn_idcxx . . $ grn_id# r = *p0;
1560 if (!r) {
1561 break;
1562 }
1563 if (r == d) {
1564 p = p0;
1565 break;
1566 }
1567 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, r, rn);
1568 if (!rn) {
1569 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
1570 }
1571 c = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, rn);
1572 if (c <= c0 || check_max <= c) {
1573 break;
1574 }
1575 p0 = grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, pat, rn, key, c, check_max);
1576 c0 = c;
1577 }
1578 }
1579 if (p) {
1580 pat_node_set_checkcxx . . $ pat_node_set_check(18b96d60ead2a18e).(pat, ln, pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, dn));
1581 pat_node_set_rightcxx . . $ pat_node_set_right(17210a70016b3f10).(pat, ln, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, dn));
1582 pat_node_set_leftcxx . . $ pat_node_set_left(17210a70016b3f10).(pat, ln, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, dn));
1583 *p = di->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld.;
1584 } else {
1585 /* debug */
1586 uint32_tcxx . . $ uint32_t# j;
1587 grn_idcxx . . $ grn_id# dd;
1588 grn_pat_delinfocxx . . $ grn_pat_delinfo# *ddi;
1589 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_DEBUG, "failed to find d=%d", d);
1590 for (j = (pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2. + 1) & GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`!;
1591 j != pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del.;
1592 j = (j + 1) & GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`!) {
1593 ddi = &pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[j];
1594 if (ddi->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. != DL_PHASE1cxx . . $ DL_PHASE1.) {
1595 continue;
1596 }
1597 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, ddi->ld, ln);
1598 if (!ln) {
1599 continue;
1600 }
1601 if (!(dd = ddi->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d.)) {
1602 continue;
1603 }
1604 if (d == ddi->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld.) {
1605 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_DEBUG, "found!!!, d(%d) become ld of (%d)", d, dd);
1606 }
1607 }
1608 /* debug */
1609 }
1610 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE2cxx . . $ DL_PHASE2.;
1611 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = d;
1612 // grn_log("delinfo_turn_2< di->d=%d di->ld=%d", di->d, di->ld);
1613 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1614 }
1615
1616 static inline grn_rccxx . . $ grn_rc#
1617 delinfo_turn_2cxx . . $ delinfo_turn_2(399d0bcfe141f692).(grn_ctxcxx . . $ grn_ctx# *ctx,
1618 grn_patcxx . . $ grn_pat# *pat,
1619 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *base_wal_data,
1620 uint32_tcxx . . $ uint32_t# di_index)
1621 {
1622 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di = &pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[di_index];
1623 pat_node_commoncxx . . $ pat_node_common# *ln, *dn;
1624 // grn_log("delinfo_turn_2> di->d=%d di->ld=%d stat=%d", di->d, di->ld,
1625 // di->stat);
1626 if (di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. != DL_PHASE1cxx . . $ DL_PHASE1.) {
1627 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1628 }
1629 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, di->ld, ln);
1630 if (!ln) {
1631 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
1632 }
1633 grn_idcxx . . $ grn_id# d = di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d.;
1634 if (!d) {
1635 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
1636 }
1637 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, d, dn);
1638 if (!dn) {
1639 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
1640 }
1641 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# wal_data = *base_wal_data;
1642 wal_data.eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_DELETE_INFO_PHASE2cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE2.;
1643 wal_data.record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = d;
1644 wal_data.key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size. = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, dn);
1645 wal_data.checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check. = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, dn);
1646 wal_data.parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id. = di->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld.;
1647 wal_data.left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#left_record_id. = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, dn);
1648 wal_data.right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#right_record_id. = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, dn);
1649 wal_data.delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase2_index. = di_index;
1650 if (grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &wal_data) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1651 return ctx->rccxx . . $ _grn_ctx#rc.;
1652 }
1653 grn_rccxx . . $ grn_rc# rc = delinfo_turn_2_internalcxx . . $ delinfo_turn_2_internal(8ef28dccac5628c).(ctx, pat, di, ln, dn);
1654 if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1655 pat->headercxx . . $ _grn_pat#header.->wal_idcxx . . $ grn_pat_header#wal_id. = wal_data.wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.;
1656 }
1657 return rc;
1658 }
1659
1660 static inline void
1661 delinfo_turn_2_postcxx . . $ delinfo_turn_2_post(ff189d7ae511a139).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
1662 {
1663 pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2. = (pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2. + 1) & GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`!;
1664 }
1665
1666 static inline uint32_tcxx . . $ uint32_t#
1667 delinfo_compute_storage_sizecxx . . $ delinfo_compute_storage_size(321b98b494583f7).(grn_ctxcxx . . $ grn_ctx# *ctx,
1668 grn_patcxx . . $ grn_pat# *pat,
1669 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di,
1670 pat_node_commoncxx . . $ pat_node_common# *dn)
1671 {
1672 if (di->sharedcxx . . $ $anonymous_type_3cbf03c15cd18141_0#shared.) {
1673 return 0;
1674 } else {
1675 if (pat_node_is_key_immediatecxx . . $ pat_node_is_key_immediate(e829a7c3dd493304).(pat, dn)) {
1676 return 0;
1677 } else {
1678 return pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, dn);
1679 }
1680 }
1681 }
1682
1683 static inline grn_rccxx . . $ grn_rc#
1684 delinfo_turn_3_internalcxx . . $ delinfo_turn_3_internal(1276c9ce42aee9ff).(grn_ctxcxx . . $ grn_ctx# *ctx,
1685 grn_patcxx . . $ grn_pat# *pat,
1686 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di,
1687 pat_node_commoncxx . . $ pat_node_common# *dn)
1688 {
1689 if (di->sharedcxx . . $ $anonymous_type_3cbf03c15cd18141_0#shared.) {
1690 pat_node_set_key_immediate_oncxx . . $ pat_node_set_key_immediate_on(23a3c3d6b85e9ec6).(pat, dn);
1691 }
1692 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_EMPTYcxx . . $ DL_EMPTY.;
1693 // dn->lr[1] = GRN_PAT_DELETED;
1694 uint32_tcxx . . $ uint32_t# size = delinfo_compute_storage_sizecxx . . $ delinfo_compute_storage_size(321b98b494583f7).(ctx, pat, di, dn);
1695 pat_node_set_leftcxx . . $ pat_node_set_left(17210a70016b3f10).(pat, dn, pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[size]);
1696 pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[size] = di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d.;
1697 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1698 }
1699
1700 static inline grn_rccxx . . $ grn_rc#
1701 delinfo_turn_3cxx . . $ delinfo_turn_3(399d0bcfe141f692).(grn_ctxcxx . . $ grn_ctx# *ctx,
1702 grn_patcxx . . $ grn_pat# *pat,
1703 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *base_wal_data,
1704 uint32_tcxx . . $ uint32_t# di_index)
1705 {
1706 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di = &pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[di_index];
1707 pat_node_commoncxx . . $ pat_node_common# *dn;
1708 if (di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. != DL_PHASE2cxx . . $ DL_PHASE2.) {
1709 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1710 }
1711 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, di->d, dn);
1712 if (!dn) {
1713 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
1714 }
1715 uint32_tcxx . . $ uint32_t# size = delinfo_compute_storage_sizecxx . . $ delinfo_compute_storage_size(321b98b494583f7).(ctx, pat, di, dn);
1716 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# wal_data = *base_wal_data;
1717 wal_data.eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_DELETE_INFO_PHASE3cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE3.;
1718 wal_data.record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d.;
1719 wal_data.is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_6#is_shared. = di->sharedcxx . . $ $anonymous_type_3cbf03c15cd18141_0#shared.;
1720 wal_data.next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#next_garbage_record_id. = pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[size];
1721 wal_data.delete_info_phase3_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase3_index. = di_index;
1722 if (grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &wal_data) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1723 return ctx->rccxx . . $ _grn_ctx#rc.;
1724 }
1725 grn_rccxx . . $ grn_rc# rc = delinfo_turn_3_internalcxx . . $ delinfo_turn_3_internal(1276c9ce42aee9ff).(ctx, pat, di, dn);
1726 if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1727 pat->headercxx . . $ _grn_pat#header.->wal_idcxx . . $ grn_pat_header#wal_id. = wal_data.wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.;
1728 }
1729 return rc;
1730 }
1731
1732 static inline void
1733 delinfo_turn_3_postcxx . . $ delinfo_turn_3_post(ff189d7ae511a139).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
1734 {
1735 pat->headercxx . . $ _grn_pat#header.->curr_del3cxx . . $ grn_pat_header#curr_del3. = (pat->headercxx . . $ _grn_pat#header.->curr_del3cxx . . $ grn_pat_header#curr_del3. + 1) & GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`!;
1736 }
1737
1738 static inline grn_pat_delinfocxx . . $ grn_pat_delinfo# *
1739 delinfo_newcxx . . $ delinfo_new(b403ac74ccc7a23f).(grn_ctxcxx . . $ grn_ctx# *ctx,
1740 grn_patcxx . . $ grn_pat# *pat,
1741 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *base_wal_data)
1742 {
1743 base_wal_data->delete_info_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_index. = pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del.;
1744 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# wal_data = *base_wal_data;
1745 wal_data.eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_DELETE_INFO_PHASE1cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE1.;
1746 wal_data.delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase1_index. = pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del.;
1747 if (grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &wal_data) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1748 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1749 }
1750 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di;
1751 uint32_tcxx . . $ uint32_t# next_delete_info_index = delinfo_turn_1_precxx . . $ delinfo_turn_1_pre(c0bb13f07a06745c).(ctx, pat, &di);
1752 di->sharedcxx . . $ $anonymous_type_3cbf03c15cd18141_0#shared. = wal_data.is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_6#is_shared.;
1753 int gap =
1754 ((next_delete_info_index + GRN_PAT_NDELINFOScxx . . $ `lib/grn_pat.h:52:9`! - pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2.) &
1755 GRN_PAT_MDELINFOScxx . . $ `lib/pat.c:56:9`!) -
1756 (GRN_PAT_NDELINFOScxx . . $ `lib/grn_pat.h:52:9`! / 2);
1757 while (gap-- > 0) {
1758 if (delinfo_turn_2cxx . . $ delinfo_turn_2(399d0bcfe141f692).(ctx, pat, base_wal_data, pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2.)) {
1759 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
1760 GRN_LOG_CRIT,
1761 "d2 failed: %d",
1762 pat->header->delinfos[pat->header->curr_del2].ld);
1763 }
1764 delinfo_turn_2_postcxx . . $ delinfo_turn_2_post(ff189d7ae511a139).(ctx, pat);
1765 }
1766 if (next_delete_info_index == pat->headercxx . . $ _grn_pat#header.->curr_del3cxx . . $ grn_pat_header#curr_del3.) {
1767 if (delinfo_turn_3cxx . . $ delinfo_turn_3(399d0bcfe141f692).(ctx, pat, base_wal_data, pat->headercxx . . $ _grn_pat#header.->curr_del3cxx . . $ grn_pat_header#curr_del3.)) {
1768 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
1769 GRN_LOG_CRIT,
1770 "d3 failed: %d",
1771 pat->header->delinfos[pat->header->curr_del3].ld);
1772 }
1773 delinfo_turn_3_postcxx . . $ delinfo_turn_3_post(ff189d7ae511a139).(ctx, pat);
1774 }
1775 delinfo_turn_1_postcxx . . $ delinfo_turn_1_post(ce502570eadde858).(ctx, pat, next_delete_info_index);
1776 /* We can't do this because this overwrites WAL ID for phase2 and phase3. */
1777 /* pat->header->wal_id = wal_data.wal_id; */
1778 return di;
1779 }
1780
1781 /* pat operation */
1782
1783 static inline uint32_tcxx . . $ uint32_t#
1784 compute_needed_bitscxx . . $ compute_needed_bits(2141b656ce2cc063).(uint32_tcxx . . $ uint32_t# size_in_byte)
1785 {
1786 uint32_tcxx . . $ uint32_t# needed_bits;
1787 for (needed_bits = 0; (size_t)(1 << needed_bits) < size_in_byte;
1788 needed_bits++) {
1789 /* nop */
1790 }
1791 return needed_bits;
1792 }
1793
1794 static inline grn_patcxx . . $ grn_pat# *
1795 _grn_pat_createcxx . . $ _grn_pat_create(594a7f81b5682355).(grn_ctxcxx . . $ grn_ctx# *ctx,
1796 grn_patcxx . . $ grn_pat# *pat,
1797 const char *path,
1798 uint32_tcxx . . $ uint32_t# key_size,
1799 uint32_tcxx . . $ uint32_t# value_size,
1800 uint32_tcxx . . $ uint32_t# flags)
1801 {
1802 grn_iocxx . . $ grn_io# *io;
1803 pat_node_commoncxx . . $ pat_node_common# *node0;
1804 struct grn_pat_headercxx . . $ grn_pat_header# *header;
1805 grn_encodingcxx . . $ grn_encoding# encoding = ctx->encodingcxx . . $ _grn_ctx#encoding.;
1806 {
1807 grn_io_array_speccxx . . $ grn_io_array_spec# array_spec[3];
1808 uint32_tcxx . . $ uint32_t# pat_entry_size, needed_bits_of_pat_entry;
1809 array_spec[SEGMENT_KEYcxx . . $ SEGMENT_KEY.].w_of_elementcxx . . $ _grn_io_array_spec#w_of_element. = 0;
1810 if (flags & GRN_OBJ_KEY_LARGEcxx . . $ `include/groonga/groonga.h:831:9`!) {
1811 array_spec[SEGMENT_KEYcxx . . $ SEGMENT_KEY.].max_n_segmentscxx . . $ _grn_io_array_spec#max_n_segments. = GRN_PAT_MAX_N_SEGMENTS_LARGEcxx . . $ `lib/pat.c:51:9`!;
1812 pat_entry_size = sizeof(pat_node_largecxx . . $ pat_node_large#);
1813 } else {
1814 array_spec[SEGMENT_KEYcxx . . $ SEGMENT_KEY.].max_n_segmentscxx . . $ _grn_io_array_spec#max_n_segments. = GRN_PAT_MAX_N_SEGMENTScxx . . $ `lib/pat.c:48:9`!;
1815 pat_entry_size = sizeof(pat_nodecxx . . $ pat_node#);
1816 }
1817 needed_bits_of_pat_entry = compute_needed_bitscxx . . $ compute_needed_bits(2141b656ce2cc063).(pat_entry_size);
1818 array_spec[SEGMENT_PATcxx . . $ SEGMENT_PAT.].w_of_elementcxx . . $ _grn_io_array_spec#w_of_element. = needed_bits_of_pat_entry;
1819 array_spec[SEGMENT_PATcxx . . $ SEGMENT_PAT.].max_n_segmentscxx . . $ _grn_io_array_spec#max_n_segments. =
1820 1 << (GRN_ID_MAX_IN_BITcxx . . $ `lib/grn.h:758:9`! -
1821 (GRN_PAT_SEGMENT_SIZE_IN_BITcxx . . $ `lib/pat.c:60:9`! - needed_bits_of_pat_entry));
1822 uint32_tcxx . . $ uint32_t# sis_entry_size;
1823 if (flags & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
1824 sis_entry_size = sizeof(sis_nodecxx . . $ sis_node#) + value_size;
1825 } else {
1826 sis_entry_size = value_size;
1827 }
1828 uint32_tcxx . . $ uint32_t# needed_bits_of_sis_entry = compute_needed_bitscxx . . $ compute_needed_bits(2141b656ce2cc063).(sis_entry_size);
1829 array_spec[SEGMENT_SIScxx . . $ SEGMENT_SIS.].w_of_elementcxx . . $ _grn_io_array_spec#w_of_element. = needed_bits_of_sis_entry;
1830 array_spec[SEGMENT_SIScxx . . $ SEGMENT_SIS.].max_n_segmentscxx . . $ _grn_io_array_spec#max_n_segments. =
1831 1 << (GRN_ID_MAX_IN_BITcxx . . $ `lib/grn.h:758:9`! -
1832 (GRN_PAT_SEGMENT_SIZE_IN_BITcxx . . $ `lib/pat.c:60:9`! - needed_bits_of_sis_entry));
1833 io = grn_io_create_with_arraycxx . . $ grn_io_create_with_array(adb444cbd60a11cc).(ctx,
1834 path,
1835 sizeof(struct grn_pat_headercxx . . $ grn_pat_header#),
1836 GRN_PAT_SEGMENT_SIZEcxx . . $ `lib/pat.c:37:9`!,
1837 GRN_IO_AUTOcxx . . $ GRN_IO_AUTO.,
1838 3,
1839 array_spec);
1840 }
1841 if (!io) {
1842 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1843 }
1844 if (encoding == GRN_ENC_DEFAULTcxx . . $ GRN_ENC_DEFAULT.) {
1845 encoding = grn_gctxcxx . . $ grn_gctx..encodingcxx . . $ _grn_ctx#encoding.;
1846 }
1847 header = grn_io_headercxx . . $ grn_io_header(611b9b393b7178f5).(io);
1848 grn_io_set_typecxx . . $ grn_io_set_type(d505e6e1d36b3afe).(io, GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!);
1849 header->flagscxx . . $ grn_pat_header#flags. = flags;
1850 header->encodingcxx . . $ grn_pat_header#encoding. = encoding;
1851 header->key_sizecxx . . $ grn_pat_header#key_size. = key_size;
1852 header->value_sizecxx . . $ grn_pat_header#value_size. = value_size;
1853 header->n_entriescxx . . $ grn_pat_header#n_entries. = 0;
1854 header->curr_reccxx . . $ grn_pat_header#curr_rec. = 0;
1855 header->curr_keycxx . . $ grn_pat_header#curr_key. = 0;
1856 header->curr_key_largecxx . . $ grn_pat_header#curr_key_large. = 0;
1857 header->curr_delcxx . . $ grn_pat_header#curr_del. = 0;
1858 header->curr_del2cxx . . $ grn_pat_header#curr_del2. = 0;
1859 header->curr_del3cxx . . $ grn_pat_header#curr_del3. = 0;
1860 header->n_garbagescxx . . $ grn_pat_header#n_garbages. = 0;
1861 header->tokenizercxx . . $ grn_pat_header#tokenizer. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
1862 grn_table_modules_initcxx . . $ grn_table_modules_init(cda3a5f3c2e53c6b).(ctx, &(pat->normalizerscxx . . $ _grn_pat#normalizers.));
1863 if (header->flagscxx . . $ grn_pat_header#flags. & GRN_OBJ_KEY_NORMALIZEcxx . . $ `include/groonga/groonga.h:718:9`!) {
1864 header->flagscxx . . $ grn_pat_header#flags. &= ~GRN_OBJ_KEY_NORMALIZEcxx . . $ `include/groonga/groonga.h:718:9`!;
1865 header->normalizercxx . . $ grn_pat_header#normalizer. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
1866 grn_objcxx . . $ grn_obj# *normalizer = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, GRN_NORMALIZER_AUTO_NAMEcxx . . $ `lib/grn_normalizer.h:32:9`!, -1);
1867 grn_table_modules_addcxx . . $ grn_table_modules_add(99eba0d3a8372d65).(ctx, &(pat->normalizerscxx . . $ _grn_pat#normalizers.), normalizer);
1868 } else {
1869 header->normalizercxx . . $ grn_pat_header#normalizer. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
1870 }
1871 header->truncatedcxx . . $ grn_pat_header#truncated. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1872 grn_table_modules_initcxx . . $ grn_table_modules_init(cda3a5f3c2e53c6b).(ctx, &(pat->token_filterscxx . . $ _grn_pat#token_filters.));
1873 GRN_PTR_INITcxx . . $ `include/groonga/groonga.h:2869:9`!(&(pat->token_filter_procs), GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
1874 grn_table_modules_initcxx . . $ grn_table_modules_init(cda3a5f3c2e53c6b).(ctx, &(pat->extractorscxx . . $ _grn_pat#extractors.));
1875 pat->iocxx . . $ _grn_pat#io. = io;
1876 pat->headercxx . . $ _grn_pat#header. = header;
1877 pat->key_sizecxx . . $ _grn_pat#key_size. = key_size;
1878 pat->value_sizecxx . . $ _grn_pat#value_size. = value_size;
1879 grn_table_module_initcxx . . $ grn_table_module_init(a126267325ea3924).(ctx, &(pat->tokenizercxx . . $ _grn_pat#tokenizer.), GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
1880 pat->encodingcxx . . $ _grn_pat#encoding. = encoding;
1881 pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. = header->flagscxx . . $ grn_pat_header#flags.;
1882 if (!(node0 = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, 0))) {
1883 grn_io_closecxx . . $ grn_io_close(117c07c672382ce3).(ctx, io);
1884 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1885 }
1886 pat_node_set_rightcxx . . $ pat_node_set_right(17210a70016b3f10).(pat, node0, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
1887 pat_node_set_leftcxx . . $ pat_node_set_left(17210a70016b3f10).(pat, node0, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
1888 pat_node_set_key_offsetcxx . . $ pat_node_set_key_offset(51f1878679485402).(pat, node0, 0);
1889 return pat;
1890 }
1891
1892 grn_patcxx . . $ grn_pat# *
1893 grn_pat_createcxx . . $ grn_pat_create(c536c63c37081863).(grn_ctxcxx . . $ grn_ctx# *ctx,
1894 const char *path,
1895 uint32_tcxx . . $ uint32_t# key_size,
1896 uint32_tcxx . . $ uint32_t# value_size,
1897 uint32_tcxx . . $ uint32_t# flags)
1898 {
1899 grn_patcxx . . $ grn_pat# *pat;
1900 if (!(pat = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_pat)))) {
1901 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1902 }
1903 GRN_DB_OBJ_SET_TYPEcxx . . $ `lib/grn_ctx.h:195:9`!(pat, GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!);
1904 if (!_grn_pat_createcxx . . $ _grn_pat_create(594a7f81b5682355).(ctx, pat, path, key_size, value_size, flags)) {
1905 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(pat);
1906 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1907 }
1908 pat->cachecxx . . $ _grn_pat#cache. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1909 pat->cache_sizecxx . . $ _grn_pat#cache_size. = 0;
1910 pat->is_dirtycxx . . $ _grn_pat#is_dirty. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
1911 CRITICAL_SECTION_INITcxx . . $ `lib/grn.h:226:11`!(pat->lock);
1912 return pat;
1913 }
1914
1915 /*
1916 grn_pat_cache_enable() and grn_pat_cache_disable() are not thread-safe.
1917 So far, they can be used only from single threaded programs.
1918 */
1919
1920 grn_rccxx . . $ grn_rc#
1921 grn_pat_cache_enablecxx . . $ grn_pat_cache_enable(39634e5b6eb066c6).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, uint32_tcxx . . $ uint32_t# cache_size)
1922 {
1923 grn_idcxx . . $ grn_id# *cache;
1924
1925 if (cache_size & (cache_size - 1)) {
1926 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT,
1927 "[pat][cache][enable] size must be a power of two: %u",
1928 cache_size);
1929 return ctx->rccxx . . $ _grn_ctx#rc.;
1930 }
1931 if (cache_size <= pat->cache_sizecxx . . $ _grn_pat#cache_size.) {
1932 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1933 }
1934 if (!(cache = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(cache_size * sizeof(grn_id)))) {
1935 return ctx->rccxx . . $ _grn_ctx#rc.;
1936 }
1937 if (pat->cachecxx . . $ _grn_pat#cache.) {
1938 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(pat->cache);
1939 }
1940 pat->cachecxx . . $ _grn_pat#cache. = cache;
1941 pat->cache_sizecxx . . $ _grn_pat#cache_size. = cache_size;
1942
1943 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
1944 }
1945
1946 void
1947 grn_pat_cache_disablecxx . . $ grn_pat_cache_disable(ff189d7ae511a139).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
1948 {
1949 if (pat->cachecxx . . $ _grn_pat#cache.) {
1950 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(pat->cache);
1951 pat->cache_sizecxx . . $ _grn_pat#cache_size. = 0;
1952 pat->cachecxx . . $ _grn_pat#cache. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1953 }
1954 }
1955
1956 grn_patcxx . . $ grn_pat# *
1957 grn_pat_opencxx . . $ grn_pat_open(241ef12f9e92a2a).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path)
1958 {
1959 grn_iocxx . . $ grn_io# *io;
1960 grn_patcxx . . $ grn_pat# *pat;
1961 pat_node_commoncxx . . $ pat_node_common# *node0;
1962 struct grn_pat_headercxx . . $ grn_pat_header# *header;
1963 uint32_tcxx . . $ uint32_t# io_type;
1964 io = grn_io_opencxx . . $ grn_io_open(f25995ba89d9e599).(ctx, path, GRN_IO_AUTOcxx . . $ GRN_IO_AUTO.);
1965 if (!io) {
1966 grn_rccxx . . $ grn_rc# rc = ctx->rccxx . . $ _grn_ctx#rc.;
1967 if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
1968 rc = GRN_UNKNOWN_ERRORcxx . . $ GRN_UNKNOWN_ERROR.;
1969 }
1970 ERRcxx . . $ `lib/grn_error.h:156:9`!(rc,
1971 "[pat][open] failed to open grn_io: <%s>",
1972 path ? path : "(temporary)");
1973 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1974 }
1975 header = grn_io_headercxx . . $ grn_io_header(611b9b393b7178f5).(io);
1976 io_type = grn_io_get_typecxx . . $ grn_io_get_type(ee95b3f473df551b).(io);
1977 if (io_type != GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!) {
1978 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_FORMAT,
1979 "[pat] file type must be %#04x: <%#04x>: <%s>",
1980 GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!,
1981 io_type,
1982 path ? path : "(temporary)");
1983 grn_io_closecxx . . $ grn_io_close(117c07c672382ce3).(ctx, io);
1984 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1985 }
1986 if (!(pat = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_pat)))) {
1987 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_NO_MEMORY_AVAILABLE,
1988 "[pat][open] failed to allocate memory: <%s>",
1989 path ? path : "(temporary)");
1990 grn_io_closecxx . . $ grn_io_close(117c07c672382ce3).(ctx, io);
1991 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
1992 }
1993 GRN_DB_OBJ_SET_TYPEcxx . . $ `lib/grn_ctx.h:195:9`!(pat, GRN_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:896:9`!);
1994 pat->iocxx . . $ _grn_pat#io. = io;
1995 pat->headercxx . . $ _grn_pat#header. = header;
1996 pat->key_sizecxx . . $ _grn_pat#key_size. = header->key_sizecxx . . $ grn_pat_header#key_size.;
1997 pat->value_sizecxx . . $ _grn_pat#value_size. = header->value_sizecxx . . $ grn_pat_header#value_size.;
1998 pat->encodingcxx . . $ _grn_pat#encoding. = header->encodingcxx . . $ grn_pat_header#encoding.;
1999 grn_table_module_initcxx . . $ grn_table_module_init(a126267325ea3924).(ctx, &(pat->tokenizercxx . . $ _grn_pat#tokenizer.), header->tokenizercxx . . $ grn_pat_header#tokenizer.);
2000 grn_table_modules_initcxx . . $ grn_table_modules_init(cda3a5f3c2e53c6b).(ctx, &(pat->normalizerscxx . . $ _grn_pat#normalizers.));
2001 if (header->flagscxx . . $ grn_pat_header#flags. & GRN_OBJ_KEY_NORMALIZEcxx . . $ `include/groonga/groonga.h:718:9`!) {
2002 header->flagscxx . . $ grn_pat_header#flags. &= ~GRN_OBJ_KEY_NORMALIZEcxx . . $ `include/groonga/groonga.h:718:9`!;
2003 header->normalizercxx . . $ grn_pat_header#normalizer. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2004 grn_objcxx . . $ grn_obj# *normalizer = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, GRN_NORMALIZER_AUTO_NAMEcxx . . $ `lib/grn_normalizer.h:32:9`!, -1);
2005 grn_table_modules_addcxx . . $ grn_table_modules_add(99eba0d3a8372d65).(ctx, &(pat->normalizerscxx . . $ _grn_pat#normalizers.), normalizer);
2006 } else if (header->normalizercxx . . $ grn_pat_header#normalizer. != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2007 grn_objcxx . . $ grn_obj# *normalizer = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, header->normalizercxx . . $ grn_pat_header#normalizer.);
2008 grn_table_modules_addcxx . . $ grn_table_modules_add(99eba0d3a8372d65).(ctx, &(pat->normalizerscxx . . $ _grn_pat#normalizers.), normalizer);
2009 }
2010 grn_table_modules_initcxx . . $ grn_table_modules_init(cda3a5f3c2e53c6b).(ctx, &(pat->token_filterscxx . . $ _grn_pat#token_filters.));
2011 GRN_PTR_INITcxx . . $ `include/groonga/groonga.h:2869:9`!(&(pat->token_filter_procs), GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
2012 grn_table_modules_initcxx . . $ grn_table_modules_init(cda3a5f3c2e53c6b).(ctx, &(pat->extractorscxx . . $ _grn_pat#extractors.));
2013 pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. = header->flagscxx . . $ grn_pat_header#flags.;
2014 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node0);
2015 if (!node0) {
2016 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_FORMAT,
2017 "[pat][open] failed to get the root node: <%s>",
2018 path ? path : "(temporary)");
2019 grn_io_closecxx . . $ grn_io_close(117c07c672382ce3).(ctx, io);
2020 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(pat);
2021 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
2022 }
2023 pat->cachecxx . . $ _grn_pat#cache. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
2024 pat->cache_sizecxx . . $ _grn_pat#cache_size. = 0;
2025 pat->is_dirtycxx . . $ _grn_pat#is_dirty. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2026 CRITICAL_SECTION_INITcxx . . $ `lib/grn.h:226:11`!(pat->lock);
2027 return pat;
2028 }
2029
2030 /*
2031 * grn_pat_error_if_truncated() logs an error and returns its error code if
2032 * a pat is truncated by another process.
2033 * Otherwise, this function returns GRN_SUCCESS.
2034 * Note that `ctx` and `pat` must be valid.
2035 *
2036 * FIXME: A pat should be reopened if possible.
2037 */
2038 static grn_rccxx . . $ grn_rc#
2039 grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
2040 {
2041 if (pat->headercxx . . $ _grn_pat#header.->truncatedcxx . . $ grn_pat_header#truncated.) {
2042 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_FILE_CORRUPT,
2043 "pat is truncated, please unmap or reopen the database");
2044 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
2045 }
2046 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
2047 }
2048
2049 static void
2050 grn_pat_close_token_filterscxx . . $ grn_pat_close_token_filters(ff189d7ae511a139).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
2051 {
2052 grn_table_modules_fincxx . . $ grn_table_modules_fin(cda3a5f3c2e53c6b).(ctx, &(pat->token_filterscxx . . $ _grn_pat#token_filters.));
2053 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &(pat->token_filter_procs));
2054 }
2055
2056 grn_rccxx . . $ grn_rc#
2057 grn_pat_closecxx . . $ grn_pat_close(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
2058 {
2059 grn_rccxx . . $ grn_rc# rc;
2060
2061 CRITICAL_SECTION_FINcxx . . $ `lib/grn.h:229:11`!(pat->lock);
2062
2063 if (pat->is_dirtycxx . . $ _grn_pat#is_dirty.) {
2064 uint32_tcxx . . $ uint32_t# n_dirty_opens;
2065 GRN_ATOMIC_ADD_EXcxx . . $ `lib/grn.h:420:11`!(&(pat->header->n_dirty_opens), -1, n_dirty_opens);
2066 }
2067
2068 if (pat->iocxx . . $ _grn_pat#io.->pathcxx . . $ _grn_io#path.[0] != '\0' &&
2069 GRN_CTX_GET_WAL_ROLEcxx . . $ `lib/grn_ctx_impl.h:233:9`!(ctx) == GRN_WAL_ROLE_PRIMARYcxx . . $ GRN_WAL_ROLE_PRIMARY.) {
2070 grn_obj_flushcxx . . $ grn_obj_flush(4865d068a46d0f83).(ctx, (grn_objcxx . . $ grn_obj# *)pat);
2071 }
2072 rc = grn_io_closecxx . . $ grn_io_close(117c07c672382ce3).(ctx, pat->iocxx . . $ _grn_pat#io.);
2073 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2074 ERRcxx . . $ `lib/grn_error.h:156:9`!(rc, "[pat][close] failed to close IO");
2075 }
2076 grn_table_module_fincxx . . $ grn_table_module_fin(ca6eb248c4ceb5d7).(ctx, &(pat->tokenizercxx . . $ _grn_pat#tokenizer.));
2077 grn_table_modules_fincxx . . $ grn_table_modules_fin(cda3a5f3c2e53c6b).(ctx, &(pat->normalizerscxx . . $ _grn_pat#normalizers.));
2078 grn_pat_close_token_filterscxx . . $ grn_pat_close_token_filters(ff189d7ae511a139).(ctx, pat);
2079 grn_table_modules_fincxx . . $ grn_table_modules_fin(cda3a5f3c2e53c6b).(ctx, &(pat->extractorscxx . . $ _grn_pat#extractors.));
2080 if (pat->cachecxx . . $ _grn_pat#cache.) {
2081 grn_pat_cache_disablecxx . . $ grn_pat_cache_disable(ff189d7ae511a139).(ctx, pat);
2082 }
2083 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(pat);
2084
2085 return rc;
2086 }
2087
2088 grn_rccxx . . $ grn_rc#
2089 grn_pat_removecxx . . $ grn_pat_remove(cae1c943be750b4c).(grn_ctxcxx . . $ grn_ctx# *ctx, const char *path)
2090 {
2091 if (!path) {
2092 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "path is null");
2093 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
2094 }
2095 grn_rccxx . . $ grn_rc# wal_rc = grn_wal_removecxx . . $ grn_wal_remove(acfed50c3cac5568).(ctx, path, "[pat]");
2096 grn_rccxx . . $ grn_rc# io_rc = grn_io_removecxx . . $ grn_io_remove(cae1c943be750b4c).(ctx, path);
2097 grn_rccxx . . $ grn_rc# rc = wal_rc;
2098 if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2099 rc = io_rc;
2100 }
2101 return rc;
2102 }
2103
2104 grn_rccxx . . $ grn_rc#
2105 grn_pat_truncatecxx . . $ grn_pat_truncate(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
2106 {
2107 grn_rccxx . . $ grn_rc# rc;
2108 const char *io_path;
2109 char *path;
2110 uint32_tcxx . . $ uint32_t# key_size, value_size, flags;
2111
2112 rc = grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat);
2113 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2114 return rc;
2115 }
2116 if ((io_path = grn_io_pathcxx . . $ grn_io_path(53b2e212b3c13636).(pat->iocxx . . $ _grn_pat#io.)) && *io_path != '\0') {
2117 if (!(path = GRN_STRDUPcxx . . $ `lib/grn_alloc.h:44:9`!(io_path))) {
2118 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_NO_MEMORY_AVAILABLE, "cannot duplicate path: <%s>", io_path);
2119 return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.;
2120 }
2121 } else {
2122 path = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
2123 }
2124 key_size = pat->key_sizecxx . . $ _grn_pat#key_size.;
2125 value_size = pat->value_sizecxx . . $ _grn_pat#value_size.;
2126 flags = pat->headercxx . . $ _grn_pat#header.->flagscxx . . $ grn_pat_header#flags.;
2127 if (path) {
2128 pat->headercxx . . $ _grn_pat#header.->truncatedcxx . . $ grn_pat_header#truncated. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
2129 }
2130 if ((rc = grn_io_closecxx . . $ grn_io_close(117c07c672382ce3).(ctx, pat->iocxx . . $ _grn_pat#io.))) {
2131 goto exit;
2132 }
2133 grn_table_module_fincxx . . $ grn_table_module_fin(ca6eb248c4ceb5d7).(ctx, &(pat->tokenizercxx . . $ _grn_pat#tokenizer.));
2134 grn_table_modules_fincxx . . $ grn_table_modules_fin(cda3a5f3c2e53c6b).(ctx, &(pat->normalizerscxx . . $ _grn_pat#normalizers.));
2135 grn_pat_close_token_filterscxx . . $ grn_pat_close_token_filters(ff189d7ae511a139).(ctx, pat);
2136 grn_table_modules_fincxx . . $ grn_table_modules_fin(cda3a5f3c2e53c6b).(ctx, &(pat->extractorscxx . . $ _grn_pat#extractors.));
2137 pat->iocxx . . $ _grn_pat#io. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
2138 if (path && (rc = grn_pat_removecxx . . $ grn_pat_remove(cae1c943be750b4c).(ctx, path))) {
2139 goto exit;
2140 }
2141 if (!_grn_pat_createcxx . . $ _grn_pat_create(594a7f81b5682355).(ctx, pat, path, key_size, value_size, flags)) {
2142 rc = GRN_UNKNOWN_ERRORcxx . . $ GRN_UNKNOWN_ERROR.;
2143 }
2144 if (pat->cachecxx . . $ _grn_pat#cache. && pat->cache_sizecxx . . $ _grn_pat#cache_size.) {
2145 memsetcxx . . $ memset(d1de1e4fb215f1c6).(pat->cachecxx . . $ _grn_pat#cache., 0, pat->cache_sizecxx . . $ _grn_pat#cache_size. * sizeof(grn_idcxx . . $ grn_id#));
2146 }
2147 exit:
2148 if (path) {
2149 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(path);
2150 }
2151 return rc;
2152 }
2153
2154 static uint32_tcxx . . $ uint32_t#
2155 grn_pat_cache_compute_idcxx . . $ grn_pat_cache_compute_id(65bd69877d58afce).(grn_ctxcxx . . $ grn_ctx# *ctx,
2156 grn_patcxx . . $ grn_pat# *pat,
2157 const uint8_tcxx . . $ uint8_t# *key,
2158 uint32_tcxx . . $ uint32_t# size)
2159 {
2160 const uint8_tcxx . . $ uint8_t# *p = key;
2161 uint32_tcxx . . $ uint32_t# length = size;
2162 uint32_tcxx . . $ uint32_t# cache_id = 0;
2163 for (cache_id = 0; length--; p++) {
2164 cache_id = (cache_id * 37) + *p;
2165 }
2166 cache_id &= (pat->cache_sizecxx . . $ _grn_pat#cache_size. - 1);
2167 return cache_id;
2168 }
2169
2170 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_9# {
2171 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.;
2172 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! addedcxx . . $ $anonymous_type_d195c43ed9cfff57_9#added.;
2173 uint32_tcxx . . $ uint32_t# shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_9#shared_key_offset.;
2174 uint32_tcxx . . $ uint32_t# cache_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#cache_id.;
2175 grn_idcxx . . $ grn_id# found_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#found_id.;
2176 grn_idcxx . . $ grn_id# *last_id_locationcxx . . $ $anonymous_type_d195c43ed9cfff57_9#last_id_location.;
2177 int32_tcxx . . $ int32_t# check_maxcxx . . $ $anonymous_type_d195c43ed9cfff57_9#check_max.;
2178 } grn_pat_add_datacxx . . $ grn_pat_add_data#;
2179
2180 static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
2181 grn_pat_add_internal_findcxx . . $ grn_pat_add_internal_find(8a461199f3473c6a).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_add_datacxx . . $ grn_pat_add_data# *data)
2182 {
2183 grn_patcxx . . $ grn_pat# *pat = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.;
2184 const uint8_tcxx . . $ uint8_t# *key = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
2185 uint32_tcxx . . $ uint32_t# key_size = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
2186 int32_tcxx . . $ int32_t# check_max = data->check_maxcxx . . $ $anonymous_type_d195c43ed9cfff57_9#check_max.;
2187
2188 grn_idcxx . . $ grn_id# id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2189 pat_node_commoncxx . . $ pat_node_common# *node;
2190 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
2191 grn_idcxx . . $ grn_id# *id_location_previous = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
2192 grn_idcxx . . $ grn_id# *id_location = pat_node_get_right_addresscxx . . $ pat_node_get_right_address(611d92fad5637a27).(pat, node);
2193 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction. = DIRECTION_RIGHTcxx . . $ DIRECTION_RIGHT.;
2194 grn_pat_wal_add_entry_data_set_record_directioncxx . . $ grn_pat_wal_add_entry_data_set_record_direction(c756cf9716742472).(ctx,
2195 pat,
2196 &(data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.),
2197 id,
2198 node,
2199 id_location);
2200 if (*id_location == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2201 data->last_id_locationcxx . . $ $anonymous_type_d195c43ed9cfff57_9#last_id_location. = id_location;
2202 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check. = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(key_size - 1, 7, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
2203 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
2204 }
2205
2206 const uint8_tcxx . . $ uint8_t# *found_key = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
2207 uint32_tcxx . . $ uint32_t# found_key_size = 0;
2208 grn_idcxx . . $ grn_id# id_previous = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2209 int check_node = -1;
2210 int check_node_previous = -1;
2211 for (;;) {
2212 id_previous = id;
2213 id = *id_location;
2214 if (id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2215 found_key = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node);
2216 if (!found_key) {
2217 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2218 (grn_objcxx . . $ grn_obj# *)pat,
2219 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2220 id_previous,
2221 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2222 "failed to get key from node");
2223 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2224 }
2225 found_key_size = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
2226 break;
2227 }
2228 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
2229 if (!node) {
2230 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2231 (grn_objcxx . . $ grn_obj# *)pat,
2232 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2233 id,
2234 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2235 "failed to get node");
2236 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2237 }
2238 uint16_tcxx . . $ uint16_t# check_node_current = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
2239 if (check_node < check_node_current && check_node_current < check_max) {
2240 check_node_previous = check_node;
2241 check_node = check_node_current;
2242 id_location_previous = id_location;
2243 id_location =
2244 grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, pat, node, key, check_node, check_max);
2245 grn_pat_wal_add_entry_data_set_record_directioncxx . . $ grn_pat_wal_add_entry_data_set_record_direction(c756cf9716742472).(ctx,
2246 pat,
2247 &(data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.),
2248 id,
2249 node,
2250 id_location);
2251 } else {
2252 found_key = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node);
2253 if (!found_key) {
2254 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2255 (grn_objcxx . . $ grn_obj# *)pat,
2256 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2257 id,
2258 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2259 "failed to get key from node: "
2260 "check_node:%d "
2261 "node->check:%u "
2262 "check_max:%d",
2263 check_node,
2264 check_node_current,
2265 check_max);
2266 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2267 }
2268 found_key_size = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
2269 if (key_size == found_key_size && memcmpcxx . . $ memcmp(36f949851efa3055).(found_key, key, key_size) == 0) {
2270 if (pat->cachecxx . . $ _grn_pat#cache.) {
2271 pat->cachecxx . . $ _grn_pat#cache.[data->cache_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#cache_id.] = id;
2272 }
2273 data->found_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#found_id. = id;
2274 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
2275 }
2276 break;
2277 }
2278 }
2279
2280 int32_tcxx . . $ int32_t# check;
2281 {
2282 uint32_tcxx . . $ uint32_t# min = key_size > found_key_size ? found_key_size : key_size;
2283 uint16_tcxx . . $ uint16_t# byte_differences = 0;
2284 const uint8_tcxx . . $ uint8_t# *k1 = key;
2285 const uint8_tcxx . . $ uint8_t# *k2 = found_key;
2286 for (; min > 0 && *k1 == *k2; byte_differences++, k1++, k2++, min--) {
2287 }
2288 if (min == 0) {
2289 check = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(byte_differences - 1, 7, truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!);
2290 } else {
2291 uint8_tcxx . . $ uint8_t# bit_differences = 0;
2292 int xor = *k1 ^ *k2;
2293 int mask = 0x80;
2294 for (; !(xor&mask); mask >>= 1, bit_differences++) {
2295 }
2296 check = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(byte_differences, bit_differences, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
2297 }
2298 }
2299 if (check == check_node && *id_location == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2300 if (check < (check_max - (1 << PAT_CHECK_BIT_DIFFERENCES_SHIFTcxx . . $ `lib/pat.c:322:9`!))) {
2301 check = PAT_CHECK_ADD_BIT_DIFFERENCEScxx . . $ `lib/pat.c:332:9`!(check, 1);
2302 }
2303 } else {
2304 if (check < check_node) {
2305 if (check > check_node_previous) {
2306 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction. =
2307 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_direction.;
2308 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..parent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_id. = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..grandparent_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#grandparent_record_id.;
2309 id = id_previous;
2310 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..previous_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#previous_record_id. = id_previous;
2311 id_location = id_location_previous;
2312 } else {
2313 id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2314 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
2315 id_location = pat_node_get_right_addresscxx . . $ pat_node_get_right_address(611d92fad5637a27).(pat, node);
2316 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..parent_record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_record_direction. = DIRECTION_RIGHTcxx . . $ DIRECTION_RIGHT.;
2317 grn_pat_wal_add_entry_data_set_record_directioncxx . . $ grn_pat_wal_add_entry_data_set_record_direction(c756cf9716742472).(ctx,
2318 pat,
2319 &(data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.),
2320 id,
2321 node,
2322 id_location);
2323 while ((id = *id_location) != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2324 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
2325 if (!node) {
2326 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2327 (grn_objcxx . . $ grn_obj# *)pat,
2328 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2329 id,
2330 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2331 "failed to get node to detect position");
2332 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2333 }
2334 check_node = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
2335 if (check < check_node) {
2336 break;
2337 }
2338 id_location =
2339 grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, pat, node, key, check_node, check_max);
2340 grn_pat_wal_add_entry_data_set_record_directioncxx . . $ grn_pat_wal_add_entry_data_set_record_direction(c756cf9716742472).(ctx,
2341 pat,
2342 &(data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.),
2343 id,
2344 node,
2345 id_location);
2346 }
2347 }
2348 }
2349 }
2350 if (check >= check_max) {
2351 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2352 (grn_objcxx . . $ grn_obj# *)pat,
2353 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2354 id,
2355 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2356 "BUG: computed check is too large: "
2357 "check:%u "
2358 "check_max:%d "
2359 "key_size:%u",
2360 check,
2361 check_max,
2362 key_size);
2363 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2364 }
2365 data->last_id_locationcxx . . $ $anonymous_type_d195c43ed9cfff57_9#last_id_location. = id_location;
2366 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check. = check;
2367 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
2368 }
2369
2370 static inline void
2371 grn_pat_enable_nodecxx . . $ grn_pat_enable_node(c1b19b207f53424b).(grn_ctxcxx . . $ grn_ctx# *ctx,
2372 grn_patcxx . . $ grn_pat# *pat,
2373 pat_node_commoncxx . . $ pat_node_common# *node,
2374 grn_idcxx . . $ grn_id# id,
2375 const uint8_tcxx . . $ uint8_t# *key,
2376 uint16_tcxx . . $ uint16_t# check,
2377 int32_tcxx . . $ int32_t# check_max,
2378 grn_idcxx . . $ grn_id# *id_location)
2379 {
2380 pat_node_set_checkcxx . . $ pat_node_set_check(18b96d60ead2a18e).(pat, node, check);
2381 pat_node_set_deleting_offcxx . . $ pat_node_set_deleting_off(23a3c3d6b85e9ec6).(pat, node);
2382 if (PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check)
2383 ?
2384 /* check + 1:
2385 * delete terminated flag and increment bit differences */
2386 (check + 1 < check_max)
2387 : nth_bitcxx . . $ `lib/pat.c:1220:9`!(key, check)) {
2388 pat_node_set_rightcxx . . $ pat_node_set_right(17210a70016b3f10).(pat, node, id);
2389 pat_node_set_leftcxx . . $ pat_node_set_left(17210a70016b3f10).(pat, node, *id_location);
2390 } else {
2391 pat_node_set_rightcxx . . $ pat_node_set_right(17210a70016b3f10).(pat, node, *id_location);
2392 pat_node_set_leftcxx . . $ pat_node_set_left(17210a70016b3f10).(pat, node, id);
2393 }
2394 *id_location = id;
2395 }
2396
2397 static inline void
2398 grn_pat_reuse_shared_nodecxx . . $ grn_pat_reuse_shared_node(322ccd73539cf9a5).(grn_ctxcxx . . $ grn_ctx# *ctx,
2399 grn_patcxx . . $ grn_pat# *pat,
2400 pat_node_commoncxx . . $ pat_node_common# *node,
2401 grn_idcxx . . $ grn_id# id,
2402 const uint8_tcxx . . $ uint8_t# *key,
2403 uint32_tcxx . . $ uint32_t# key_size,
2404 uint32_tcxx . . $ uint32_t# shared_key_offset,
2405 uint16_tcxx . . $ uint16_t# check,
2406 int32_tcxx . . $ int32_t# check_max,
2407 grn_idcxx . . $ grn_id# *id_location)
2408 {
2409 pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[0] = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
2410 pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages.--;
2411 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.++;
2412 pat_node_set_shared_keycxx . . $ pat_node_set_shared_key(9345e9543d2f8e53).(ctx, pat, node, key_size, shared_key_offset);
2413 grn_pat_enable_nodecxx . . $ grn_pat_enable_node(c1b19b207f53424b).(ctx, pat, node, id, key, check, check_max, id_location);
2414 }
2415
2416 static inline void
2417 grn_pat_add_shared_nodecxx . . $ grn_pat_add_shared_node(322ccd73539cf9a5).(grn_ctxcxx . . $ grn_ctx# *ctx,
2418 grn_patcxx . . $ grn_pat# *pat,
2419 pat_node_commoncxx . . $ pat_node_common# *node,
2420 grn_idcxx . . $ grn_id# id,
2421 const uint8_tcxx . . $ uint8_t# *key,
2422 uint32_tcxx . . $ uint32_t# key_size,
2423 uint32_tcxx . . $ uint32_t# shared_key_offset,
2424 uint16_tcxx . . $ uint16_t# check,
2425 int32_tcxx . . $ int32_t# check_max,
2426 grn_idcxx . . $ grn_id# *id_location)
2427 {
2428 pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec. = id;
2429 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.++;
2430 pat_node_set_shared_keycxx . . $ pat_node_set_shared_key(9345e9543d2f8e53).(ctx, pat, node, key_size, shared_key_offset);
2431 grn_pat_enable_nodecxx . . $ grn_pat_enable_node(c1b19b207f53424b).(ctx, pat, node, id, key, check, check_max, id_location);
2432 }
2433
2434 static inline grn_rccxx . . $ grn_rc#
2435 grn_pat_reuse_nodecxx . . $ grn_pat_reuse_node(2ce6e5dc68db2643).(grn_ctxcxx . . $ grn_ctx# *ctx,
2436 grn_patcxx . . $ grn_pat# *pat,
2437 pat_node_commoncxx . . $ pat_node_common# *node,
2438 grn_idcxx . . $ grn_id# id,
2439 const uint8_tcxx . . $ uint8_t# *key,
2440 uint32_tcxx . . $ uint32_t# key_size,
2441 uint16_tcxx . . $ uint16_t# check,
2442 int32_tcxx . . $ int32_t# check_max,
2443 grn_idcxx . . $ grn_id# *id_location,
2444 const char *tag)
2445 {
2446 uint8_tcxx . . $ uint8_t# *key_buffer = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node);
2447 if (!key_buffer) {
2448 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2449 (grn_objcxx . . $ grn_obj# *)pat,
2450 GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.,
2451 id,
2452 tag,
2453 "failed to get key from node: "
2454 "size:%u",
2455 key_size);
2456 return ctx->rccxx . . $ _grn_ctx#rc.;
2457 }
2458 uint32_tcxx . . $ uint32_t# key_storage_size = pat_key_storage_sizecxx . . $ pat_key_storage_size(19404736c0f9c973).(pat, key_size);
2459 pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[key_storage_size] = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
2460 pat_node_set_key_lengthcxx . . $ pat_node_set_key_length(17210a70016b3f10).(pat, node, key_size);
2461 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(key_buffer, key, key_size);
2462 pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages.--;
2463 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.++;
2464 grn_pat_enable_nodecxx . . $ grn_pat_enable_node(c1b19b207f53424b).(ctx, pat, node, id, key, check, check_max, id_location);
2465 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
2466 }
2467
2468 static inline grn_rccxx . . $ grn_rc#
2469 grn_pat_add_nodecxx . . $ grn_pat_add_node(2ce6e5dc68db2643).(grn_ctxcxx . . $ grn_ctx# *ctx,
2470 grn_patcxx . . $ grn_pat# *pat,
2471 pat_node_commoncxx . . $ pat_node_common# *node,
2472 grn_idcxx . . $ grn_id# id,
2473 const uint8_tcxx . . $ uint8_t# *key,
2474 uint32_tcxx . . $ uint32_t# key_size,
2475 uint16_tcxx . . $ uint16_t# check,
2476 int32_tcxx . . $ int32_t# check_max,
2477 grn_idcxx . . $ grn_id# *id_location,
2478 const char *tag)
2479 {
2480 grn_rccxx . . $ grn_rc# rc = pat_node_set_keycxx . . $ pat_node_set_key(54fc9b08b0515954).(ctx, pat, node, key, key_size);
2481 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2482 grn_objcxx . . $ grn_obj# inspected_key;
2483 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected_key, 0);
2484 grn_inspect_keycxx . . $ grn_inspect_key(44d5d98b9b2edba3).(ctx, &inspected_key, (grn_objcxx . . $ grn_obj# *)pat, key, key_size);
2485 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2486 (grn_objcxx . . $ grn_obj# *)pat,
2487 rc,
2488 id,
2489 tag,
2490 "failed to set key: %.*s",
2491 (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected_key),
2492 GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected_key));
2493 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected_key);
2494 return ctx->rccxx . . $ _grn_ctx#rc.;
2495 }
2496 pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec. = id;
2497 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.++;
2498 grn_pat_enable_nodecxx . . $ grn_pat_enable_node(c1b19b207f53424b).(ctx, pat, node, id, key, check, check_max, id_location);
2499 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
2500 }
2501
2502 static inline grn_idcxx . . $ grn_id#
2503 grn_pat_add_internalcxx . . $ grn_pat_add_internal(26486998b5334ed6).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_add_datacxx . . $ grn_pat_add_data# *data)
2504 {
2505 grn_patcxx . . $ grn_pat# *pat = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.;
2506 const uint8_tcxx . . $ uint8_t# *key = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
2507 uint32_tcxx . . $ uint32_t# key_size = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
2508
2509 data->addedcxx . . $ $anonymous_type_d195c43ed9cfff57_9#added. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2510 data->cache_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#cache_id. = 0;
2511 if (pat->cachecxx . . $ _grn_pat#cache.) {
2512 data->cache_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#cache_id. = grn_pat_cache_compute_idcxx . . $ grn_pat_cache_compute_id(65bd69877d58afce).(ctx, pat, key, key_size);
2513 if (pat->cachecxx . . $ _grn_pat#cache.[data->cache_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#cache_id.] != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2514 pat_node_commoncxx . . $ pat_node_common# *node;
2515 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, pat->cache[data->cache_id], node);
2516 if (node) {
2517 const uint8_tcxx . . $ uint8_t# *k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node);
2518 if (k && key_size == pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node) &&
2519 memcmpcxx . . $ memcmp(36f949851efa3055).(k, key, key_size) == 0) {
2520 return pat->cachecxx . . $ _grn_pat#cache.[data->cache_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#cache_id.];
2521 }
2522 }
2523 }
2524 }
2525
2526 data->check_maxcxx . . $ $anonymous_type_d195c43ed9cfff57_9#check_max. = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(key_size, 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
2527 data->found_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#found_id. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2528 if (!grn_pat_add_internal_findcxx . . $ grn_pat_add_internal_find(8a461199f3473c6a).(ctx, data)) {
2529 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2530 }
2531 if (data->found_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#found_id. != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2532 return data->found_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#found_id.;
2533 }
2534
2535 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset. = grn_pat_total_key_sizecxx . . $ grn_pat_total_key_size(3626315f4fc444a).(ctx, pat);
2536 pat_node_commoncxx . . $ pat_node_common# *node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
2537 {
2538 uint32_tcxx . . $ uint32_t# key_storage_size = pat_key_storage_sizecxx . . $ pat_key_storage_size(19404736c0f9c973).(pat, key_size);
2539 if (data->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_9#shared_key_offset. > 0 && key_storage_size > 0) {
2540 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#shared_key_offset. = data->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_9#shared_key_offset.;
2541 if (pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[0] != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2542 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_REUSE_SHARED_ENTRYcxx . . $ GRN_WAL_EVENT_REUSE_SHARED_ENTRY.;
2543 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[0];
2544 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, data->wal_data.record_id, node);
2545 if (!node) {
2546 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2547 (grn_objcxx . . $ grn_obj# *)pat,
2548 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2549 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
2550 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2551 "failed to get node from garbage: "
2552 "shared-key-offset:%u",
2553 data->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_9#shared_key_offset.);
2554 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2555 }
2556 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#next_garbage_record_id. = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
2557 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages. = pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages.;
2558 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries. = pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.;
2559 if (grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &(data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.)) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2560 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2561 }
2562 grn_pat_reuse_shared_nodecxx . . $ grn_pat_reuse_shared_node(322ccd73539cf9a5).(ctx,
2563 pat,
2564 node,
2565 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
2566 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.,
2567 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.,
2568 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#shared_key_offset.,
2569 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.,
2570 data->check_maxcxx . . $ $anonymous_type_d195c43ed9cfff57_9#check_max.,
2571 data->last_id_locationcxx . . $ $anonymous_type_d195c43ed9cfff57_9#last_id_location.);
2572 pat->headercxx . . $ _grn_pat#header.->wal_idcxx . . $ grn_pat_header#wal_id. = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.;
2573 } else {
2574 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_ADD_SHARED_ENTRYcxx . . $ GRN_WAL_EVENT_ADD_SHARED_ENTRY.;
2575 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec. + 1;
2576 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries. = pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.;
2577 if (grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &(data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.)) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2578 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2579 }
2580 node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.);
2581 if (!node) {
2582 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2583 (grn_objcxx . . $ grn_obj# *)pat,
2584 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2585 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
2586 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2587 "failed to get node: "
2588 "shared-key-offset:%u",
2589 data->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_9#shared_key_offset.);
2590 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2591 }
2592 grn_pat_add_shared_nodecxx . . $ grn_pat_add_shared_node(322ccd73539cf9a5).(ctx,
2593 pat,
2594 node,
2595 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
2596 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.,
2597 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.,
2598 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#shared_key_offset.,
2599 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.,
2600 data->check_maxcxx . . $ $anonymous_type_d195c43ed9cfff57_9#check_max.,
2601 data->last_id_locationcxx . . $ $anonymous_type_d195c43ed9cfff57_9#last_id_location.);
2602 pat->headercxx . . $ _grn_pat#header.->wal_idcxx . . $ grn_pat_header#wal_id. = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.;
2603 }
2604 } else {
2605 if (pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[key_storage_size] != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2606 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_REUSE_ENTRYcxx . . $ GRN_WAL_EVENT_REUSE_ENTRY.;
2607 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[key_storage_size];
2608 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages. = pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages.;
2609 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries. = pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.;
2610 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, data->wal_data.record_id, node);
2611 if (!node) {
2612 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2613 (grn_objcxx . . $ grn_obj# *)pat,
2614 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2615 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
2616 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2617 "failed to get node from garbage");
2618 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2619 }
2620 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..next_garbage_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#next_garbage_record_id. = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
2621 if (grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &(data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.)) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2622 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2623 }
2624 if (grn_pat_reuse_nodecxx . . $ grn_pat_reuse_node(2ce6e5dc68db2643).(ctx,
2625 pat,
2626 node,
2627 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
2628 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.,
2629 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.,
2630 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.,
2631 data->check_maxcxx . . $ $anonymous_type_d195c43ed9cfff57_9#check_max.,
2632 data->last_id_locationcxx . . $ $anonymous_type_d195c43ed9cfff57_9#last_id_location.,
2633 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2634 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2635 }
2636 pat->headercxx . . $ _grn_pat#header.->wal_idcxx . . $ grn_pat_header#wal_id. = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.;
2637 } else {
2638 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_ADD_ENTRYcxx . . $ GRN_WAL_EVENT_ADD_ENTRY.;
2639 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec. + 1;
2640 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries. = pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.;
2641 if (grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &(data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data.)) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2642 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2643 }
2644 node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.);
2645 if (!node) {
2646 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2647 (grn_objcxx . . $ grn_obj# *)pat,
2648 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2649 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
2650 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2651 "failed to get node");
2652 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2653 }
2654 if (grn_pat_add_nodecxx . . $ grn_pat_add_node(2ce6e5dc68db2643).(ctx,
2655 pat,
2656 node,
2657 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.,
2658 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.,
2659 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.,
2660 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check.,
2661 data->check_maxcxx . . $ $anonymous_type_d195c43ed9cfff57_9#check_max.,
2662 data->last_id_locationcxx . . $ $anonymous_type_d195c43ed9cfff57_9#last_id_location.,
2663 data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2664 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2665 }
2666 pat->headercxx . . $ _grn_pat#header.->wal_idcxx . . $ grn_pat_header#wal_id. = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.;
2667 }
2668 data->shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_9#shared_key_offset. = pat_node_get_key_offsetcxx . . $ pat_node_get_key_offset(c391a6707c7f46d8).(pat, node);
2669 }
2670 }
2671 data->addedcxx . . $ $anonymous_type_d195c43ed9cfff57_9#added. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
2672 if (pat->cachecxx . . $ _grn_pat#cache.) {
2673 pat->cachecxx . . $ _grn_pat#cache.[data->cache_idcxx . . $ $anonymous_type_d195c43ed9cfff57_9#cache_id.] = data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.;
2674 }
2675 return data->wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id.;
2676 }
2677
2678 static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
2679 chopcxx . . $ chop(47650c49ba119d54).(grn_ctxcxx . . $ grn_ctx# *ctx,
2680 grn_patcxx . . $ grn_pat# *pat,
2681 const char **key,
2682 const char *end,
2683 uint32_tcxx . . $ uint32_t# *offset)
2684 {
2685 size_t len = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, *key, end);
2686 if (len > 0) {
2687 *offset += len;
2688 *key += len;
2689 return (end - *key) > 0;
2690 } else {
2691 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2692 }
2693 }
2694
2695 #define MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`! (sizeof(int64_t))
2696
2697 #define KEY_NEEDS_CONVERTcxx . . $ `lib/pat.c:2697:9`!(pat, size) \
2698 (!((pat)->obj.header.flags & GRN_OBJ_KEY_VAR_SIZEcxx . . $ `include/groonga/groonga.h:820:9`!) && \
2699 (size_t)(size) <= MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!)
2700
2701 #define KEY_ENCcxx . . $ `lib/pat.c:2701:9`!(pat, keybuf, key, size) \
2702 do { \
2703 switch ((pat)->obj.header.flags & GRN_OBJ_KEY_MASKcxx . . $ `include/groonga/groonga.h:694:9`!) { \
2704 case GRN_OBJ_KEY_UINTcxx . . $ `include/groonga/groonga.h:697:9`!: \
2705 if (((pat)->obj.header.domain != GRN_DB_TOKYO_GEO_POINT) && \
2706 ((pat)->obj.header.domain != GRN_DB_WGS84_GEO_POINT)) { \
2707 grn_htoncxx . . $ `lib/grn.h:588:11`!((keybuf), (key), (size)); \
2708 break; \
2709 } \
2710 case GRN_OBJ_KEY_GEO_POINTcxx . . $ `include/groonga/groonga.h:706:9`!: \
2711 grn_gtoncxx . . $ `lib/grn.h:648:9`!((keybuf), (key), (size)); \
2712 break; \
2713 case GRN_OBJ_KEY_INTcxx . . $ `include/groonga/groonga.h:700:9`!: \
2714 grn_htoncxx . . $ `lib/grn.h:588:11`!((keybuf), (key), (size)); \
2715 *((uint8_t *)(keybuf)) ^= 0x80; \
2716 break; \
2717 case GRN_OBJ_KEY_FLOATcxx . . $ `include/groonga/groonga.h:703:9`!: \
2718 if ((size) == sizeof(int64_t)) { \
2719 int64_t v = *(int64_t *)(key); \
2720 v ^= ((v >> 63) | (1ULL << 63)); \
2721 grn_htoncxx . . $ `lib/grn.h:588:11`!((keybuf), &v, (size)); \
2722 } else if ((size) == sizeof(int32_t)) { \
2723 int32_t v = *(int32_t *)(key); \
2724 v ^= ((v >> 31) | (1ULL << 31)); \
2725 grn_htoncxx . . $ `lib/grn.h:588:11`!((keybuf), &v, (size)); \
2726 } \
2727 break; \
2728 } \
2729 } while (0)
2730
2731 #define KEY_DECcxx . . $ `lib/pat.c:2731:9`!(pat, keybuf, key, size) \
2732 do { \
2733 switch ((pat)->obj.header.flags & GRN_OBJ_KEY_MASKcxx . . $ `include/groonga/groonga.h:694:9`!) { \
2734 case GRN_OBJ_KEY_UINTcxx . . $ `include/groonga/groonga.h:697:9`!: \
2735 if (((pat)->obj.header.domain != GRN_DB_TOKYO_GEO_POINT) && \
2736 ((pat)->obj.header.domain != GRN_DB_WGS84_GEO_POINT)) { \
2737 grn_ntohcxx . . $ `lib/grn.h:611:9`!((keybuf), (key), (size)); \
2738 break; \
2739 } \
2740 case GRN_OBJ_KEY_GEO_POINTcxx . . $ `include/groonga/groonga.h:706:9`!: \
2741 grn_ntogcxx . . $ `lib/grn.h:669:9`!((keybuf), (key), (size)); \
2742 break; \
2743 case GRN_OBJ_KEY_INTcxx . . $ `include/groonga/groonga.h:700:9`!: \
2744 grn_ntohicxx . . $ `lib/grn.h:597:11`!((keybuf), (key), (size)); \
2745 break; \
2746 case GRN_OBJ_KEY_FLOATcxx . . $ `include/groonga/groonga.h:703:9`!: \
2747 if ((size) == sizeof(int64_t)) { \
2748 int64_t v; \
2749 grn_htoncxx . . $ `lib/grn.h:588:11`!(&v, (key), (size)); \
2750 *((int64_t *)(keybuf)) = \
2751 v ^ ((((int64_t)(v ^ (1ULL << 63))) >> 63) | (1ULL << 63)); \
2752 } else if ((size) == sizeof(int32_t)) { \
2753 int32_t v; \
2754 grn_htoncxx . . $ `lib/grn.h:588:11`!(&v, (key), (size)); \
2755 *((int32_t *)(keybuf)) = \
2756 v ^ ((((int32_t)(v ^ (1ULL << 31))) >> 31) | (1ULL << 31)); \
2757 } \
2758 break; \
2759 } \
2760 } while (0)
2761
2762 #define KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, size) \
2763 do { \
2764 if (KEY_NEEDS_CONVERTcxx . . $ `lib/pat.c:2697:9`!(pat, size)) { \
2765 KEY_ENCcxx . . $ `lib/pat.c:2701:9`!((pat), (keybuf), (key), (size)); \
2766 (key) = (keybuf); \
2767 } \
2768 } while (0)
2769
2770 grn_idcxx . . $ grn_id#
2771 grn_pat_addcxx . . $ grn_pat_add(73f23071831c7e2a).(grn_ctxcxx . . $ grn_ctx# *ctx,
2772 grn_patcxx . . $ grn_pat# *pat,
2773 const void *key,
2774 uint32_tcxx . . $ uint32_t# key_size,
2775 void **value,
2776 int *added)
2777 {
2778 grn_pat_add_datacxx . . $ grn_pat_add_data# data = {0};
2779 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat. = pat;
2780 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag. = "[pat][add]";
2781 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key. = key;
2782 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size. = key_size;
2783 data.addedcxx . . $ $anonymous_type_d195c43ed9cfff57_9#added. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
2784 data.shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_9#shared_key_offset. = 0;
2785 grn_idcxx . . $ grn_id# r0;
2786 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
2787 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2788 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2789 }
2790 if (!key) {
2791 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2792 (grn_objcxx . . $ grn_obj# *)pat,
2793 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2794 GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!,
2795 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2796 "key must not NULL");
2797 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2798 }
2799 if (!key_size) {
2800 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2801 (grn_objcxx . . $ grn_obj# *)pat,
2802 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2803 GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!,
2804 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2805 "key size must not zero");
2806 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2807 }
2808 if (key_size > GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!) {
2809 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2810 (grn_objcxx . . $ grn_obj# *)pat,
2811 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2812 GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!,
2813 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2814 "too long key: <%u>",
2815 key_size);
2816 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2817 }
2818 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, data.wal_data.key, data.wal_data.key_size);
2819 r0 = grn_pat_add_internalcxx . . $ grn_pat_add_internal(26486998b5334ed6).(ctx, &data);
2820 if (r0 == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
2821 grn_obj_set_errorcxx . . $ grn_obj_set_error(a9b02bb911432177).(ctx,
2822 (grn_objcxx . . $ grn_obj# *)pat,
2823 GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.,
2824 GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!,
2825 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag.,
2826 "failed to add a key");
2827 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2828 }
2829 if (added) {
2830 *added = data.addedcxx . . $ $anonymous_type_d195c43ed9cfff57_9#added.;
2831 }
2832 if (r0 && (pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) &&
2833 (*(data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.) & 0x80)) { // todo: refine!!
2834 sis_nodecxx . . $ sis_node# *sl, *sr;
2835 grn_idcxx . . $ grn_id# l = r0, r;
2836 if (data.addedcxx . . $ $anonymous_type_d195c43ed9cfff57_9#added. && (sl = sis_getcxx . . $ sis_get(59e5564d0351a00f).(ctx, pat, l))) {
2837 const char *sis = data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.;
2838 const char *end = sis + data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.;
2839 sl->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children. = l;
2840 sl->siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling. = 0;
2841 while (chopcxx . . $ chop(47650c49ba119d54).(ctx, pat, &sis, end, &(data.shared_key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_9#shared_key_offset.))) {
2842 if (!(*sis & 0x80)) {
2843 break;
2844 }
2845 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key. = sis;
2846 data.wal_datacxx . . $ $anonymous_type_d195c43ed9cfff57_9#wal_data..key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size. = end - sis;
2847 if (!(r = grn_pat_add_internalcxx . . $ grn_pat_add_internal(26486998b5334ed6).(ctx, &data))) {
2848 break;
2849 }
2850 if (!(sr = sis_getcxx . . $ sis_get(59e5564d0351a00f).(ctx, pat, r))) {
2851 break;
2852 }
2853 if (data.addedcxx . . $ $anonymous_type_d195c43ed9cfff57_9#added.) {
2854 sl->siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling. = r;
2855 sr->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children. = l;
2856 sr->siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling. = 0;
2857 } else {
2858 sl->siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling. = sr->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children.;
2859 sr->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children. = l;
2860 break;
2861 }
2862 l = r;
2863 sl = sr;
2864 }
2865 }
2866 }
2867 if (r0 && value) {
2868 bytecxx . . $ byte# *v = (bytecxx . . $ byte# *)sis_getcxx . . $ sis_get(59e5564d0351a00f).(ctx, pat, r0);
2869 if (pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
2870 *value = v + sizeof(sis_nodecxx . . $ sis_node#);
2871 } else {
2872 *value = v;
2873 }
2874 }
2875 return r0;
2876 }
2877
2878 static inline grn_idcxx . . $ grn_id#
2879 _grn_pat_getcxx . . $ _grn_pat_get(fa992a8ddbc8af6f).(
2880 grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, const void *key, uint32_tcxx . . $ uint32_t# key_size, void **value)
2881 {
2882 grn_idcxx . . $ grn_id# r;
2883 pat_node_commoncxx . . $ pat_node_common# *rn;
2884 int32_tcxx . . $ int32_t# c0 = -1, c;
2885 int32_tcxx . . $ int32_t# len = key_size * 16;
2886 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, rn);
2887 for (r = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, rn); r;) {
2888 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, r, rn);
2889 if (!rn) {
2890 break; /* corrupt? */
2891 }
2892 c = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, rn);
2893 if (len <= c) {
2894 break;
2895 }
2896 if (c <= c0) {
2897 const uint8_tcxx . . $ uint8_t# *k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, rn);
2898 if (k && key_size == pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, rn) &&
2899 !memcmpcxx . . $ memcmp(36f949851efa3055).(k, key, key_size)) {
2900 if (value) {
2901 bytecxx . . $ byte# *v = (bytecxx . . $ byte# *)sis_getcxx . . $ sis_get(59e5564d0351a00f).(ctx, pat, r);
2902 if (pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
2903 *value = v + sizeof(sis_nodecxx . . $ sis_node#);
2904 } else {
2905 *value = v;
2906 }
2907 }
2908 return r;
2909 }
2910 break;
2911 }
2912 r = *grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, pat, rn, key, c, len);
2913 c0 = c;
2914 }
2915 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2916 }
2917
2918 grn_idcxx . . $ grn_id#
2919 grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(
2920 grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, const void *key, uint32_tcxx . . $ uint32_t# key_size, void **value)
2921 {
2922 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
2923 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2924 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2925 }
2926 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, key_size);
2927 return _grn_pat_getcxx . . $ _grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, key_size, value);
2928 }
2929
2930 grn_idcxx . . $ grn_id#
2931 grn_pat_nextidcxx . . $ grn_pat_nextid(16c60b50be975ec9).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, const void *key, uint32_tcxx . . $ uint32_t# key_size)
2932 {
2933 grn_idcxx . . $ grn_id# r = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2934 if (pat && key) {
2935 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2936 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
2937 }
2938 uint32_tcxx . . $ uint32_t# key_storage_size = pat_key_storage_sizecxx . . $ pat_key_storage_size(19404736c0f9c973).(pat, key_size);
2939 if (!(r = pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[key_storage_size])) {
2940 r = pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec. + 1;
2941 }
2942 }
2943 return r;
2944 }
2945
2946 static void
2947 get_tccxx . . $ get_tc(2ab4dc685e1b56fb).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_hashcxx . . $ grn_hash# *h, pat_node_commoncxx . . $ pat_node_common# *rn)
2948 {
2949 grn_idcxx . . $ grn_id# id;
2950 pat_node_commoncxx . . $ pat_node_common# *node;
2951 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, rn);
2952 if (id) {
2953 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
2954 if (node) {
2955 if (pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node) > pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, rn)) {
2956 get_tccxx . . $ get_tc(2ab4dc685e1b56fb).(ctx, pat, h, node);
2957 } else {
2958 grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx, h, &id, sizeof(grn_idcxx . . $ grn_id#), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
2959 }
2960 }
2961 }
2962 id = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, rn);
2963 if (id) {
2964 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
2965 if (node) {
2966 if (pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node) > pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, rn)) {
2967 get_tccxx . . $ get_tc(2ab4dc685e1b56fb).(ctx, pat, h, node);
2968 } else {
2969 grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx, h, &id, sizeof(grn_idcxx . . $ grn_id#), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
2970 }
2971 }
2972 }
2973 }
2974
2975 grn_rccxx . . $ grn_rc#
2976 grn_pat_prefix_searchcxx . . $ grn_pat_prefix_search(b68d5b0fe0baf8db).(
2977 grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, const void *key, uint32_tcxx . . $ uint32_t# key_size, grn_hashcxx . . $ grn_hash# *h)
2978 {
2979 int32_tcxx . . $ int32_t# c0 = -1, c;
2980 const uint8_tcxx . . $ uint8_t# *k;
2981 int32_tcxx . . $ int32_t# len = key_size * 16;
2982 grn_idcxx . . $ grn_id# r;
2983 pat_node_commoncxx . . $ pat_node_common# *rn;
2984 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
2985 grn_rccxx . . $ grn_rc# rc = grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat);
2986 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
2987 return rc;
2988 }
2989 if (key_size == 0) {
2990 return GRN_END_OF_DATAcxx . . $ GRN_END_OF_DATA.;
2991 }
2992 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, key_size);
2993 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, rn);
2994 r = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, rn);
2995 while (r) {
2996 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, r, rn);
2997 if (!rn) {
2998 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
2999 }
3000 c = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, rn);
3001 if (c0 < c && c < len - 1) {
3002 r = *grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, pat, rn, key, c, len);
3003 c0 = c;
3004 continue;
3005 }
3006 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, rn))) {
3007 break;
3008 }
3009 if (pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, rn) < key_size) {
3010 break;
3011 }
3012 if (!memcmpcxx . . $ memcmp(36f949851efa3055).(k, key, key_size)) {
3013 if (c >= len - 1) {
3014 get_tccxx . . $ get_tc(2ab4dc685e1b56fb).(ctx, pat, h, rn);
3015 } else {
3016 grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx, h, &r, sizeof(grn_idcxx . . $ grn_id#), NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
3017 }
3018 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
3019 }
3020 break;
3021 }
3022 return GRN_END_OF_DATAcxx . . $ GRN_END_OF_DATA.;
3023 }
3024
3025 grn_hashcxx . . $ grn_hash# *
3026 grn_pat_prefix_search2cxx . . $ grn_pat_prefix_search2(b85e96a3c830099c).(grn_ctxcxx . . $ grn_ctx# *ctx,
3027 grn_patcxx . . $ grn_pat# *pat,
3028 const void *key,
3029 uint32_tcxx . . $ uint32_t# key_size)
3030 {
3031 grn_hashcxx . . $ grn_hash# *h;
3032 if (!pat || !key) {
3033 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3034 }
3035 if ((h = grn_hash_createcxx . . $ grn_hash_create(db1bba7e0d64660).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, sizeof(grn_idcxx . . $ grn_id#), 0, 0))) {
3036 if (grn_pat_prefix_searchcxx . . $ grn_pat_prefix_search(b68d5b0fe0baf8db).(ctx, pat, key, key_size, h)) {
3037 grn_hash_closecxx . . $ grn_hash_close(c005d027d163fb0b).(ctx, h);
3038 h = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3039 }
3040 }
3041 return h;
3042 }
3043
3044 grn_rccxx . . $ grn_rc#
3045 grn_pat_suffix_searchcxx . . $ grn_pat_suffix_search(b68d5b0fe0baf8db).(
3046 grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, const void *key, uint32_tcxx . . $ uint32_t# key_size, grn_hashcxx . . $ grn_hash# *h)
3047 {
3048 grn_idcxx . . $ grn_id# r;
3049 if ((r = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, key_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!))) {
3050 uint32_tcxx . . $ uint32_t# *offset;
3051 if (grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx, h, &r, sizeof(grn_idcxx . . $ grn_id#), (void **)&offset, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)) {
3052 *offset = 0;
3053 if (pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
3054 sis_collectcxx . . $ sis_collect(ba654b20daabaf48).(ctx, pat, h, r, 1);
3055 }
3056 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
3057 }
3058 }
3059 return GRN_END_OF_DATAcxx . . $ GRN_END_OF_DATA.;
3060 }
3061
3062 grn_hashcxx . . $ grn_hash# *
3063 grn_pat_suffix_search2cxx . . $ grn_pat_suffix_search2(b85e96a3c830099c).(grn_ctxcxx . . $ grn_ctx# *ctx,
3064 grn_patcxx . . $ grn_pat# *pat,
3065 const void *key,
3066 uint32_tcxx . . $ uint32_t# key_size)
3067 {
3068 grn_hashcxx . . $ grn_hash# *h;
3069 if (!pat || !key) {
3070 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3071 }
3072 if ((h = grn_hash_createcxx . . $ grn_hash_create(db1bba7e0d64660).(ctx, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, sizeof(grn_idcxx . . $ grn_id#), sizeof(uint32_tcxx . . $ uint32_t#), 0))) {
3073 if (grn_pat_suffix_searchcxx . . $ grn_pat_suffix_search(b68d5b0fe0baf8db).(ctx, pat, key, key_size, h)) {
3074 grn_hash_closecxx . . $ grn_hash_close(c005d027d163fb0b).(ctx, h);
3075 h = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3076 }
3077 }
3078 return h;
3079 }
3080
3081 grn_idcxx . . $ grn_id#
3082 grn_pat_lcp_searchcxx . . $ grn_pat_lcp_search(16c60b50be975ec9).(grn_ctxcxx . . $ grn_ctx# *ctx,
3083 grn_patcxx . . $ grn_pat# *pat,
3084 const void *key,
3085 uint32_tcxx . . $ uint32_t# key_size)
3086 {
3087 pat_node_commoncxx . . $ pat_node_common# *rn;
3088 grn_idcxx . . $ grn_id# r, r2 = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3089 int32_tcxx . . $ int32_t# len = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(key_size, 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
3090 int32_tcxx . . $ int32_t# c0 = -1, c;
3091 if (!pat || !key) {
3092 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3093 }
3094 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
3095 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3096 }
3097 if (!(pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_VAR_SIZEcxx . . $ `include/groonga/groonga.h:820:9`!)) {
3098 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3099 }
3100 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, rn);
3101 for (r = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, rn); r;) {
3102 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, r, rn);
3103 if (!rn) {
3104 break; /* corrupt? */
3105 }
3106 c = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, rn);
3107 if (c <= c0) {
3108 uint32_tcxx . . $ uint32_t# rn_key_length = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, rn);
3109 if (rn_key_length <= key_size) {
3110 uint8_tcxx . . $ uint8_t# *p = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, rn);
3111 if (!p) {
3112 break;
3113 }
3114 if (!memcmpcxx . . $ memcmp(36f949851efa3055).(p, key, rn_key_length)) {
3115 return r;
3116 }
3117 }
3118 break;
3119 }
3120 if (len <= c) {
3121 break;
3122 }
3123 if (PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(c)) {
3124 uint8_tcxx . . $ uint8_t# *p;
3125 pat_node_commoncxx . . $ pat_node_common# *rn0;
3126 grn_idcxx . . $ grn_id# r0 = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, rn);
3127 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, r0, rn0);
3128 if (!rn0) {
3129 break; /* corrupt? */
3130 }
3131 p = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, rn0);
3132 if (!p) {
3133 break;
3134 }
3135 uint32_tcxx . . $ uint32_t# rn0_key_length = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, rn0);
3136 if (rn0_key_length <= key_size && !memcmpcxx . . $ memcmp(36f949851efa3055).(p, key, rn0_key_length)) {
3137 r2 = r0;
3138 }
3139 }
3140 r = *grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, pat, rn, key, c, len);
3141 c0 = c;
3142 }
3143 return r2;
3144 }
3145
3146 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_10# {
3147 grn_idcxx . . $ grn_id# idcxx . . $ $anonymous_type_d195c43ed9cfff57_10#id.;
3148 uint16_tcxx . . $ uint16_t# distancecxx . . $ $anonymous_type_d195c43ed9cfff57_10#distance.;
3149 } fuzzy_heap_nodecxx . . $ fuzzy_heap_node#;
3150
3151 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_11# {
3152 uint32_tcxx . . $ uint32_t# n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_11#n_entries.;
3153 uint32_tcxx . . $ uint32_t# limitcxx . . $ $anonymous_type_d195c43ed9cfff57_11#limit.;
3154 fuzzy_heap_nodecxx . . $ fuzzy_heap_node# *nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.;
3155 } fuzzy_heapcxx . . $ fuzzy_heap#;
3156
3157 static inline fuzzy_heapcxx . . $ fuzzy_heap# *
3158 fuzzy_heap_opencxx . . $ fuzzy_heap_open(db75e6f8664654e1).(grn_ctxcxx . . $ grn_ctx# *ctx, uint32_tcxx . . $ uint32_t# max)
3159 {
3160 fuzzy_heapcxx . . $ fuzzy_heap# *h = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(fuzzy_heap));
3161 if (!h) {
3162 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3163 }
3164 h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(sizeof(fuzzy_heap_node) * max);
3165 if (!h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.) {
3166 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(h);
3167 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3168 }
3169 h->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_11#n_entries. = 0;
3170 h->limitcxx . . $ $anonymous_type_d195c43ed9cfff57_11#limit. = max;
3171 return h;
3172 }
3173
3174 static inline boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
3175 fuzzy_heap_pushcxx . . $ fuzzy_heap_push(adc379f8a72f6f3c).(grn_ctxcxx . . $ grn_ctx# *ctx, fuzzy_heapcxx . . $ fuzzy_heap# *h, grn_idcxx . . $ grn_id# id, uint16_tcxx . . $ uint16_t# distance)
3176 {
3177 int n, n2;
3178 fuzzy_heap_nodecxx . . $ fuzzy_heap_node# node = {id, distance};
3179 fuzzy_heap_nodecxx . . $ fuzzy_heap_node# node2;
3180 if (h->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_11#n_entries. >= h->limitcxx . . $ $anonymous_type_d195c43ed9cfff57_11#limit.) {
3181 uint32_tcxx . . $ uint32_t# max = h->limitcxx . . $ $anonymous_type_d195c43ed9cfff57_11#limit. * 2;
3182 fuzzy_heap_nodecxx . . $ fuzzy_heap_node# *nodes = GRN_REALLOCcxx . . $ `lib/grn_alloc.h:43:9`!(h->nodes, sizeof(fuzzy_heap) * max);
3183 if (!h) {
3184 return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
3185 }
3186 h->limitcxx . . $ $anonymous_type_d195c43ed9cfff57_11#limit. = max;
3187 h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes. = nodes;
3188 }
3189 h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[h->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_11#n_entries.] = node;
3190 n = h->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_11#n_entries.++;
3191 while (n) {
3192 n2 = (n - 1) >> 1;
3193 if (h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[n2].distancecxx . . $ $anonymous_type_d195c43ed9cfff57_10#distance. <= h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[n].distancecxx . . $ $anonymous_type_d195c43ed9cfff57_10#distance.) {
3194 break;
3195 }
3196 node2 = h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[n];
3197 h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[n] = h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[n2];
3198 h->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[n2] = node2;
3199 n = n2;
3200 }
3201 return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
3202 }
3203
3204 static inline void
3205 fuzzy_heap_closecxx . . $ fuzzy_heap_close(1e3d7b888de011ef).(grn_ctxcxx . . $ grn_ctx# *ctx, fuzzy_heapcxx . . $ fuzzy_heap# *h)
3206 {
3207 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(h->nodes);
3208 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(h);
3209 }
3210
3211 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_12# {
3212 grn_patcxx . . $ grn_pat# *patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat.;
3213 const char *keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#key.;
3214 uint32_tcxx . . $ uint32_t# key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#key_size.;
3215 uint16_tcxx . . $ uint16_t# *distscxx . . $ $anonymous_type_d195c43ed9cfff57_12#dists.;
3216 uint32_tcxx . . $ uint32_t# x_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#x_length.;
3217 uint32_tcxx . . $ uint32_t# flagscxx . . $ $anonymous_type_d195c43ed9cfff57_12#flags.;
3218 uint32_tcxx . . $ uint32_t# max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance.;
3219 uint32_tcxx . . $ uint32_t# max_expansionscxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_expansions.;
3220 uint32_tcxx . . $ uint32_t# prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size.;
3221 fuzzy_heapcxx . . $ fuzzy_heap# *heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap.;
3222 structcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13# {
3223 const char *keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key.;
3224 uint32_tcxx . . $ uint32_t# key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length.;
3225 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition.;
3226 } last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node.;
3227 } fuzzy_search_datacxx . . $ fuzzy_search_data#;
3228
3229 static grn_idcxx . . $ grn_id#
3230 grn_pat_fuzzy_search_find_prefixed_start_node_idcxx . . $ grn_pat_fuzzy_search_find_prefixed_start_node_id(118770522fc6aca8).(grn_ctxcxx . . $ grn_ctx# *ctx,
3231 fuzzy_search_datacxx . . $ fuzzy_search_data# *data)
3232 {
3233 int32_tcxx . . $ int32_t# c0 = -1, c;
3234 const uint8_tcxx . . $ uint8_t# *k;
3235 int32_tcxx . . $ int32_t# len = data->prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size. * 16;
3236 grn_idcxx . . $ grn_id# r;
3237 pat_node_commoncxx . . $ pat_node_common# *node;
3238 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
3239
3240 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(data->pat, keybuf, data->key, data->prefix_match_size);
3241 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(data->pat, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!, node);
3242 r = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node);
3243 while (r) {
3244 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(data->pat, r, node);
3245 if (!node) {
3246 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3247 }
3248 c = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node);
3249 if (c0 < c && c < len - 1) {
3250 r = *grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node, data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#key., c, len);
3251 c0 = c;
3252 continue;
3253 }
3254 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node))) {
3255 break;
3256 }
3257 if (pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node) < data->prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size.) {
3258 break;
3259 }
3260 if (memcmpcxx . . $ memcmp(36f949851efa3055).(k, data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#key., data->prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size.) == 0) {
3261 return r;
3262 }
3263 break;
3264 }
3265 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3266 }
3267
3268 #define DISTcxx . . $ `lib/pat.c:3268:9`!(data, ox, oy) \
3269 ((data)->dists[(((data)->x_length + 1) * (oy)) + (ox)])
3270
3271 static inline uint16_tcxx . . $ uint16_t#
3272 grn_pat_fuzzy_search_calc_edit_distancecxx . . $ grn_pat_fuzzy_search_calc_edit_distance(ed1c792003022046).(grn_ctxcxx . . $ grn_ctx# *ctx,
3273 fuzzy_search_datacxx . . $ fuzzy_search_data# *data,
3274 const char *sy,
3275 const char *ey,
3276 uint32_tcxx . . $ uint32_t# offset)
3277 {
3278 const char *sx = data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#key.;
3279 const char *ex = sx + data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#key_size.;
3280 uint32_tcxx . . $ uint32_t# cx, cy, x, y;
3281 const char *px, *py;
3282 const char *px_previous;
3283 const char *py_previous;
3284
3285 /*
3286 * Continue from grn_pat_fuzzy_search().
3287 *
3288 * Skip already calculated rows.
3289 *
3290 * If the previous y is "data" and the new y is "day" and offset is
3291 * 2, we can reuse the current "da" result.
3292 *
3293 * Current dists:
3294 * | | | d | a | t | e |
3295 * | | 0 | 1 | 2 | 3 | 4 |
3296 * | d | 1 | 0 | 1 | 2 | 3 |
3297 * | a | 2 | 1 | 0 | 1 | 2 |
3298 * | t | 3 | 2 | 1 | 0 | 1 |
3299 * | a | 4 | 3 | 2 | 1 | 1 |
3300 * | ? | 5 | ? | ? | ? | ? |
3301 * | ? | 6 | ? | ? | ? | ? |
3302 * | ? | 7 | ? | ? | ? | ? |
3303 *
3304 * Reused dists:
3305 * | | | d | a | t | e |
3306 * | | 0 | 1 | 2 | 3 | 4 |
3307 * | d | 1 | 0 | 1 | 2 | 3 |
3308 * | a | 2 | 1 | 0 | 1 | 2 |
3309 * | y | 3 | ? | ? | ? | ? |
3310 * | ? | 4 | ? | ? | ? | ? |
3311 * | ? | 5 | ? | ? | ? | ? |
3312 * | ? | 6 | ? | ? | ? | ? |
3313 * | ? | 7 | ? | ? | ? | ? |
3314 */
3315 for (py_previous = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, py = sy, y = 1;
3316 py < ey && (cy = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, py, ey));
3317 py_previous = py, py += cy, y++) {
3318 if ((uint32_tcxx . . $ uint32_t#)(py - sy) >= offset) {
3319 break;
3320 }
3321 }
3322 /*
3323 * Continue from grn_pat_fuzzy_search().
3324 *
3325 * y: data
3326 *
3327 * 1: d
3328 * | | | d | a | t | e |
3329 * | | 0 | 1 | 2 | 3 | 4 |
3330 * | d | 1 | 0 | 1 | 2 | 3 |
3331 * | ? | 2 | ? | ? | ? | ? |
3332 * | ? | 3 | ? | ? | ? | ? |
3333 * | ? | 4 | ? | ? | ? | ? |
3334 * | ? | 5 | ? | ? | ? | ? |
3335 * | ? | 6 | ? | ? | ? | ? |
3336 * | ? | 7 | ? | ? | ? | ? |
3337 *
3338 * 2: a
3339 * | | | d | a | t | e |
3340 * | | 0 | 1 | 2 | 3 | 4 |
3341 * | d | 1 | 0 | 1 | 2 | 3 |
3342 * | a | 2 | 1 | 0 | 1 | 3 |
3343 * | t | 3 | ? | ? | ? | ? |
3344 * | a | 4 | ? | ? | ? | ? |
3345 * | ? | 5 | ? | ? | ? | ? |
3346 * | ? | 6 | ? | ? | ? | ? |
3347 * | ? | 7 | ? | ? | ? | ? |
3348 *
3349 * 3: t
3350 * | | | d | a | t | e |
3351 * | | 0 | 1 | 2 | 3 | 4 |
3352 * | d | 1 | 0 | 1 | 2 | 3 |
3353 * | a | 2 | 1 | 0 | 1 | 3 |
3354 * | t | 3 | 2 | 1 | 0 | 1 |
3355 * | a | 4 | ? | ? | ? | ? |
3356 * | ? | 5 | ? | ? | ? | ? |
3357 * | ? | 6 | ? | ? | ? | ? |
3358 * | ? | 7 | ? | ? | ? | ? |
3359 *
3360 * 4: a
3361 * | | | d | a | t | e |
3362 * | | 0 | 1 | 2 | 3 | 4 |
3363 * | d | 1 | 0 | 1 | 2 | 3 |
3364 * | a | 2 | 1 | 0 | 1 | 2 |
3365 * | t | 3 | 2 | 1 | 0 | 1 |
3366 * | a | 4 | 3 | 2 | 1 | 1 |
3367 * | ? | 5 | ? | ? | ? | ? |
3368 * | ? | 6 | ? | ? | ? | ? |
3369 * | ? | 7 | ? | ? | ? | ? |
3370 */
3371 for (; py < ey && (cy = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, py, ey));
3372 py_previous = py, py += cy, y++) {
3373 /* children nodes will be no longer smaller than max distance
3374 * with only insertion costs.
3375 * This is end of row on allocated memory. */
3376 if (y > data->x_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#x_length. + data->max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance.) {
3377 data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
3378 return data->max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance. + 1;
3379 }
3380
3381 for (px_previous = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, px = sx, x = 1;
3382 px < ex && (cx = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, px, ex));
3383 px_previous = px, px += cx, x++) {
3384 if (cx == cy && !memcmpcxx . . $ memcmp(36f949851efa3055).(px, py, cx)) {
3385 /* Use the upper left cell value as-is when the target
3386 * characters equal. */
3387 DISTcxx . . $ `lib/pat.c:3268:9`!(data, x, y) = DISTcxx . . $ `lib/pat.c:3268:9`!(data, x - 1, y - 1);
3388 } else {
3389 uint32_tcxx . . $ uint32_t# a, b, c;
3390 a = DISTcxx . . $ `lib/pat.c:3268:9`!(data, x - 1, y) + 1;
3391 b = DISTcxx . . $ `lib/pat.c:3268:9`!(data, x, y - 1) + 1;
3392 c = DISTcxx . . $ `lib/pat.c:3268:9`!(data, x - 1, y - 1) + 1;
3393 /* Use the minimum value in a, b and c. */
3394 DISTcxx . . $ `lib/pat.c:3268:9`!(data, x, y) = ((a < b) ? ((a < c) ? a : c) : ((b < c) ? b : c));
3395 if (data->flagscxx . . $ $anonymous_type_d195c43ed9cfff57_12#flags. & GRN_TABLE_FUZZY_SEARCH_WITH_TRANSPOSITIONcxx . . $ `include/groonga/groonga.h:1958:9`! &&
3396 /* have the previous x character */
3397 x > 1 &&
3398 /* have the previous y character */
3399 y > 1 &&
3400 /* the current x character and the previous y character have the
3401 same length */
3402 cx == (py - py_previous) &&
3403 /* the current x character and the previous y character are same. */
3404 memcmpcxx . . $ memcmp(36f949851efa3055).(px, py_previous, cx) == 0 &&
3405 /* the previous x character and the current y character have the
3406 same length */
3407 (px - px_previous) == cy &&
3408 /* the previous x character and the current y character are same. */
3409 memcmpcxx . . $ memcmp(36f949851efa3055).(px_previous, py, cy) == 0) {
3410 /* Use 1 distance for transposition. */
3411 uint32_tcxx . . $ uint32_t# t = DISTcxx . . $ `lib/pat.c:3268:9`!(data, x - 2, y - 2) + 1;
3412 if (t < (DISTcxx . . $ `lib/pat.c:3268:9`!(data, x, y))) {
3413 DISTcxx . . $ `lib/pat.c:3268:9`!(data, x, y) = t;
3414 }
3415 }
3416 }
3417 }
3418 }
3419 if (data->x_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#x_length. > 0) {
3420 /* If there is no cell which is smaller than equal to max distance on end of
3421 * row, children nodes will be no longer smaller than max distance */
3422 data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
3423 for (x = 1; x <= data->x_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#x_length.; x++) {
3424 if (DISTcxx . . $ `lib/pat.c:3268:9`!(data, x, y - 1) <= data->max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance.) {
3425 data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
3426 break;
3427 }
3428 }
3429 }
3430 /* The bottom right cell is the distance of this input. */
3431 return DISTcxx . . $ `lib/pat.c:3268:9`!(data, data->x_length, y - 1);
3432 }
3433
3434 /* id must not be GRN_ID_NIL. Caller must check it. */
3435 static inline void
3436 grn_pat_fuzzy_search_recursivecxx . . $ grn_pat_fuzzy_search_recursive(53efe15d730eb257).(grn_ctxcxx . . $ grn_ctx# *ctx,
3437 fuzzy_search_datacxx . . $ fuzzy_search_data# *data,
3438 grn_idcxx . . $ grn_id# id,
3439 int last_check)
3440 {
3441 pat_node_commoncxx . . $ pat_node_common# *node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3442 int check;
3443 const char *k;
3444
3445 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(data->pat, id, node);
3446 if (!node) {
3447 return;
3448 }
3449 check = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node);
3450 uint32_tcxx . . $ uint32_t# len = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node);
3451 k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node);
3452
3453 /* There are sub nodes. */
3454 if (check > last_check) {
3455 if (len >= data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length. &&
3456 !memcmpcxx . . $ memcmp(36f949851efa3055).(k, data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key., data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length.)) {
3457 if (!data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition.) {
3458 return;
3459 }
3460 }
3461 grn_idcxx . . $ grn_id# left_record_id = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node);
3462 grn_idcxx . . $ grn_id# right_record_id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat., node);
3463 if (left_record_id != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
3464 grn_pat_fuzzy_search_recursivecxx . . $ grn_pat_fuzzy_search_recursive(53efe15d730eb257).(ctx, data, left_record_id, check);
3465 }
3466 if (right_record_id != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
3467 grn_pat_fuzzy_search_recursivecxx . . $ grn_pat_fuzzy_search_recursive(53efe15d730eb257).(ctx, data, right_record_id, check);
3468 }
3469 } else {
3470 if (data->prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size. > 0) {
3471 if (len < data->prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size.) {
3472 return;
3473 }
3474 if (memcmpcxx . . $ memcmp(36f949851efa3055).(k, data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#key., data->prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size.) != 0) {
3475 return;
3476 }
3477 }
3478 /* This is an optimization to avoid re-calculated dists. See also
3479 * a comment in grn_pat_fuzzy_search_calc_edit_distance().
3480 *
3481 * Set already calculated common prefix length. */
3482 uint32_tcxx . . $ uint32_t# offset = 0;
3483 if (len >= data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length. &&
3484 memcmpcxx . . $ memcmp(36f949851efa3055).(k, data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key., data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length.) == 0) {
3485 if (!data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition.) {
3486 return;
3487 }
3488 offset = data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length.;
3489 } else {
3490 if (!data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition.) {
3491 data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
3492 }
3493 if (data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length. > 0) {
3494 const char *kp = k;
3495 const char *ke = k + len;
3496 const char *p = data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key.;
3497 const char *e = data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key. + data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length.;
3498 int lp;
3499 for (; p < e && kp < ke && (lp = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, p, e));
3500 p += lp, kp += lp) {
3501 if (p + lp <= e && kp + lp <= ke && memcmpcxx . . $ memcmp(36f949851efa3055).(p, kp, lp) != 0) {
3502 break;
3503 }
3504 }
3505 offset = kp - k;
3506 }
3507 }
3508 if (len > offset) {
3509 uint16_tcxx . . $ uint16_t# distance;
3510 distance =
3511 grn_pat_fuzzy_search_calc_edit_distancecxx . . $ grn_pat_fuzzy_search_calc_edit_distance(ed1c792003022046).(ctx, data, k, k + len, offset);
3512 if (distance <= data->max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance.) {
3513 fuzzy_heap_pushcxx . . $ fuzzy_heap_push(adc379f8a72f6f3c).(ctx, data->heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap., id, distance);
3514 }
3515 }
3516 data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key. = k;
3517 data->last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length. = len;
3518 }
3519 return;
3520 }
3521
3522 #define HEAP_SIZEcxx . . $ `lib/pat.c:3522:9`! 256
3523
3524 grn_rccxx . . $ grn_rc#
3525 grn_pat_fuzzy_searchcxx . . $ grn_pat_fuzzy_search(75e4f8a949dfaa71).(grn_ctxcxx . . $ grn_ctx# *ctx,
3526 grn_patcxx . . $ grn_pat# *pat,
3527 const void *key,
3528 uint32_tcxx . . $ uint32_t# key_size,
3529 grn_fuzzy_search_optargcxx . . $ grn_fuzzy_search_optarg# *args,
3530 grn_hashcxx . . $ grn_hash# *h)
3531 {
3532 pat_node_commoncxx . . $ pat_node_common# *node;
3533 grn_idcxx . . $ grn_id# id;
3534 fuzzy_search_datacxx . . $ fuzzy_search_data# data;
3535 uint32_tcxx . . $ uint32_t# len, x, y, i;
3536 const char *s = key;
3537 const char *e = (const char *)key + key_size;
3538 grn_rccxx . . $ grn_rc# rc = grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat);
3539 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
3540 return rc;
3541 }
3542 data.patcxx . . $ $anonymous_type_d195c43ed9cfff57_12#pat. = pat;
3543 data.keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#key. = key;
3544 data.key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#key_size. = key_size;
3545 if (args) {
3546 data.flagscxx . . $ $anonymous_type_d195c43ed9cfff57_12#flags. = args->flagscxx . . $ _grn_fuzzy_search_optarg#flags.;
3547 if (data.flagscxx . . $ $anonymous_type_d195c43ed9cfff57_12#flags. & GRN_TABLE_FUZZY_SEARCH_USE_MAX_DISTANCE_RATIOcxx . . $ `include/groonga/groonga.h:1960:9`!) {
3548 size_t key_length = grn_str_lencxx . . $ grn_str_len(445e83e90ccdb2bf).(ctx,
3549 data.keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#key.,
3550 data.keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#key. + data.key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#key_size.,
3551 ctx->encodingcxx . . $ _grn_ctx#encoding.,
3552 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
3553 data.max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance. = floorf(key_length * args->max_distance_ratiocxx . . $ _grn_fuzzy_search_optarg#max_distance_ratio.);
3554 } else {
3555 data.max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance. = args->max_distancecxx . . $ _grn_fuzzy_search_optarg#max_distance.;
3556 }
3557 data.max_expansionscxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_expansions. = args->max_expansioncxx . . $ _grn_fuzzy_search_optarg#max_expansion.;
3558 if (data.flagscxx . . $ $anonymous_type_d195c43ed9cfff57_12#flags. & GRN_TABLE_FUZZY_SEARCH_USE_PREFIX_LENGTHcxx . . $ `include/groonga/groonga.h:1959:9`!) {
3559 const char *key_current = key;
3560 const char *key_end = key_current + key_size;
3561 uint32_tcxx . . $ uint32_t# i;
3562 data.prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size. = 0;
3563 for (i = 0; i < args->prefix_lengthcxx . . $ _grn_fuzzy_search_optarg#prefix_length.; i++) {
3564 if (key_current >= key_end) {
3565 break;
3566 }
3567 int length = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, key_current, key_end);
3568 if (length == 0) {
3569 break;
3570 }
3571 data.prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size. += length;
3572 key_current += length;
3573 }
3574 } else {
3575 data.prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size. = args->prefix_match_sizecxx . . $ _grn_fuzzy_search_optarg#prefix_match_size.;
3576 }
3577 } else {
3578 data.flagscxx . . $ $anonymous_type_d195c43ed9cfff57_12#flags. = 0;
3579 data.max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance. = 1;
3580 data.max_expansionscxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_expansions. = 0;
3581 data.prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size. = 0;
3582 }
3583 if (data.max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance. == 0) {
3584 return GRN_END_OF_DATAcxx . . $ GRN_END_OF_DATA.;
3585 }
3586 if (data.key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#key_size. > GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`! ||
3587 data.max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance. > GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`! ||
3588 data.prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size. > data.key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#key_size.) {
3589 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
3590 }
3591
3592 if (data.prefix_match_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_12#prefix_match_size. > 0) {
3593 id = grn_pat_fuzzy_search_find_prefixed_start_node_idcxx . . $ grn_pat_fuzzy_search_find_prefixed_start_node_id(118770522fc6aca8).(ctx, &data);
3594 } else {
3595 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!, node);
3596 if (!node) {
3597 return ctx->rccxx . . $ _grn_ctx#rc.;
3598 }
3599 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
3600 }
3601 if (id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
3602 return GRN_END_OF_DATAcxx . . $ GRN_END_OF_DATA.;
3603 }
3604
3605 data.heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap. = fuzzy_heap_opencxx . . $ fuzzy_heap_open(db75e6f8664654e1).(ctx, HEAP_SIZEcxx . . $ `lib/pat.c:3522:9`!);
3606 if (!data.heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap.) {
3607 return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.;
3608 }
3609
3610 for (data.x_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#x_length. = 0; s < e && (len = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, s, e)); s += len) {
3611 data.x_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#x_length.++;
3612 }
3613 data.distscxx . . $ $anonymous_type_d195c43ed9cfff57_12#dists. =
3614 GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!((data.x_length + 1) * (data.x_length + data.max_distance + 1) *
3615 sizeof(uint16_t));
3616 if (!data.distscxx . . $ $anonymous_type_d195c43ed9cfff57_12#dists.) {
3617 fuzzy_heap_closecxx . . $ fuzzy_heap_close(1e3d7b888de011ef).(ctx, data.heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap.);
3618 return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.;
3619 }
3620
3621 /*
3622 * x: each character of the given key
3623 * x_length: the number of x in character
3624 * y: each character of a key in this pat
3625 *
3626 * Example:
3627 *
3628 * x: date
3629 * max_distance: 2
3630 *
3631 * Initial:
3632 * | | | d | a | t | e |
3633 * | | 0 | 1 | 2 | 3 | 4 |
3634 * | ? | 1 | ? | ? | ? | ? |
3635 * | ? | 2 | ? | ? | ? | ? |
3636 * | ? | 3 | ? | ? | ? | ? |
3637 * | ? | 4 | ? | ? | ? | ? |
3638 * | ? | 5 | ? | ? | ? | ? |
3639 * | ? | 6 | ? | ? | ? | ? |
3640 * | ? | 7 | ? | ? | ? | ? |
3641 */
3642 for (x = 0; x <= data.x_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#x_length.; x++) {
3643 DISTcxx . . $ `lib/pat.c:3268:9`!(&data, x, 0) = x;
3644 }
3645 for (y = 0; y <= data.x_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#x_length. + data.max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance.; y++) {
3646 DISTcxx . . $ `lib/pat.c:3268:9`!(&data, 0, y) = y;
3647 }
3648
3649 data.last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..keycxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3650 data.last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..key_lengthcxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#key_length. = 0;
3651 data.last_nodecxx . . $ $anonymous_type_d195c43ed9cfff57_12#last_node..can_transitioncxx . . $ $anonymous_type_d195c43ed9cfff57_12#$anonymous_type_13#can_transition. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
3652 /*
3653 * Fill dists and find matched IDs recursively. See
3654 * grn_pat_fuzzy_search_calc_edit_distance() how to fill dists.
3655 */
3656 grn_pat_fuzzy_search_recursivecxx . . $ grn_pat_fuzzy_search_recursive(53efe15d730eb257).(ctx, &data, id, -1);
3657 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(data.dists);
3658 uint32_tcxx . . $ uint32_t# n_results = 0;
3659 for (i = 0; i < data.heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap.->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_11#n_entries.; i++) {
3660 if (data.max_expansionscxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_expansions. > 0 && i >= data.max_expansionscxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_expansions.) {
3661 break;
3662 }
3663 if (DB_OBJcxx . . $ `lib/grn_db.h:62:9`!(h)->headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_WITH_SUBRECcxx . . $ `include/groonga/groonga.h:812:9`!) {
3664 grn_rset_recinfocxx . . $ grn_rset_recinfo# *ri;
3665 if (grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx,
3666 h,
3667 &(data.heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap.->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[i].idcxx . . $ $anonymous_type_d195c43ed9cfff57_10#id.),
3668 sizeof(grn_idcxx . . $ grn_id#),
3669 (void **)&ri,
3670 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)) {
3671 ri->scorecxx . . $ $anonymous_type_cc21d51c44e8310a_0#score. = data.max_distancecxx . . $ $anonymous_type_d195c43ed9cfff57_12#max_distance. - data.heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap.->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[i].distancecxx . . $ $anonymous_type_d195c43ed9cfff57_10#distance. + 1;
3672 }
3673 } else {
3674 grn_hash_addcxx . . $ grn_hash_add(251a256fc515235e).(ctx,
3675 h,
3676 &(data.heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap.->nodescxx . . $ $anonymous_type_d195c43ed9cfff57_11#nodes.[i].idcxx . . $ $anonymous_type_d195c43ed9cfff57_10#id.),
3677 sizeof(grn_idcxx . . $ grn_id#),
3678 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!,
3679 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
3680 }
3681 n_results++;
3682 }
3683 fuzzy_heap_closecxx . . $ fuzzy_heap_close(1e3d7b888de011ef).(ctx, data.heapcxx . . $ $anonymous_type_d195c43ed9cfff57_12#heap.);
3684 if (n_results > 0) {
3685 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
3686 } else {
3687 return GRN_END_OF_DATAcxx . . $ GRN_END_OF_DATA.;
3688 }
3689 }
3690
3691 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_14# {
3692 grn_pat_delinfocxx . . $ grn_pat_delinfo# *dicxx . . $ $anonymous_type_d195c43ed9cfff57_14#di.;
3693 grn_idcxx . . $ grn_id# idcxx . . $ $anonymous_type_d195c43ed9cfff57_14#id.;
3694 uint16_tcxx . . $ uint16_t# checkcxx . . $ $anonymous_type_d195c43ed9cfff57_14#check.;
3695 uint16_tcxx . . $ uint16_t# check0cxx . . $ $anonymous_type_d195c43ed9cfff57_14#check0.;
3696 pat_node_commoncxx . . $ pat_node_common# *nodecxx . . $ $anonymous_type_d195c43ed9cfff57_14#node.;
3697 pat_node_commoncxx . . $ pat_node_common# *node_previouscxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_previous.;
3698 pat_node_commoncxx . . $ pat_node_common# *node_othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_otherside.;
3699 grn_idcxx . . $ grn_id# othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#otherside.;
3700 grn_idcxx . . $ grn_id# *prootcxx . . $ $anonymous_type_d195c43ed9cfff57_14#proot.;
3701 grn_idcxx . . $ grn_id# *pcxx . . $ $anonymous_type_d195c43ed9cfff57_14#p.;
3702 grn_idcxx . . $ grn_id# *p0cxx . . $ $anonymous_type_d195c43ed9cfff57_14#p0.;
3703 uint32_tcxx . . $ uint32_t# n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_14#n_garbages.;
3704 uint32_tcxx . . $ uint32_t# n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_14#n_entries.;
3705 } grn_pat_del_datacxx . . $ grn_pat_del_data#;
3706
3707 static inline grn_rccxx . . $ grn_rc#
3708 grn_pat_del_internalcxx . . $ grn_pat_del_internal(6122918d34eb9d91).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_pat_del_datacxx . . $ grn_pat_del_data# *data)
3709 {
3710 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di = data->dicxx . . $ $anonymous_type_d195c43ed9cfff57_14#di.;
3711 grn_idcxx . . $ grn_id# id = data->idcxx . . $ $anonymous_type_d195c43ed9cfff57_14#id.;
3712 uint16_tcxx . . $ uint16_t# check = data->checkcxx . . $ $anonymous_type_d195c43ed9cfff57_14#check.;
3713 uint16_tcxx . . $ uint16_t# check0 = data->check0cxx . . $ $anonymous_type_d195c43ed9cfff57_14#check0.;
3714 pat_node_commoncxx . . $ pat_node_common# *node = data->nodecxx . . $ $anonymous_type_d195c43ed9cfff57_14#node.;
3715 pat_node_commoncxx . . $ pat_node_common# *node_previous = data->node_previouscxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_previous.;
3716 pat_node_commoncxx . . $ pat_node_common# *node_otherside = data->node_othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_otherside.;
3717 grn_idcxx . . $ grn_id# otherside = data->othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#otherside.;
3718 grn_idcxx . . $ grn_id# *proot = data->prootcxx . . $ $anonymous_type_d195c43ed9cfff57_14#proot.;
3719 grn_idcxx . . $ grn_id# *p = data->pcxx . . $ $anonymous_type_d195c43ed9cfff57_14#p.;
3720 grn_idcxx . . $ grn_id# *p0 = data->p0cxx . . $ $anonymous_type_d195c43ed9cfff57_14#p0.;
3721 if (node == node_previous) {
3722 /* The last transition (p) is a self-loop. */
3723 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE2cxx . . $ DL_PHASE2.;
3724 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = id;
3725 if (otherside) {
3726 uint16_tcxx . . $ uint16_t# node_otherside_check = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node_otherside);
3727 if (check0 < node_otherside_check && node_otherside_check <= check) {
3728 /* To keep node_otherside as an output node, its check is set to
3729 * zero. */
3730 if (!delinfo_searchcxx . . $ delinfo_search(340dd5cf2b90da95).(pat, otherside, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)) {
3731 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_DEBUG, "no delinfo found %d", otherside);
3732 }
3733 pat_node_set_checkcxx . . $ pat_node_set_check(18b96d60ead2a18e).(pat, node_otherside, 0);
3734 }
3735 if (proot == p0 && !pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node_otherside)) {
3736 /*
3737 * Update node_otherside->lr because the first node,
3738 * node_otherside becomes the new first
3739 * node, is not an output node even if its check is zero.
3740 */
3741 const uint8_tcxx . . $ uint8_t# *k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node_otherside);
3742 int direction = k ? (*k >> 7) : 1;
3743 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(pat, node_otherside, direction, otherside);
3744 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(pat, node_otherside, !direction, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
3745 }
3746 }
3747 *p0 = otherside;
3748 } else if ((pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node) == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`! &&
3749 pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node) == id) ||
3750 (pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node) == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`! &&
3751 pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node) == id)) {
3752 /* The output node has only a disabled self-loop. */
3753 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE2cxx . . $ DL_PHASE2.;
3754 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = id;
3755 *p = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3756 } else {
3757 /* The last transition (p) is not a self-loop. */
3758 grn_pat_delinfocxx . . $ grn_pat_delinfo# *ldi = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, *ddi = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3759 if (pat_node_is_deletingcxx . . $ pat_node_is_deleting(e829a7c3dd493304).(pat, node)) {
3760 ldi = delinfo_searchcxx . . $ delinfo_search(340dd5cf2b90da95).(pat, id, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
3761 }
3762 if (pat_node_is_deletingcxx . . $ pat_node_is_deleting(e829a7c3dd493304).(pat, node_previous)) {
3763 ddi = delinfo_searchcxx . . $ delinfo_search(340dd5cf2b90da95).(pat, *p0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
3764 }
3765 if (ldi) {
3766 pat_node_set_deleting_offcxx . . $ pat_node_set_deleting_off(23a3c3d6b85e9ec6).(pat, node);
3767 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE2cxx . . $ DL_PHASE2.;
3768 if (ddi) {
3769 pat_node_set_deleting_offcxx . . $ pat_node_set_deleting_off(23a3c3d6b85e9ec6).(pat, node_previous);
3770 ddi->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE2cxx . . $ DL_PHASE2.;
3771 if (ddi == ldi) {
3772 if (id != ddi->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld.) {
3773 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "id(%u) != ddi->ld(%u)", id, ddi->ld);
3774 }
3775 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = id;
3776 } else {
3777 ldi->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld. = ddi->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld.;
3778 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = id;
3779 }
3780 } else {
3781 pat_node_set_deleting_oncxx . . $ pat_node_set_deleting_on(23a3c3d6b85e9ec6).(pat, node_previous);
3782 ldi->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld. = *p0;
3783 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = id;
3784 }
3785 } else {
3786 pat_node_set_deleting_oncxx . . $ pat_node_set_deleting_on(23a3c3d6b85e9ec6).(pat, node);
3787 if (ddi) {
3788 if (ddi->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. != *p0) {
3789 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "ddi->d(%d) != *p0(%d)", ddi->d, *p0);
3790 }
3791 pat_node_set_deleting_offcxx . . $ pat_node_set_deleting_off(23a3c3d6b85e9ec6).(pat, node_previous);
3792 ddi->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE2cxx . . $ DL_PHASE2.;
3793 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE1cxx . . $ DL_PHASE1.;
3794 di->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld. = ddi->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld.;
3795 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = id;
3796 } else {
3797 pat_node_set_deleting_oncxx . . $ pat_node_set_deleting_on(23a3c3d6b85e9ec6).(pat, node_previous);
3798 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE1cxx . . $ DL_PHASE1.;
3799 di->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld. = *p0;
3800 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = id;
3801 }
3802 }
3803 if (*p0 == otherside) {
3804 /* The previous node (*p0) has a self-loop (node_previous ==
3805 * node_otherside). */
3806 pat_node_set_checkcxx . . $ pat_node_set_check(18b96d60ead2a18e).(pat, node_otherside, 0);
3807 if (proot == p0) {
3808 /*
3809 * Update node_otherside->lr because the first node,
3810 * node_otherside becomes the new first
3811 * node, is not an output node even if its check is zero.
3812 */
3813 const uint8_tcxx . . $ uint8_t# *k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node_otherside);
3814 int direction = k ? (*k >> 7) : 1;
3815 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(pat, node_otherside, direction, otherside);
3816 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(pat, node_otherside, !direction, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
3817 }
3818 } else {
3819 if (otherside) {
3820 uint16_tcxx . . $ uint16_t# node_otherside_check = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node_otherside);
3821 if (check0 < node_otherside_check && node_otherside_check <= check) {
3822 /* To keep node_otherside as an output node, its check is set to
3823 * zero. */
3824 if (!delinfo_searchcxx . . $ delinfo_search(340dd5cf2b90da95).(pat, otherside, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)) {
3825 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx, GRN_LOG_ERROR, "no delinfo found %d", otherside);
3826 }
3827 pat_node_set_checkcxx . . $ pat_node_set_check(18b96d60ead2a18e).(pat, node_otherside, 0);
3828 }
3829 if (proot == p0 && !pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node_otherside)) {
3830 /*
3831 * Update node_otherside->lr because the first node,
3832 * node_otherside becomes the new first
3833 * node, is not an output node even if its check is zero.
3834 */
3835 const uint8_tcxx . . $ uint8_t# *k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node_otherside);
3836 int direction = k ? (*k >> 7) : 1;
3837 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(pat, node_otherside, direction, otherside);
3838 pat_node_set_childcxx . . $ pat_node_set_child(3c9a3332231f4819).(pat, node_otherside, !direction, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!);
3839 }
3840 }
3841 *p0 = otherside;
3842 }
3843 }
3844 pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages. = data->n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_14#n_garbages.;
3845 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries. = data->n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_14#n_entries.;
3846 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
3847 }
3848
3849 static inline grn_rccxx . . $ grn_rc#
3850 _grn_pat_delcxx . . $ _grn_pat_del(2b3e365daee07c76).(grn_ctxcxx . . $ grn_ctx# *ctx,
3851 grn_patcxx . . $ grn_pat# *pat,
3852 const char *key,
3853 uint32_tcxx . . $ uint32_t# key_size,
3854 int shared,
3855 grn_table_delete_optargcxx . . $ grn_table_delete_optarg# *optarg)
3856 {
3857 pat_node_commoncxx . . $ pat_node_common# *node, *node_previous = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, *node_otherside = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3858 int32_tcxx . . $ int32_t# node_check = -1, node_previous_check = -1, check;
3859 int32_tcxx . . $ int32_t# check_max = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(key_size, 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
3860 grn_idcxx . . $ grn_id# otherside, *proot, *p, *p0 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
3861
3862 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# wal_data = {0};
3863 wal_data.patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat. = pat;
3864 wal_data.tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag. = "[pat][delete]";
3865 wal_data.keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key. = key;
3866 wal_data.key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size. = key_size;
3867 wal_data.is_sharedcxx . . $ $anonymous_type_d195c43ed9cfff57_6#is_shared. = shared;
3868
3869 /* delinfo_new() must be called before searching for node. */
3870 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di = delinfo_newcxx . . $ delinfo_new(b403ac74ccc7a23f).(ctx, pat, &wal_data);
3871 if (!di) {
3872 return ctx->rccxx . . $ _grn_ctx#rc.;
3873 }
3874
3875 /*
3876 * Search a patricia tree for a given key.
3877 * If the key exists, get its output node.
3878 *
3879 * node, node_previous: the output node and its previous node.
3880 * node_otherside: the other side of node (the other destination
3881 * of node_previous).
3882 * node_check, node_previous_check: checks of node and its previous node.
3883 * p, p0: pointers to transitions (IDs) that refer to node and node_previous.
3884 * id, id0: ID of p and p0.
3885 */
3886 grn_idcxx . . $ grn_id# id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3887 grn_idcxx . . $ grn_id# id0 = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3888 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
3889 proot = p = pat_node_get_right_addresscxx . . $ pat_node_get_right_address(611d92fad5637a27).(pat, node);
3890 wal_data.record_directioncxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_direction. = DIRECTION_RIGHTcxx . . $ DIRECTION_RIGHT.;
3891 grn_pat_wal_add_entry_data_set_record_directioncxx . . $ grn_pat_wal_add_entry_data_set_record_direction(c756cf9716742472).(ctx,
3892 pat,
3893 &wal_data,
3894 id,
3895 node,
3896 p);
3897 for (;;) {
3898 grn_idcxx . . $ grn_id# next_id = *p;
3899 if (next_id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
3900 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
3901 }
3902 id0 = id;
3903 id = next_id;
3904 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
3905 if (!node) {
3906 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
3907 }
3908 check = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
3909 if (check_max <= check) {
3910 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
3911 }
3912 if (node_check >= check) {
3913 /* Output node found. */
3914 const uint8_tcxx . . $ uint8_t# *k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node);
3915 if (!k) {
3916 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
3917 }
3918 if (key_size != pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node) ||
3919 memcmpcxx . . $ memcmp(36f949851efa3055).(k, key, key_size)) {
3920 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
3921 }
3922 /* Given key found. */
3923 break;
3924 }
3925 node_previous_check = node_check;
3926 p0 = p;
3927 node_check = check;
3928 p = grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, pat, node, key, node_check, check_max);
3929 grn_pat_wal_add_entry_data_set_record_directioncxx . . $ grn_pat_wal_add_entry_data_set_record_direction(c756cf9716742472).(ctx,
3930 pat,
3931 &wal_data,
3932 id,
3933 node,
3934 p);
3935 node_previous = node;
3936 }
3937 if (optarg && optarg->funccxx . . $ _grn_table_delete_optarg#func. &&
3938 !optarg->funccxx . . $ _grn_table_delete_optarg#func.(ctx, (grn_objcxx . . $ grn_obj# *)pat, id, optarg->func_argcxx . . $ _grn_table_delete_optarg#func_arg.)) {
3939 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
3940 }
3941 grn_idcxx . . $ grn_id# node_previous_right = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node_previous);
3942 grn_idcxx . . $ grn_id# node_previous_left = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node_previous);
3943 if (node_previous_left == node_previous_right) {
3944 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
3945 GRN_LOG_DEBUG,
3946 "*p0 (%d), node_previous->lr[0] == node_previous->lr[1] (%d)",
3947 *p0,
3948 node_previous_left);
3949 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
3950 }
3951 otherside =
3952 (node_previous_right == id) ? node_previous_left : node_previous_right;
3953 if (otherside) {
3954 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, otherside, node_otherside);
3955 if (!node_otherside) {
3956 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
3957 }
3958 }
3959
3960 if (pat->cachecxx . . $ _grn_pat#cache.) {
3961 uint32_tcxx . . $ uint32_t# cache_id;
3962 cache_id = grn_pat_cache_compute_idcxx . . $ grn_pat_cache_compute_id(65bd69877d58afce).(ctx, pat, key, key_size);
3963 if (pat->cachecxx . . $ _grn_pat#cache.[cache_id]) {
3964 pat->cachecxx . . $ _grn_pat#cache.[cache_id] = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
3965 }
3966 }
3967
3968 wal_data.eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_DELETE_ENTRYcxx . . $ GRN_WAL_EVENT_DELETE_ENTRY.;
3969 wal_data.record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = id;
3970 wal_data.checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#check. = node_check;
3971 wal_data.parent_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#parent_check. = node_previous_check;
3972 wal_data.otherside_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#otherside_record_id. = otherside;
3973 if (node_otherside) {
3974 wal_data.otherside_checkcxx . . $ $anonymous_type_d195c43ed9cfff57_6#otherside_check. = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node_otherside);
3975 }
3976 wal_data.left_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#left_record_id. = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
3977 wal_data.right_record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#right_record_id. = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
3978 wal_data.n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages. = pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages. + 1;
3979 wal_data.n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries. = pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries. - 1;
3980 wal_data.delete_info_phase1_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase1_index. = pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del.;
3981 wal_data.delete_info_phase2_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_phase2_index. = pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2.;
3982 if (grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &wal_data) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
3983 return ctx->rccxx . . $ _grn_ctx#rc.;
3984 }
3985
3986 grn_pat_del_datacxx . . $ grn_pat_del_data# data = {0};
3987 data.dicxx . . $ $anonymous_type_d195c43ed9cfff57_14#di. = di;
3988 data.idcxx . . $ $anonymous_type_d195c43ed9cfff57_14#id. = id;
3989 data.checkcxx . . $ $anonymous_type_d195c43ed9cfff57_14#check. = node_check;
3990 data.check0cxx . . $ $anonymous_type_d195c43ed9cfff57_14#check0. = node_previous_check;
3991 data.nodecxx . . $ $anonymous_type_d195c43ed9cfff57_14#node. = node;
3992 data.node_previouscxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_previous. = node_previous;
3993 data.node_othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_otherside. = node_otherside;
3994 data.othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#otherside. = otherside;
3995 data.prootcxx . . $ $anonymous_type_d195c43ed9cfff57_14#proot. = proot;
3996 data.pcxx . . $ $anonymous_type_d195c43ed9cfff57_14#p. = p;
3997 data.p0cxx . . $ $anonymous_type_d195c43ed9cfff57_14#p0. = p0;
3998 data.n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_14#n_garbages. = wal_data.n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_garbages.;
3999 data.n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_14#n_entries. = wal_data.n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_6#n_entries.;
4000 grn_rccxx . . $ grn_rc# rc = grn_pat_del_internalcxx . . $ grn_pat_del_internal(6122918d34eb9d91).(ctx, pat, &data);
4001 if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4002 pat->headercxx . . $ _grn_pat#header.->wal_idcxx . . $ grn_pat_header#wal_id. = wal_data.wal_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#wal_id.;
4003 }
4004 return rc;
4005 }
4006
4007 static grn_rccxx . . $ grn_rc#
4008 _grn_pat_deletecxx . . $ _grn_pat_delete(192945363f173260).(grn_ctxcxx . . $ grn_ctx# *ctx,
4009 grn_patcxx . . $ grn_pat# *pat,
4010 const void *key,
4011 uint32_tcxx . . $ uint32_t# key_size,
4012 grn_table_delete_optargcxx . . $ grn_table_delete_optarg# *optarg)
4013 {
4014 if (pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
4015 grn_idcxx . . $ grn_id# id = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, key_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
4016 if (id && grn_pat_delete_with_siscxx . . $ grn_pat_delete_with_sis(739b5184d11d4dfc).(ctx, pat, id, optarg)) {
4017 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4018 }
4019 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4020 }
4021 return _grn_pat_delcxx . . $ _grn_pat_del(2b3e365daee07c76).(ctx, pat, key, key_size, 0, optarg);
4022 }
4023
4024 grn_rccxx . . $ grn_rc#
4025 grn_pat_deletecxx . . $ grn_pat_delete(192945363f173260).(grn_ctxcxx . . $ grn_ctx# *ctx,
4026 grn_patcxx . . $ grn_pat# *pat,
4027 const void *key,
4028 uint32_tcxx . . $ uint32_t# key_size,
4029 grn_table_delete_optargcxx . . $ grn_table_delete_optarg# *optarg)
4030 {
4031 grn_rccxx . . $ grn_rc# rc;
4032 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
4033 if (!pat || !key || !key_size) {
4034 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4035 }
4036 rc = grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat);
4037 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4038 return rc;
4039 }
4040 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, key_size);
4041 return _grn_pat_deletecxx . . $ _grn_pat_delete(192945363f173260).(ctx, pat, key, key_size, optarg);
4042 }
4043
4044 uint32_tcxx . . $ uint32_t#
4045 grn_pat_sizecxx . . $ grn_pat_size(801003d623e3bbf5).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
4046 {
4047 if (!pat) {
4048 ERRcxx . . $ `lib/grn_error.h:156:9`!(GRN_INVALID_ARGUMENT, "[pat][size] pat is null");
4049 return 0;
4050 }
4051 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4052 return 0;
4053 }
4054 return pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.;
4055 }
4056
4057 const char *
4058 _grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id, uint32_tcxx . . $ uint32_t# *key_size)
4059 {
4060 pat_node_commoncxx . . $ pat_node_common# *node;
4061 uint8_tcxx . . $ uint8_t# *key;
4062 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4063 *key_size = 0;
4064 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
4065 }
4066 if (id == GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
4067 *key_size = 0;
4068 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
4069 }
4070 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
4071 if (!node) {
4072 *key_size = 0;
4073 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
4074 }
4075 key = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node);
4076 if (key) {
4077 *key_size = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
4078 } else {
4079 *key_size = 0;
4080 }
4081 return (const char *)key;
4082 }
4083
4084 grn_rccxx . . $ grn_rc#
4085 grn_pat_delete_by_idcxx . . $ grn_pat_delete_by_id(69fddfcd7b80a172).(grn_ctxcxx . . $ grn_ctx# *ctx,
4086 grn_patcxx . . $ grn_pat# *pat,
4087 grn_idcxx . . $ grn_id# id,
4088 grn_table_delete_optargcxx . . $ grn_table_delete_optarg# *optarg)
4089 {
4090 grn_rccxx . . $ grn_rc# rc;
4091 if (!pat || !id) {
4092 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4093 }
4094 rc = grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat);
4095 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4096 return rc;
4097 }
4098 {
4099 uint32_tcxx . . $ uint32_t# key_size;
4100 const char *key = _grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(ctx, pat, id, &key_size);
4101 return _grn_pat_deletecxx . . $ _grn_pat_delete(192945363f173260).(ctx, pat, key, key_size, optarg);
4102 }
4103 }
4104
4105 int
4106 grn_pat_get_keycxx . . $ grn_pat_get_key(52cd598958564ca7).(
4107 grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id, void *keybuf, int bufsize)
4108 {
4109 int len;
4110 uint8_tcxx . . $ uint8_t# *key;
4111 pat_node_commoncxx . . $ pat_node_common# *node;
4112 if (!pat) {
4113 return 0;
4114 }
4115 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4116 return 0;
4117 }
4118 if (!id) {
4119 return 0;
4120 }
4121 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
4122 if (!node) {
4123 return 0;
4124 }
4125 if (!(key = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
4126 return 0;
4127 }
4128 len = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
4129 if (keybuf && bufsize >= len) {
4130 if (KEY_NEEDS_CONVERTcxx . . $ `lib/pat.c:2697:9`!(pat, len)) {
4131 KEY_DECcxx . . $ `lib/pat.c:2731:9`!(pat, keybuf, key, len);
4132 } else {
4133 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(keybuf, key, len);
4134 }
4135 }
4136 return len;
4137 }
4138
4139 int
4140 grn_pat_get_key2cxx . . $ grn_pat_get_key2(e246f25eab482707).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id, grn_objcxx . . $ grn_obj# *bulk)
4141 {
4142 uint32_tcxx . . $ uint32_t# len;
4143 uint8_tcxx . . $ uint8_t# *key;
4144 pat_node_commoncxx . . $ pat_node_common# *node;
4145 if (!pat) {
4146 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4147 }
4148 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4149 return 0;
4150 }
4151 if (!id) {
4152 return 0;
4153 }
4154 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
4155 if (!node) {
4156 return 0;
4157 }
4158 if (!(key = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
4159 return 0;
4160 }
4161 len = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
4162 if (KEY_NEEDS_CONVERTcxx . . $ `lib/pat.c:2697:9`!(pat, len)) {
4163 if (bulk->headercxx . . $ _grn_obj#header..impl_flagscxx . . $ _grn_obj_header#impl_flags. & GRN_OBJ_REFERcxx . . $ `include/groonga/groonga.h:935:9`!) {
4164 GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(bulk, 0);
4165 }
4166 if (!grn_bulk_reservecxx . . $ grn_bulk_reserve(f9a66385f261f61d).(ctx, bulk, len)) {
4167 char *curr = GRN_BULK_CURRcxx . . $ `include/groonga/groonga.h:2650:9`!(bulk);
4168 KEY_DECcxx . . $ `lib/pat.c:2731:9`!(pat, curr, key, len);
4169 GRN_BULK_INCR_LENcxx . . $ `include/groonga/groonga.h:2627:9`!(bulk, len);
4170 }
4171 } else {
4172 if (bulk->headercxx . . $ _grn_obj#header..impl_flagscxx . . $ _grn_obj_header#impl_flags. & GRN_OBJ_REFERcxx . . $ `include/groonga/groonga.h:935:9`!) {
4173 bulk->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..headcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#head. = (char *)key;
4174 bulk->ucxx . . $ _grn_obj#u..bcxx . . $ _grn_obj#$anonymous_type_6#b..currcxx . . $ _grn_obj#$anonymous_type_6#$anonymous_type_7#curr. = (char *)key + len;
4175 } else {
4176 grn_bulk_writecxx . . $ grn_bulk_write(4609c18fd87cf054).(ctx, bulk, (char *)key, len);
4177 }
4178 }
4179 return len;
4180 }
4181
4182 int
4183 grn_pat_get_valuecxx . . $ grn_pat_get_value(27ffe75e7a870817).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id, void *valuebuf)
4184 {
4185 int value_size;
4186 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4187 return 0;
4188 }
4189 value_size = (int)pat->value_sizecxx . . $ _grn_pat#value_size.;
4190 if (value_size) {
4191 bytecxx . . $ byte# *v = (bytecxx . . $ byte# *)sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, pat, id);
4192 if (v) {
4193 if (valuebuf) {
4194 if (pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
4195 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(valuebuf, v + sizeof(sis_node), value_size);
4196 } else {
4197 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(valuebuf, v, value_size);
4198 }
4199 }
4200 return value_size;
4201 }
4202 }
4203 return 0;
4204 }
4205
4206 const char *
4207 grn_pat_get_value_cxx . . $ grn_pat_get_value_(5b74e3d4f3bf1aa4).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id, uint32_tcxx . . $ uint32_t# *size)
4208 {
4209 const char *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
4210 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4211 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
4212 }
4213 if ((*size = pat->value_sizecxx . . $ _grn_pat#value_size.)) {
4214 if ((value = (const char *)sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, pat, id)) &&
4215 (pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!)) {
4216 value += sizeof(sis_nodecxx . . $ sis_node#);
4217 }
4218 }
4219 return value;
4220 }
4221
4222 grn_rccxx . . $ grn_rc#
4223 grn_pat_set_valuecxx . . $ grn_pat_set_value(d5f8c516acb30a1b).(
4224 grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id, const void *value, int flags)
4225 {
4226 grn_rccxx . . $ grn_rc# rc = grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat);
4227 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4228 return rc;
4229 }
4230 if (value) {
4231 uint32_tcxx . . $ uint32_t# value_size = pat->value_sizecxx . . $ _grn_pat#value_size.;
4232 if (value_size) {
4233 bytecxx . . $ byte# *v = (bytecxx . . $ byte# *)sis_getcxx . . $ sis_get(59e5564d0351a00f).(ctx, pat, id);
4234 if (v) {
4235 if (pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
4236 v += sizeof(sis_nodecxx . . $ sis_node#);
4237 }
4238 switch ((flags & GRN_OBJ_SET_MASKcxx . . $ `include/groonga/groonga.h:1462:9`!)) {
4239 case GRN_OBJ_SETcxx . . $ `include/groonga/groonga.h:1466:9`!:
4240 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(v, value, value_size);
4241 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4242 case GRN_OBJ_INCRcxx . . $ `include/groonga/groonga.h:1470:9`!:
4243 switch (value_size) {
4244 case sizeof(int32_tcxx . . $ int32_t#):
4245 *((int32_tcxx . . $ int32_t# *)v) += *((int32_tcxx . . $ int32_t# *)value);
4246 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4247 case sizeof(int64_tcxx . . $ int64_t#):
4248 *((int64_tcxx . . $ int64_t# *)v) += *((int64_tcxx . . $ int64_t# *)value);
4249 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4250 default:
4251 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4252 }
4253 break;
4254 case GRN_OBJ_DECRcxx . . $ `include/groonga/groonga.h:1474:9`!:
4255 switch (value_size) {
4256 case sizeof(int32_tcxx . . $ int32_t#):
4257 *((int32_tcxx . . $ int32_t# *)v) -= *((int32_tcxx . . $ int32_t# *)value);
4258 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4259 case sizeof(int64_tcxx . . $ int64_t#):
4260 *((int64_tcxx . . $ int64_t# *)v) -= *((int64_tcxx . . $ int64_t# *)value);
4261 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4262 default:
4263 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4264 }
4265 break;
4266 default:
4267 // todo : support other types.
4268 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4269 }
4270 } else {
4271 return GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.;
4272 }
4273 }
4274 }
4275 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4276 }
4277
4278 grn_rccxx . . $ grn_rc#
4279 grn_pat_infocxx . . $ grn_pat_info(d16cbc54fb4f6bf7).(grn_ctxcxx . . $ grn_ctx# *ctx,
4280 grn_patcxx . . $ grn_pat# *pat,
4281 int *key_size,
4282 unsigned int *flags,
4283 grn_encodingcxx . . $ grn_encoding# *encoding,
4284 unsigned int *n_entries,
4285 unsigned int *file_size)
4286 {
4287 grn_rccxx . . $ grn_rc# rc;
4288 ERRCLRcxx . . $ `lib/grn_error.h:37:9`!(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
4289 if (!pat) {
4290 return GRN_INVALID_ARGUMENTcxx . . $ GRN_INVALID_ARGUMENT.;
4291 }
4292 rc = grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat);
4293 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4294 return rc;
4295 }
4296 if (key_size) {
4297 *key_size = pat->key_sizecxx . . $ _grn_pat#key_size.;
4298 }
4299 if (flags) {
4300 *flags = pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags.;
4301 }
4302 if (encoding) {
4303 *encoding = pat->encodingcxx . . $ _grn_pat#encoding.;
4304 }
4305 if (n_entries) {
4306 *n_entries = pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries.;
4307 }
4308 if (file_size) {
4309 uint64_tcxx . . $ uint64_t# tmp = 0;
4310 if ((rc = grn_io_sizecxx . . $ grn_io_size(cad0b01aa2d38ece).(ctx, pat->iocxx . . $ _grn_pat#io., &tmp))) {
4311 return rc;
4312 }
4313 *file_size = (unsigned int)tmp; /* FIXME: inappropriate cast */
4314 }
4315 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4316 }
4317
4318 int
4319 grn_pat_delete_with_siscxx . . $ grn_pat_delete_with_sis(739b5184d11d4dfc).(grn_ctxcxx . . $ grn_ctx# *ctx,
4320 grn_patcxx . . $ grn_pat# *pat,
4321 grn_idcxx . . $ grn_id# id,
4322 grn_table_delete_optargcxx . . $ grn_table_delete_optarg# *optarg)
4323 {
4324 int level = 0, shared;
4325 const char *key = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, *_key;
4326 sis_nodecxx . . $ sis_node# *sp, *ss = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, *si;
4327 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4328 return 0;
4329 }
4330 si = sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, pat, id);
4331 while (id) {
4332 pat_node_commoncxx . . $ pat_node_common# *rn;
4333 uint32_tcxx . . $ uint32_t# key_size;
4334 if ((si && si->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children. && si->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children. != id) ||
4335 (optarg && optarg->funccxx . . $ _grn_table_delete_optarg#func. &&
4336 !optarg->funccxx . . $ _grn_table_delete_optarg#func.(ctx, (grn_objcxx . . $ grn_obj# *)pat, id, optarg->func_argcxx . . $ _grn_table_delete_optarg#func_arg.))) {
4337 break;
4338 }
4339 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, rn);
4340 if (!(_key = (char *)pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, rn))) {
4341 return 0;
4342 }
4343 if (_key == key) {
4344 shared = 1;
4345 } else {
4346 key = _key;
4347 shared = 0;
4348 }
4349 key_size = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, rn);
4350 if (key && key_size) {
4351 _grn_pat_delcxx . . $ _grn_pat_del(2b3e365daee07c76).(ctx, pat, key, key_size, shared, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
4352 }
4353 if (si) {
4354 grn_idcxx . . $ grn_id# *p, sid;
4355 uint32_tcxx . . $ uint32_t# offset = 0;
4356 if ((*key & 0x80) && chopcxx . . $ chop(47650c49ba119d54).(ctx, pat, &key, key + key_size, &offset)) {
4357 if ((sid = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, key_size - offset, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)) &&
4358 (ss = sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, pat, sid))) {
4359 for (p = &ss->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children.; *p && *p != sid; p = &sp->siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling.) {
4360 if (*p == id) {
4361 *p = si->siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling.;
4362 break;
4363 }
4364 if (!(sp = sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, pat, *p))) {
4365 break;
4366 }
4367 }
4368 }
4369 } else {
4370 sid = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4371 }
4372 si->siblingcxx . . $ $anonymous_type_d195c43ed9cfff57_4#sibling. = 0;
4373 si->childrencxx . . $ $anonymous_type_d195c43ed9cfff57_4#children. = 0;
4374 id = sid;
4375 si = ss;
4376 } else {
4377 id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4378 }
4379 level++;
4380 }
4381 if (level) {
4382 uint32_tcxx . . $ uint32_t# shared_key_offset = 0;
4383 while (id && key) {
4384 uint32_tcxx . . $ uint32_t# key_size;
4385 if (_grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(ctx, pat, id, &key_size) != key) {
4386 break;
4387 }
4388 {
4389 pat_node_commoncxx . . $ pat_node_common# *rn;
4390 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, rn);
4391 if (!rn) {
4392 break;
4393 }
4394 if (shared_key_offset > 0) {
4395 pat_node_set_key_offsetcxx . . $ pat_node_set_key_offset(51f1878679485402).(pat, rn, shared_key_offset);
4396 } else {
4397 pat_node_set_keycxx . . $ pat_node_set_key(54fc9b08b0515954).(ctx, pat, rn, (uint8_tcxx . . $ uint8_t# *)key, key_size);
4398 shared_key_offset = pat_node_get_key_offsetcxx . . $ pat_node_get_key_offset(c391a6707c7f46d8).(pat, rn);
4399 }
4400 }
4401 {
4402 const char *end = key + key_size;
4403 if (!((*key & 0x80) && chopcxx . . $ chop(47650c49ba119d54).(ctx, pat, &key, end, &shared_key_offset))) {
4404 break;
4405 }
4406 id = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, end - key, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
4407 }
4408 }
4409 }
4410 return level;
4411 }
4412
4413 grn_idcxx . . $ grn_id#
4414 grn_pat_nextcxx . . $ grn_pat_next(c27224444ab48125).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id)
4415 {
4416 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4417 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4418 }
4419 while (++id <= pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec.) {
4420 uint32_tcxx . . $ uint32_t# key_size;
4421 const char *key = _grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(ctx, pat, id, &key_size);
4422 if (id == grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, key_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!)) {
4423 return id;
4424 }
4425 }
4426 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4427 }
4428
4429 grn_idcxx . . $ grn_id#
4430 grn_pat_atcxx . . $ grn_pat_at(c27224444ab48125).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# id)
4431 {
4432 uint32_tcxx . . $ uint32_t# key_size;
4433 const char *key = _grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(ctx, pat, id, &key_size);
4434 if (key && (id == _grn_pat_getcxx . . $ _grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, key_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!))) {
4435 return id;
4436 }
4437 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4438 }
4439
4440 grn_idcxx . . $ grn_id#
4441 grn_pat_curr_idcxx . . $ grn_pat_curr_id(801003d623e3bbf5).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
4442 {
4443 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4444 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4445 }
4446 return pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec.;
4447 }
4448
4449 int
4450 grn_pat_scancxx . . $ grn_pat_scan(656402c9c3a16ac).(grn_ctxcxx . . $ grn_ctx# *ctx,
4451 grn_patcxx . . $ grn_pat# *pat,
4452 const char *str,
4453 unsigned int str_len,
4454 grn_pat_scan_hitcxx . . $ grn_pat_scan_hit# *sh,
4455 unsigned int sh_size,
4456 const char **rest)
4457 {
4458 int n = 0;
4459 grn_idcxx . . $ grn_id# tid;
4460 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
4461 return 0;
4462 }
4463 if (GRN_BULK_VSIZEcxx . . $ `include/groonga/groonga.h:2642:9`!(&(pat->normalizers)) > 0) {
4464 int flags =
4465 GRN_STRING_REMOVE_BLANKcxx . . $ `include/groonga/string.h:52:9`! | GRN_STRING_WITH_TYPEScxx . . $ `include/groonga/string.h:53:9`! | GRN_STRING_WITH_CHECKScxx . . $ `include/groonga/string.h:54:9`!;
4466 grn_objcxx . . $ grn_obj# *nstr = grn_string_opencxx . . $ grn_string_open(e91f62a415156742).(ctx, str, str_len, (grn_objcxx . . $ grn_obj# *)pat, flags);
4467 if (nstr) {
4468 const short *cp = grn_string_get_checkscxx . . $ grn_string_get_checks(392ec27081c21988).(ctx, nstr);
4469 const unsigned char *tp = grn_string_get_typescxx . . $ grn_string_get_types(e641985a04b6a30).(ctx, nstr);
4470 unsigned int offset = 0, offset0 = 0;
4471 unsigned int normalized_length_in_bytes;
4472 const char *sp, *se;
4473 grn_string_get_normalizedcxx . . $ grn_string_get_normalized(fcb0da4d05783f05).(ctx,
4474 nstr,
4475 &sp,
4476 &normalized_length_in_bytes,
4477 NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
4478 se = sp + normalized_length_in_bytes;
4479 while ((unsigned int)n < sh_size) {
4480 if ((tid = grn_pat_lcp_searchcxx . . $ grn_pat_lcp_search(16c60b50be975ec9).(ctx, pat, sp, se - sp))) {
4481 const char *key;
4482 uint32_tcxx . . $ uint32_t# len;
4483 int first_key_char_len;
4484 key = _grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(ctx, pat, tid, &len);
4485 sh[n].idcxx . . $ _grn_table_scan_hit#id. = tid;
4486 sh[n].offsetcxx . . $ _grn_table_scan_hit#offset. = (*cp > 0) ? offset : offset0;
4487 first_key_char_len = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, key, key + len);
4488 if (sh[n].offsetcxx . . $ _grn_table_scan_hit#offset. > 0 && GRN_CHAR_IS_BLANKcxx . . $ `include/groonga/string.h:60:9`!(tp[-1]) &&
4489 ((first_key_char_len == 1 && key[0] != ' ') ||
4490 first_key_char_len > 1)) {
4491 /* Remove leading spaces. */
4492 const char *original_str = str + sh[n].offsetcxx . . $ _grn_table_scan_hit#offset.;
4493 while (truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!) {
4494 int char_len = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, original_str, str + str_len);
4495 if (char_len == 0) {
4496 break;
4497 }
4498 if (!grn_isspacecxx . . $ grn_isspace(f8f88a86d74aa1ba).(original_str, ctx->encodingcxx . . $ _grn_ctx#encoding.)) {
4499 break;
4500 }
4501 original_str += char_len;
4502 sh[n].offsetcxx . . $ _grn_table_scan_hit#offset. += char_len;
4503 }
4504 }
4505 {
4506 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! blank_in_alnum = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
4507 const unsigned char *start_tp = tp;
4508 const unsigned char *blank_in_alnum_check_tp;
4509 while (len--) {
4510 if (*cp > 0) {
4511 offset0 = offset;
4512 offset += *cp;
4513 tp++;
4514 }
4515 sp++;
4516 cp++;
4517 }
4518 sh[n].lengthcxx . . $ _grn_table_scan_hit#length. = offset - sh[n].offsetcxx . . $ _grn_table_scan_hit#offset.;
4519 for (blank_in_alnum_check_tp = start_tp + 1;
4520 blank_in_alnum_check_tp < tp;
4521 blank_in_alnum_check_tp++) {
4522 #define GRN_CHAR_IS_ALNUMcxx . . $ `lib/pat.c:4522:9`!(char_type) \
4523 (GRN_CHAR_TYPEcxx . . $ `include/groonga/string.h:61:9`!(char_type) == GRN_CHAR_ALPHA || \
4524 GRN_CHAR_TYPEcxx . . $ `include/groonga/string.h:61:9`!(char_type) == GRN_CHAR_DIGIT)
4525 if (GRN_CHAR_IS_BLANKcxx . . $ `include/groonga/string.h:60:9`!(blank_in_alnum_check_tp[-1]) &&
4526 GRN_CHAR_IS_ALNUMcxx . . $ `lib/pat.c:4522:9`!(blank_in_alnum_check_tp[-1]) &&
4527 GRN_CHAR_IS_ALNUMcxx . . $ `lib/pat.c:4522:9`!(blank_in_alnum_check_tp[0])) {
4528 blank_in_alnum = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
4529 break;
4530 }
4531 #undef GRN_CHAR_IS_ALNUMcxx . . $ `lib/pat.c:4522:9`!
4532 }
4533 if (!blank_in_alnum) {
4534 n++;
4535 }
4536 }
4537 } else {
4538 if (*cp > 0) {
4539 offset0 = offset;
4540 offset += *cp;
4541 tp++;
4542 }
4543 do {
4544 sp++;
4545 cp++;
4546 } while (sp < se && !*cp);
4547 }
4548 if (se <= sp) {
4549 offset = str_len;
4550 break;
4551 }
4552 }
4553 if (rest) {
4554 grn_string_get_originalcxx . . $ grn_string_get_original(87996916c40b1978).(ctx, nstr, rest, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
4555 *rest += offset;
4556 }
4557 grn_obj_closecxx . . $ grn_obj_close(4865d068a46d0f83).(ctx, nstr);
4558 } else {
4559 n = -1;
4560 if (rest) {
4561 *rest = str;
4562 }
4563 }
4564 } else {
4565 uint32_tcxx . . $ uint32_t# len;
4566 const char *sp, *se = str + str_len;
4567 for (sp = str; sp < se && (unsigned int)n < sh_size; sp += len) {
4568 if ((tid = grn_pat_lcp_searchcxx . . $ grn_pat_lcp_search(16c60b50be975ec9).(ctx, pat, sp, se - sp))) {
4569 _grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(ctx, pat, tid, &len);
4570 sh[n].idcxx . . $ _grn_table_scan_hit#id. = tid;
4571 sh[n].offsetcxx . . $ _grn_table_scan_hit#offset. = sp - str;
4572 sh[n].lengthcxx . . $ _grn_table_scan_hit#length. = len;
4573 n++;
4574 } else {
4575 len = grn_charlencxx . . $ grn_charlen(d229e8bf7c87f0f0).(ctx, sp, se);
4576 }
4577 if (!len) {
4578 break;
4579 }
4580 }
4581 if (rest) {
4582 *rest = sp;
4583 }
4584 }
4585 return n;
4586 }
4587
4588 #define INITIAL_SIZEcxx . . $ `lib/pat.c:4588:9`! 512
4589
4590 static inline void
4591 pushcxx . . $ push(82233c8eae791b0f).(grn_pat_cursorcxx . . $ grn_pat_cursor# *c, grn_idcxx . . $ grn_id# id, uint16_tcxx . . $ uint16_t# check)
4592 {
4593 grn_ctxcxx . . $ grn_ctx# *ctx = c->ctxcxx . . $ _grn_pat_cursor#ctx.;
4594 grn_pat_cursor_entrycxx . . $ grn_pat_cursor_entry# *se;
4595 if (c->sizecxx . . $ _grn_pat_cursor#size. <= c->spcxx . . $ _grn_pat_cursor#sp.) {
4596 if (c->sscxx . . $ _grn_pat_cursor#ss.) {
4597 uint32_tcxx . . $ uint32_t# size = c->sizecxx . . $ _grn_pat_cursor#size. * 4;
4598 grn_pat_cursor_entrycxx . . $ grn_pat_cursor_entry# *ss =
4599 GRN_REALLOCcxx . . $ `lib/grn_alloc.h:43:9`!(c->ss, sizeof(grn_pat_cursor_entry) * size);
4600 GRN_LOGcxx . . $ `include/groonga/groonga.h:2493:9`!(ctx,
4601 GRN_LOG_DEBUG,
4602 "[pat][cursor][push][realloc] "
4603 "%p: %p -> %p: <%" GRN_FMT_INT32Ucxx . . $ `lib/grn.h:368:11`! ">",
4604 c,
4605 c->ss,
4606 ss,
4607 size);
4608 if (!ss) {
4609 return; /* give up */
4610 }
4611 c->sscxx . . $ _grn_pat_cursor#ss. = ss;
4612 c->sizecxx . . $ _grn_pat_cursor#size. = size;
4613 } else {
4614 uint32_tcxx . . $ uint32_t# size = INITIAL_SIZEcxx . . $ `lib/pat.c:4588:9`!;
4615 if (!(c->sscxx . . $ _grn_pat_cursor#ss. = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(sizeof(grn_pat_cursor_entry) * size))) {
4616 return; /* give up */
4617 }
4618 c->sizecxx . . $ _grn_pat_cursor#size. = size;
4619 }
4620 }
4621 se = &c->sscxx . . $ _grn_pat_cursor#ss.[c->spcxx . . $ _grn_pat_cursor#sp.++];
4622 se->idcxx . . $ _grn_pat_cursor_entry#id. = id;
4623 se->checkcxx . . $ _grn_pat_cursor_entry#check. = check;
4624 }
4625
4626 static inline grn_pat_cursor_entrycxx . . $ grn_pat_cursor_entry# *
4627 popcxx . . $ pop(c8fc8ff475d3482a).(grn_pat_cursorcxx . . $ grn_pat_cursor# *c)
4628 {
4629 return c->spcxx . . $ _grn_pat_cursor#sp. ? &c->sscxx . . $ _grn_pat_cursor#ss.[--c->spcxx . . $ _grn_pat_cursor#sp.] : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
4630 }
4631
4632 static inline void
4633 grn_pat_cursor_pushcxx . . $ grn_pat_cursor_push(99ee5ab13fbe25b7).(grn_ctxcxx . . $ grn_ctx# *ctx,
4634 grn_pat_cursorcxx . . $ grn_pat_cursor# *cursor,
4635 int order,
4636 grn_patcxx . . $ grn_pat# *pat,
4637 pat_node_commoncxx . . $ pat_node_common# *node)
4638 {
4639 uint16_tcxx . . $ uint16_t# check = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
4640 if (order & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
4641 pushcxx . . $ push(82233c8eae791b0f).(cursor, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), check);
4642 pushcxx . . $ push(82233c8eae791b0f).(cursor, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), check);
4643 } else {
4644 pushcxx . . $ push(82233c8eae791b0f).(cursor, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), check);
4645 pushcxx . . $ push(82233c8eae791b0f).(cursor, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), check);
4646 }
4647 }
4648
4649 static grn_idcxx . . $ grn_id#
4650 grn_pat_cursor_next_by_idcxx . . $ grn_pat_cursor_next_by_id(5452c9aa69698298).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_cursorcxx . . $ grn_pat_cursor# *c)
4651 {
4652 grn_patcxx . . $ grn_pat# *pat = c->patcxx . . $ _grn_pat_cursor#pat.;
4653 int dir = (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) ? -1 : 1;
4654 while (c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. != c->tailcxx . . $ _grn_pat_cursor#tail.) {
4655 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. += dir;
4656 if (pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages.) {
4657 uint32_tcxx . . $ uint32_t# key_size;
4658 const void *key = _grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(ctx, pat, c->curr_reccxx . . $ _grn_pat_cursor#curr_rec., &key_size);
4659 if (_grn_pat_getcxx . . $ _grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, key_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) != c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.) {
4660 continue;
4661 }
4662 }
4663 c->restcxx . . $ _grn_pat_cursor#rest.--;
4664 return c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.;
4665 }
4666 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4667 }
4668
4669 grn_idcxx . . $ grn_id#
4670 grn_pat_cursor_nextcxx . . $ grn_pat_cursor_next(5452c9aa69698298).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_cursorcxx . . $ grn_pat_cursor# *c)
4671 {
4672 pat_node_commoncxx . . $ pat_node_common# *node;
4673 grn_pat_cursor_entrycxx . . $ grn_pat_cursor_entry# *se;
4674 if (!c->restcxx . . $ _grn_pat_cursor#rest.) {
4675 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4676 }
4677 if ((c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_BY_IDcxx . . $ `include/groonga/table.h:280:9`!)) {
4678 return grn_pat_cursor_next_by_idcxx . . $ grn_pat_cursor_next_by_id(5452c9aa69698298).(ctx, c);
4679 }
4680 while ((se = popcxx . . $ pop(c8fc8ff475d3482a).(c))) {
4681 grn_idcxx . . $ grn_id# id = se->idcxx . . $ _grn_pat_cursor_entry#id.;
4682 int check = se->checkcxx . . $ _grn_pat_cursor_entry#check., ch;
4683 while (id) {
4684 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(c->pat, id, node);
4685 if (!node) {
4686 break;
4687 }
4688 ch = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(c->patcxx . . $ _grn_pat_cursor#pat., node);
4689 if (ch > check) {
4690 if (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
4691 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(c->patcxx . . $ _grn_pat_cursor#pat., node), ch);
4692 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(c->patcxx . . $ _grn_pat_cursor#pat., node);
4693 } else {
4694 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(c->patcxx . . $ _grn_pat_cursor#pat., node), ch);
4695 id = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(c->patcxx . . $ _grn_pat_cursor#pat., node);
4696 }
4697 check = ch;
4698 continue;
4699 } else {
4700 if (id == c->tailcxx . . $ _grn_pat_cursor#tail.) {
4701 c->spcxx . . $ _grn_pat_cursor#sp. = 0;
4702 } else {
4703 if (!c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. && c->tailcxx . . $ _grn_pat_cursor#tail.) {
4704 uint32_tcxx . . $ uint32_t# lmin, lmax;
4705 pat_node_commoncxx . . $ pat_node_common# *nmin, *nmax;
4706 const uint8_tcxx . . $ uint8_t# *kmin, *kmax;
4707 if (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
4708 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(c->pat, c->tail, nmin);
4709 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(c->pat, id, nmax);
4710 } else {
4711 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(c->pat, id, nmin);
4712 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(c->pat, c->tail, nmax);
4713 }
4714 lmin = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(c->patcxx . . $ _grn_pat_cursor#pat., nmin);
4715 lmax = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(c->patcxx . . $ _grn_pat_cursor#pat., nmax);
4716 kmin = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, c->patcxx . . $ _grn_pat_cursor#pat., nmin);
4717 kmax = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, c->patcxx . . $ _grn_pat_cursor#pat., nmax);
4718 if ((lmin < lmax) ? (memcmpcxx . . $ memcmp(36f949851efa3055).(kmin, kmax, lmin) > 0)
4719 : (memcmpcxx . . $ memcmp(36f949851efa3055).(kmin, kmax, lmax) >= 0)) {
4720 c->spcxx . . $ _grn_pat_cursor#sp. = 0;
4721 break;
4722 }
4723 }
4724 }
4725 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = id;
4726 c->restcxx . . $ _grn_pat_cursor#rest.--;
4727 return id;
4728 }
4729 }
4730 }
4731 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
4732 }
4733
4734 void
4735 grn_pat_cursor_closecxx . . $ grn_pat_cursor_close(e6719157d7b0b236).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_cursorcxx . . $ grn_pat_cursor# *c)
4736 {
4737 GRN_ASSERTcxx . . $ `lib/grn_ctx.h:70:11`!(c->ctx == ctx);
4738 if (c->sscxx . . $ _grn_pat_cursor#ss.) {
4739 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(c->ss);
4740 }
4741 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(c);
4742 }
4743
4744 static inline int
4745 bitcmpcxx . . $ bitcmp(b507788d7c814a65).(const void *s1, const void *s2, int offset, int length)
4746 {
4747 int r, rest = length + (offset & 7) - 8, bl = offset >> 3,
4748 mask = 0xff >> (offset & 7);
4749 unsigned char *a = (unsigned char *)s1 + bl, *b = (unsigned char *)s2 + bl;
4750 if (rest <= 0) {
4751 mask &= 0xff << -rest;
4752 return (*a & mask) - (*b & mask);
4753 }
4754 if ((r = (*a & mask) - (*b & mask))) {
4755 return r;
4756 }
4757 a++;
4758 b++;
4759 if ((bl = rest >> 3)) {
4760 if ((r = memcmpcxx . . $ memcmp(36f949851efa3055).(a, b, bl))) {
4761 return r;
4762 }
4763 a += bl;
4764 b += bl;
4765 }
4766 mask = 0xff << (8 - (rest & 7));
4767 return (*a & mask) - (*b & mask);
4768 }
4769
4770 static inline grn_rccxx . . $ grn_rc#
4771 set_cursor_prefixcxx . . $ set_cursor_prefix(90a2438889753746).(grn_ctxcxx . . $ grn_ctx# *ctx,
4772 grn_patcxx . . $ grn_pat# *pat,
4773 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
4774 const void *key,
4775 uint32_tcxx . . $ uint32_t# key_size,
4776 int flags)
4777 {
4778 int32_tcxx . . $ int32_t# c0 = -1, ch;
4779 const uint8_tcxx . . $ uint8_t# *k;
4780 int32_tcxx . . $ int32_t# len;
4781 uint32_tcxx . . $ uint32_t# byte_len;
4782 grn_idcxx . . $ grn_id# id;
4783 pat_node_commoncxx . . $ pat_node_common# *node;
4784 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
4785 if (flags & GRN_CURSOR_SIZE_BY_BITcxx . . $ `include/groonga/table.h:282:9`!) {
4786 len = key_size * 2;
4787 byte_len = key_size >> 3;
4788 } else {
4789 len = key_size * 16;
4790 byte_len = key_size;
4791 }
4792 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, byte_len);
4793 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node);
4794 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
4795 while (id) {
4796 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
4797 if (!node) {
4798 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4799 }
4800 ch = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
4801 if (c0 < ch && ch < len - 1) {
4802 id = *grn_pat_next_locationcxx . . $ grn_pat_next_location(5594ed503e36fcea).(ctx, pat, node, key, ch, len);
4803 c0 = ch;
4804 continue;
4805 }
4806 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
4807 break;
4808 }
4809 if (pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node) < byte_len) {
4810 break;
4811 }
4812 if ((flags & GRN_CURSOR_SIZE_BY_BITcxx . . $ `include/groonga/table.h:282:9`!) ? !bitcmpcxx . . $ bitcmp(b507788d7c814a65).(k, key, 0, key_size)
4813 : !memcmpcxx . . $ memcmp(36f949851efa3055).(k, key, key_size)) {
4814 if (c0 < ch) {
4815 if (flags & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
4816 if ((ch > len - 1) || !(flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!)) {
4817 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), ch);
4818 }
4819 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), ch);
4820 } else {
4821 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), ch);
4822 if ((ch > len - 1) || !(flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!)) {
4823 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), ch);
4824 }
4825 }
4826 } else {
4827 int32_tcxx . . $ int32_t# check_max =
4828 PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(pat_node_get_key_length(pat, node), 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
4829 if (check_max > len || !(flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!)) {
4830 pushcxx . . $ push(82233c8eae791b0f).(c, id, ch);
4831 }
4832 }
4833 }
4834 break;
4835 }
4836 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4837 }
4838
4839 static inline grn_rccxx . . $ grn_rc#
4840 set_cursor_nearcxx . . $ set_cursor_near(5f7b65b68792d090).(grn_ctxcxx . . $ grn_ctx# *ctx,
4841 grn_patcxx . . $ grn_pat# *pat,
4842 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
4843 uint32_tcxx . . $ uint32_t# min_size,
4844 const void *key,
4845 int flags)
4846 {
4847 grn_idcxx . . $ grn_id# id;
4848 pat_node_commoncxx . . $ pat_node_common# *node;
4849 const uint8_tcxx . . $ uint8_t# *k;
4850 int32_tcxx . . $ int32_t# r, check = -1, ch;
4851 int32_tcxx . . $ int32_t# min = min_size * 16;
4852 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
4853 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, pat->key_size);
4854 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node);
4855 for (id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node); id;) {
4856 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
4857 if (!node) {
4858 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4859 }
4860 ch = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
4861 if (ch <= check) {
4862 if (check >= min) {
4863 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
4864 }
4865 break;
4866 }
4867 if ((check += 2) < ch) {
4868 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
4869 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4870 }
4871 if ((r = bitcmpcxx . . $ bitcmp(b507788d7c814a65).(key, k, check >> 1, (ch - check) >> 1))) {
4872 if (ch >= min) {
4873 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), ch);
4874 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), ch);
4875 }
4876 break;
4877 }
4878 }
4879 check = ch;
4880 if (nth_bitcxx . . $ `lib/pat.c:1220:9`!((uint8_t *)key, check)) {
4881 if (check >= min) {
4882 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), check);
4883 }
4884 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
4885 } else {
4886 if (check >= min) {
4887 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), check);
4888 }
4889 id = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
4890 }
4891 }
4892 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4893 }
4894
4895 static inline grn_rccxx . . $ grn_rc#
4896 set_cursor_common_prefixcxx . . $ set_cursor_common_prefix(5c9d444d27147bbe).(grn_ctxcxx . . $ grn_ctx# *ctx,
4897 grn_patcxx . . $ grn_pat# *pat,
4898 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
4899 uint32_tcxx . . $ uint32_t# min_size,
4900 const void *key,
4901 uint32_tcxx . . $ uint32_t# key_size,
4902 int flags)
4903 {
4904 grn_idcxx . . $ grn_id# id;
4905 pat_node_commoncxx . . $ pat_node_common# *node;
4906 const uint8_tcxx . . $ uint8_t# *k;
4907 int32_tcxx . . $ int32_t# check = -1, ch;
4908 int32_tcxx . . $ int32_t# len = key_size * 16;
4909 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
4910 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, key_size);
4911 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node);
4912 for (id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node); id;) {
4913 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
4914 if (!node) {
4915 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4916 }
4917 ch = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
4918 if (ch <= check) {
4919 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
4920 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4921 }
4922 {
4923 uint32_tcxx . . $ uint32_t# l = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
4924 if (min_size <= l && l <= key_size) {
4925 if (!memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, l)) {
4926 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
4927 }
4928 }
4929 }
4930 break;
4931 }
4932 check = ch;
4933 if (len <= check) {
4934 break;
4935 }
4936 if (PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check)) {
4937 grn_idcxx . . $ grn_id# id0 = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
4938 pat_node_commoncxx . . $ pat_node_common# *node0;
4939 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id0, node0);
4940 if (!node0) {
4941 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4942 }
4943 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node0))) {
4944 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4945 }
4946 {
4947 uint32_tcxx . . $ uint32_t# l = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node0);
4948 if (memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, l)) {
4949 break;
4950 }
4951 if (min_size <= l) {
4952 pushcxx . . $ push(82233c8eae791b0f).(c, id0, check);
4953 }
4954 }
4955 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
4956 } else {
4957 id = pat_node_get_childcxx . . $ pat_node_get_child(eb8bfb37bfad0e1c).(pat, node, nth_bitcxx . . $ `lib/pat.c:1220:9`!((uint8_t *)key, check));
4958 }
4959 }
4960 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
4961 }
4962
4963 static inline grn_rccxx . . $ grn_rc#
4964 set_cursor_ascendcxx . . $ set_cursor_ascend(90a2438889753746).(grn_ctxcxx . . $ grn_ctx# *ctx,
4965 grn_patcxx . . $ grn_pat# *pat,
4966 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
4967 const void *key,
4968 uint32_tcxx . . $ uint32_t# key_size,
4969 int flags)
4970 {
4971 grn_idcxx . . $ grn_id# id;
4972 pat_node_commoncxx . . $ pat_node_common# *node;
4973 const uint8_tcxx . . $ uint8_t# *k;
4974 int32_tcxx . . $ int32_t# r, check = -1, ch, c2;
4975 int32_tcxx . . $ int32_t# len = key_size * 16;
4976 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
4977 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, key_size);
4978 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node);
4979 for (id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node); id;) {
4980 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
4981 if (!node) {
4982 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4983 }
4984 ch = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
4985 if (ch <= check) {
4986 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
4987 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
4988 }
4989 {
4990 uint32_tcxx . . $ uint32_t# l = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
4991 if (l == key_size) {
4992 if (flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!) {
4993 if (memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, l) < 0) {
4994 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
4995 }
4996 } else {
4997 if (memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, l) <= 0) {
4998 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
4999 }
5000 }
5001 } else if (l < key_size) {
5002 if (memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, l) < 0) {
5003 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
5004 }
5005 } else {
5006 if (memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, key_size) <= 0) {
5007 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
5008 }
5009 }
5010 }
5011 break;
5012 }
5013 c2 = len < ch ? len : ch;
5014 if ((check += 2) < c2) {
5015 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
5016 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
5017 }
5018 if ((r = bitcmpcxx . . $ bitcmp(b507788d7c814a65).(key, k, check >> 1, ((c2 + 1) >> 1) - (check >> 1)))) {
5019 if (r < 0) {
5020 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), ch);
5021 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), ch);
5022 }
5023 break;
5024 }
5025 }
5026 check = ch;
5027 if (len <= check) {
5028 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), ch);
5029 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), ch);
5030 break;
5031 }
5032 if (PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check)) {
5033 if (check + 1 < len) {
5034 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
5035 } else {
5036 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), check);
5037 id = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
5038 }
5039 } else {
5040 if (nth_bitcxx . . $ `lib/pat.c:1220:9`!((uint8_t *)key, check)) {
5041 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
5042 } else {
5043 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), check);
5044 id = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
5045 }
5046 }
5047 }
5048 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
5049 }
5050
5051 static inline grn_rccxx . . $ grn_rc#
5052 set_cursor_descendcxx . . $ set_cursor_descend(90a2438889753746).(grn_ctxcxx . . $ grn_ctx# *ctx,
5053 grn_patcxx . . $ grn_pat# *pat,
5054 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
5055 const void *key,
5056 uint32_tcxx . . $ uint32_t# key_size,
5057 int flags)
5058 {
5059 grn_idcxx . . $ grn_id# id;
5060 pat_node_commoncxx . . $ pat_node_common# *node;
5061 const uint8_tcxx . . $ uint8_t# *k;
5062 int32_tcxx . . $ int32_t# r, check = -1, ch, c2;
5063 int32_tcxx . . $ int32_t# len = key_size * 16;
5064 uint8_tcxx . . $ uint8_t# keybuf[MAX_FIXED_KEY_SIZEcxx . . $ `lib/pat.c:2695:9`!];
5065 KEY_ENCODEcxx . . $ `lib/pat.c:2762:9`!(pat, keybuf, key, key_size);
5066 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node);
5067 for (id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node); id;) {
5068 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
5069 if (!node) {
5070 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
5071 }
5072 ch = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
5073 if (ch <= check) {
5074 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
5075 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
5076 }
5077 {
5078 uint32_tcxx . . $ uint32_t# l = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
5079 if (l <= key_size) {
5080 if ((flags & GRN_CURSOR_LTcxx . . $ `include/groonga/table.h:278:9`!) && l == key_size) {
5081 if (memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, l) > 0) {
5082 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
5083 }
5084 } else {
5085 if (memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, l) >= 0) {
5086 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
5087 }
5088 }
5089 } else {
5090 if (memcmpcxx . . $ memcmp(36f949851efa3055).(key, k, key_size) > 0) {
5091 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
5092 }
5093 }
5094 }
5095 break;
5096 }
5097 c2 = len < ch ? len : ch;
5098 if ((check += 2) < c2) {
5099 if (!(k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node))) {
5100 return GRN_FILE_CORRUPTcxx . . $ GRN_FILE_CORRUPT.;
5101 }
5102 if ((r = bitcmpcxx . . $ bitcmp(b507788d7c814a65).(key, k, check >> 1, ((c2 + 1) >> 1) - (check >> 1)))) {
5103 if (r >= 0) {
5104 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), ch);
5105 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), ch);
5106 }
5107 break;
5108 }
5109 }
5110 check = ch;
5111 if (len <= check) {
5112 break;
5113 }
5114 if (PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check)) {
5115 if (check + 1 < len) {
5116 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), check);
5117 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
5118 } else {
5119 id = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
5120 }
5121 } else {
5122 if (nth_bitcxx . . $ `lib/pat.c:1220:9`!((uint8_t *)key, check)) {
5123 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), check);
5124 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
5125 } else {
5126 id = pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node);
5127 }
5128 }
5129 }
5130 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
5131 }
5132
5133 static grn_pat_cursorcxx . . $ grn_pat_cursor# *
5134 grn_pat_cursor_open_by_idcxx . . $ grn_pat_cursor_open_by_id(b2668de89fd2b39a).(grn_ctxcxx . . $ grn_ctx# *ctx,
5135 grn_patcxx . . $ grn_pat# *pat,
5136 const void *min,
5137 uint32_tcxx . . $ uint32_t# min_size,
5138 const void *max,
5139 uint32_tcxx . . $ uint32_t# max_size,
5140 int offset,
5141 int limit,
5142 int flags)
5143 {
5144 int dir;
5145 grn_pat_cursorcxx . . $ grn_pat_cursor# *c;
5146 if (!pat || !ctx) {
5147 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5148 }
5149 if (!(c = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_pat_cursor)))) {
5150 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5151 }
5152 GRN_DB_OBJ_SET_TYPEcxx . . $ `lib/grn_ctx.h:195:9`!(c, GRN_CURSOR_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:886:9`!);
5153 c->patcxx . . $ _grn_pat_cursor#pat. = pat;
5154 c->ctxcxx . . $ _grn_pat_cursor#ctx. = ctx;
5155 c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. = flags;
5156 c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..domaincxx . . $ _grn_obj_header#domain. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5157 c->sizecxx . . $ _grn_pat_cursor#size. = 0;
5158 c->spcxx . . $ _grn_pat_cursor#sp. = 0;
5159 c->sscxx . . $ _grn_pat_cursor#ss. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5160 c->tailcxx . . $ _grn_pat_cursor#tail. = 0;
5161 if (flags & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
5162 dir = -1;
5163 if (max) {
5164 if (!(c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, max, max_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!))) {
5165 c->tailcxx . . $ _grn_pat_cursor#tail. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5166 goto exit;
5167 }
5168 if (!(flags & GRN_CURSOR_LTcxx . . $ `include/groonga/table.h:278:9`!)) {
5169 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.++;
5170 }
5171 } else {
5172 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec. + 1;
5173 }
5174 if (min) {
5175 if (!(c->tailcxx . . $ _grn_pat_cursor#tail. = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, min, min_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!))) {
5176 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5177 goto exit;
5178 }
5179 if ((flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!)) {
5180 c->tailcxx . . $ _grn_pat_cursor#tail.++;
5181 }
5182 } else {
5183 c->tailcxx . . $ _grn_pat_cursor#tail. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`! + 1;
5184 }
5185 if (c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. < c->tailcxx . . $ _grn_pat_cursor#tail.) {
5186 c->tailcxx . . $ _grn_pat_cursor#tail. = c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.;
5187 }
5188 } else {
5189 dir = 1;
5190 if (min) {
5191 if (!(c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, min, min_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!))) {
5192 c->tailcxx . . $ _grn_pat_cursor#tail. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5193 goto exit;
5194 }
5195 if (!(flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!)) {
5196 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.--;
5197 }
5198 } else {
5199 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5200 }
5201 if (max) {
5202 if (!(c->tailcxx . . $ _grn_pat_cursor#tail. = grn_pat_getcxx . . $ grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, max, max_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!))) {
5203 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5204 goto exit;
5205 }
5206 if ((flags & GRN_CURSOR_LTcxx . . $ `include/groonga/table.h:278:9`!)) {
5207 c->tailcxx . . $ _grn_pat_cursor#tail.--;
5208 }
5209 } else {
5210 c->tailcxx . . $ _grn_pat_cursor#tail. = pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec.;
5211 }
5212 if (c->tailcxx . . $ _grn_pat_cursor#tail. < c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.) {
5213 c->tailcxx . . $ _grn_pat_cursor#tail. = c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.;
5214 }
5215 }
5216 if (pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages.) {
5217 while (offset && c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. != c->tailcxx . . $ _grn_pat_cursor#tail.) {
5218 uint32_tcxx . . $ uint32_t# key_size;
5219 const void *key;
5220 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. += dir;
5221 key = _grn_pat_keycxx . . $ _grn_pat_key(5b74e3d4f3bf1aa4).(ctx, pat, c->curr_reccxx . . $ _grn_pat_cursor#curr_rec., &key_size);
5222 if (_grn_pat_getcxx . . $ _grn_pat_get(fa992a8ddbc8af6f).(ctx, pat, key, key_size, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) == c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.) {
5223 offset--;
5224 }
5225 }
5226 } else {
5227 if ((int)(dir * (c->tailcxx . . $ _grn_pat_cursor#tail. - c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.)) < offset) {
5228 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = c->tailcxx . . $ _grn_pat_cursor#tail.;
5229 } else {
5230 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. += dir * offset;
5231 }
5232 }
5233 c->restcxx . . $ _grn_pat_cursor#rest. = (limit < 0) ? GRN_ID_MAXcxx . . $ `include/groonga/groonga.h:56:9`! : limit;
5234 exit:
5235 return c;
5236 }
5237
5238 static grn_rccxx . . $ grn_rc#
5239 set_cursor_rkcxx . . $ set_cursor_rk(90a2438889753746).(grn_ctxcxx . . $ grn_ctx# *ctx,
5240 grn_patcxx . . $ grn_pat# *pat,
5241 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
5242 const void *key,
5243 uint32_tcxx . . $ uint32_t# key_size,
5244 int flags);
5245
5246 grn_pat_cursorcxx . . $ grn_pat_cursor# *
5247 grn_pat_cursor_opencxx . . $ grn_pat_cursor_open(b2668de89fd2b39a).(grn_ctxcxx . . $ grn_ctx# *ctx,
5248 grn_patcxx . . $ grn_pat# *pat,
5249 const void *min,
5250 uint32_tcxx . . $ uint32_t# min_size,
5251 const void *max,
5252 uint32_tcxx . . $ uint32_t# max_size,
5253 int offset,
5254 int limit,
5255 int flags)
5256 {
5257 grn_idcxx . . $ grn_id# id;
5258 pat_node_commoncxx . . $ pat_node_common# *node;
5259 grn_pat_cursorcxx . . $ grn_pat_cursor# *c;
5260 if (!pat || !ctx) {
5261 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5262 }
5263 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
5264 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5265 }
5266 if ((flags & GRN_CURSOR_BY_IDcxx . . $ `include/groonga/table.h:280:9`!)) {
5267 return grn_pat_cursor_open_by_idcxx . . $ grn_pat_cursor_open_by_id(b2668de89fd2b39a).(ctx,
5268 pat,
5269 min,
5270 min_size,
5271 max,
5272 max_size,
5273 offset,
5274 limit,
5275 flags);
5276 }
5277 if (!(c = GRN_CALLOCcxx . . $ `lib/grn_alloc.h:42:9`!(sizeof(grn_pat_cursor)))) {
5278 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5279 }
5280 GRN_DB_OBJ_SET_TYPEcxx . . $ `lib/grn_ctx.h:195:9`!(c, GRN_CURSOR_TABLE_PAT_KEYcxx . . $ `include/groonga/groonga.h:886:9`!);
5281 c->patcxx . . $ _grn_pat_cursor#pat. = pat;
5282 c->ctxcxx . . $ _grn_pat_cursor#ctx. = ctx;
5283 c->sizecxx . . $ _grn_pat_cursor#size. = 0;
5284 c->spcxx . . $ _grn_pat_cursor#sp. = 0;
5285 c->sscxx . . $ _grn_pat_cursor#ss. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5286 c->tailcxx . . $ _grn_pat_cursor#tail. = 0;
5287 c->restcxx . . $ _grn_pat_cursor#rest. = GRN_ID_MAXcxx . . $ `include/groonga/groonga.h:56:9`!;
5288 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5289 c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..domaincxx . . $ _grn_obj_header#domain. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5290 if (flags & GRN_CURSOR_PREFIXcxx . . $ `include/groonga/table.h:281:9`!) {
5291 if (max && max_size) {
5292 if ((pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_VAR_SIZEcxx . . $ `include/groonga/groonga.h:820:9`!)) {
5293 set_cursor_common_prefixcxx . . $ set_cursor_common_prefix(5c9d444d27147bbe).(ctx, pat, c, min_size, max, max_size, flags);
5294 } else {
5295 set_cursor_nearcxx . . $ set_cursor_near(5f7b65b68792d090).(ctx, pat, c, min_size, max, flags);
5296 }
5297 goto exit;
5298 } else {
5299 if (min && min_size) {
5300 if (flags & GRN_CURSOR_RKcxx . . $ `include/groonga/table.h:283:9`!) {
5301 set_cursor_rkcxx . . $ set_cursor_rk(90a2438889753746).(ctx, pat, c, min, min_size, flags);
5302 } else {
5303 set_cursor_prefixcxx . . $ set_cursor_prefix(90a2438889753746).(ctx, pat, c, min, min_size, flags);
5304 }
5305 goto exit;
5306 }
5307 }
5308 }
5309 if (flags & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
5310 if (min && min_size) {
5311 set_cursor_ascendcxx . . $ set_cursor_ascend(90a2438889753746).(ctx, pat, c, min, min_size, flags);
5312 c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. = GRN_CURSOR_ASCENDINGcxx . . $ `include/groonga/table.h:273:9`!;
5313 c->tailcxx . . $ _grn_pat_cursor#tail. = grn_pat_cursor_nextcxx . . $ grn_pat_cursor_next(5452c9aa69698298).(ctx, c);
5314 c->spcxx . . $ _grn_pat_cursor#sp. = 0;
5315 if (!c->tailcxx . . $ _grn_pat_cursor#tail.) {
5316 goto exit;
5317 }
5318 }
5319 if (max && max_size) {
5320 set_cursor_descendcxx . . $ set_cursor_descend(90a2438889753746).(ctx, pat, c, max, max_size, flags);
5321 } else {
5322 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node);
5323 if (!node) {
5324 grn_pat_cursor_closecxx . . $ grn_pat_cursor_close(e6719157d7b0b236).(ctx, c);
5325 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5326 }
5327 if ((id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node))) {
5328 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
5329 if (node) {
5330 grn_pat_cursor_pushcxx . . $ grn_pat_cursor_push(99ee5ab13fbe25b7).(ctx, c, GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!, pat, node);
5331 }
5332 }
5333 }
5334 } else {
5335 if (max && max_size) {
5336 set_cursor_descendcxx . . $ set_cursor_descend(90a2438889753746).(ctx, pat, c, max, max_size, flags);
5337 c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. = GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!;
5338 c->tailcxx . . $ _grn_pat_cursor#tail. = grn_pat_cursor_nextcxx . . $ grn_pat_cursor_next(5452c9aa69698298).(ctx, c);
5339 c->spcxx . . $ _grn_pat_cursor#sp. = 0;
5340 if (!c->tailcxx . . $ _grn_pat_cursor#tail.) {
5341 goto exit;
5342 }
5343 }
5344 if (min && min_size) {
5345 set_cursor_ascendcxx . . $ set_cursor_ascend(90a2438889753746).(ctx, pat, c, min, min_size, flags);
5346 } else {
5347 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node);
5348 if (!node) {
5349 grn_pat_cursor_closecxx . . $ grn_pat_cursor_close(e6719157d7b0b236).(ctx, c);
5350 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5351 }
5352 if ((id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node))) {
5353 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
5354 if (node) {
5355 grn_pat_cursor_pushcxx . . $ grn_pat_cursor_push(99ee5ab13fbe25b7).(ctx, c, GRN_CURSOR_ASCENDINGcxx . . $ `include/groonga/table.h:273:9`!, pat, node);
5356 }
5357 }
5358 }
5359 }
5360 exit:
5361 c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. = flags;
5362 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec. = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
5363 while (offset--) {
5364 grn_pat_cursor_nextcxx . . $ grn_pat_cursor_next(5452c9aa69698298).(ctx, c);
5365 }
5366 c->restcxx . . $ _grn_pat_cursor#rest. = (limit < 0) ? GRN_ID_MAXcxx . . $ `include/groonga/groonga.h:56:9`! : limit;
5367 return c;
5368 }
5369
5370 int
5371 grn_pat_cursor_get_keycxx . . $ grn_pat_cursor_get_key(3a79fc7dedfdc985).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_cursorcxx . . $ grn_pat_cursor# *c, void **key)
5372 {
5373 *key = c->curr_keycxx . . $ _grn_pat_cursor#curr_key.;
5374 return grn_pat_get_keycxx . . $ grn_pat_get_key(52cd598958564ca7).(ctx,
5375 c->patcxx . . $ _grn_pat_cursor#pat.,
5376 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.,
5377 *key,
5378 GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!);
5379 }
5380
5381 int
5382 grn_pat_cursor_get_valuecxx . . $ grn_pat_cursor_get_value(3a79fc7dedfdc985).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_cursorcxx . . $ grn_pat_cursor# *c, void **value)
5383 {
5384 int value_size = (int)c->patcxx . . $ _grn_pat_cursor#pat.->value_sizecxx . . $ _grn_pat#value_size.;
5385 if (value_size) {
5386 bytecxx . . $ byte# *v = (bytecxx . . $ byte# *)sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, c->patcxx . . $ _grn_pat_cursor#pat., c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.);
5387 if (v) {
5388 if (c->patcxx . . $ _grn_pat_cursor#pat.->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
5389 *value = v + sizeof(sis_nodecxx . . $ sis_node#);
5390 } else {
5391 *value = v;
5392 }
5393 } else {
5394 *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5395 }
5396 }
5397 return value_size;
5398 }
5399
5400 int
5401 grn_pat_cursor_get_key_valuecxx . . $ grn_pat_cursor_get_key_value(f0ba2e396541b89a).(
5402 grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_cursorcxx . . $ grn_pat_cursor# *c, void **key, uint32_tcxx . . $ uint32_t# *key_size, void **value)
5403 {
5404 int value_size = (int)c->patcxx . . $ _grn_pat_cursor#pat.->value_sizecxx . . $ _grn_pat#value_size.;
5405 if (key_size) {
5406 *key_size = (uint32_tcxx . . $ uint32_t#)grn_pat_get_keycxx . . $ grn_pat_get_key(52cd598958564ca7).(ctx,
5407 c->patcxx . . $ _grn_pat_cursor#pat.,
5408 c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.,
5409 c->curr_keycxx . . $ _grn_pat_cursor#curr_key.,
5410 GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!);
5411 if (key) {
5412 *key = c->curr_keycxx . . $ _grn_pat_cursor#curr_key.;
5413 }
5414 }
5415 if (value && value_size) {
5416 bytecxx . . $ byte# *v = (bytecxx . . $ byte# *)sis_atcxx . . $ sis_at(59e5564d0351a00f).(ctx, c->patcxx . . $ _grn_pat_cursor#pat., c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.);
5417 if (v) {
5418 if (c->patcxx . . $ _grn_pat_cursor#pat.->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_OBJ_KEY_WITH_SIScxx . . $ `include/groonga/groonga.h:712:9`!) {
5419 *value = v + sizeof(sis_nodecxx . . $ sis_node#);
5420 } else {
5421 *value = v;
5422 }
5423 } else {
5424 *value = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5425 }
5426 }
5427 return value_size;
5428 }
5429
5430 grn_rccxx . . $ grn_rc#
5431 grn_pat_cursor_set_valuecxx . . $ grn_pat_cursor_set_value(62840828431e96f6).(grn_ctxcxx . . $ grn_ctx# *ctx,
5432 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
5433 const void *value,
5434 int flags)
5435 {
5436 return grn_pat_set_valuecxx . . $ grn_pat_set_value(d5f8c516acb30a1b).(ctx, c->patcxx . . $ _grn_pat_cursor#pat., c->curr_reccxx . . $ _grn_pat_cursor#curr_rec., value, flags);
5437 }
5438
5439 grn_rccxx . . $ grn_rc#
5440 grn_pat_cursor_deletecxx . . $ grn_pat_cursor_delete(b2e686c9cbb8494e).(grn_ctxcxx . . $ grn_ctx# *ctx,
5441 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
5442 grn_table_delete_optargcxx . . $ grn_table_delete_optarg# *optarg)
5443 {
5444 return grn_pat_delete_by_idcxx . . $ grn_pat_delete_by_id(69fddfcd7b80a172).(ctx, c->patcxx . . $ _grn_pat_cursor#pat., c->curr_reccxx . . $ _grn_pat_cursor#curr_rec., optarg);
5445 }
5446
5447 void
5448 grn_pat_checkcxx . . $ grn_pat_check(ff189d7ae511a139).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
5449 {
5450 char buf[8];
5451 struct grn_pat_headercxx . . $ grn_pat_header# *h = pat->headercxx . . $ _grn_pat#header.;
5452 if (grn_pat_error_if_truncatedcxx . . $ grn_pat_error_if_truncated(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
5453 return;
5454 }
5455 GRN_OUTPUT_ARRAY_OPENcxx . . $ `lib/grn_output.h:93:9`!("RESULT", 1);
5456 GRN_OUTPUT_MAP_OPENcxx . . $ `lib/grn_output.h:96:9`!("SUMMARY", 23);
5457 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("flags");
5458 grn_itohcxx . . $ grn_itoh(8d45ad636653b6f2).(h->flagscxx . . $ grn_pat_header#flags., buf, 8);
5459 GRN_OUTPUT_STRcxx . . $ `lib/grn_output.h:106:9`!(buf, 8);
5460 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("key size");
5461 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->key_size);
5462 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("value_size");
5463 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->value_size);
5464 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("tokenizer");
5465 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->tokenizer);
5466 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("normalizer");
5467 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->normalizer);
5468 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("n_entries");
5469 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->n_entries);
5470 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("curr_rec");
5471 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->curr_rec);
5472 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("curr_key");
5473 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
5474 GRN_OUTPUT_UINT64cxx . . $ `lib/grn_output.h:103:9`!(h->curr_key_large);
5475 } else {
5476 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->curr_key);
5477 }
5478 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("curr_del");
5479 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->curr_del);
5480 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("curr_del2");
5481 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->curr_del2);
5482 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("curr_del3");
5483 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->curr_del3);
5484 GRN_OUTPUT_CSTRcxx . . $ `lib/grn_output.h:105:9`!("n_garbages");
5485 GRN_OUTPUT_INT64cxx . . $ `lib/grn_output.h:101:9`!(h->n_garbages);
5486 GRN_OUTPUT_MAP_CLOSEcxx . . $ `lib/grn_output.h:98:9`!();
5487 GRN_OUTPUT_ARRAY_CLOSEcxx . . $ `lib/grn_output.h:95:9`!();
5488 }
5489
5490 /* utilities */
5491 void
5492 grn_p_pat_nodecxx . . $ grn_p_pat_node(5d69d58db8d4c089).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, pat_node_commoncxx . . $ pat_node_common# *node)
5493 {
5494 uint8_tcxx . . $ uint8_t# *key = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5495
5496 if (!node) {
5497 printfcxx . . $ printf(581fddd72a8db8fc).("#<pat_node:(null)>\n");
5498 return;
5499 }
5500
5501 if (pat_node_is_key_immediatecxx . . $ pat_node_is_key_immediate(e829a7c3dd493304).(pat, node)) {
5502 key = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node);
5503 } else {
5504 KEY_ATcxx . . $ `lib/pat.c:1295:9`!(pat, pat_node_get_key_offset(pat, node), key, 0);
5505 }
5506
5507 uint16_tcxx . . $ uint16_t# check = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
5508 printfcxx . . $ printf(581fddd72a8db8fc).("#<pat_node:%p "
5509 "left:%u "
5510 "right:%u "
5511 "deleting:%s "
5512 "immediate:%s "
5513 "length:%u "
5514 "nth-byte:%u "
5515 "nth-bit:%u "
5516 "terminated:%s "
5517 "key:<%.*s>"
5518 ">\n",
5519 node,
5520 pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node),
5521 pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node),
5522 pat_node_is_deletingcxx . . $ pat_node_is_deleting(e829a7c3dd493304).(pat, node) ? "true" : "false",
5523 pat_node_is_key_immediatecxx . . $ pat_node_is_key_immediate(e829a7c3dd493304).(pat, node) ? "true" : "false",
5524 pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node),
5525 PAT_CHECK_BYTE_DIFFERENCEScxx . . $ `lib/pat.c:327:9`!(check),
5526 PAT_CHECK_BIT_DIFFERENCEScxx . . $ `lib/pat.c:329:9`!(check),
5527 PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check) ? "true" : "false",
5528 pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node),
5529 (char *)key);
5530 }
5531
5532 static void
5533 grn_pat_inspect_checkcxx . . $ grn_pat_inspect_check(abd6289432040828).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_objcxx . . $ grn_obj# *buf, int check)
5534 {
5535 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "{");
5536 grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, buf, PAT_CHECK_BYTE_DIFFERENCEScxx . . $ `lib/pat.c:327:9`!(check));
5537 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, ",");
5538 grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, buf, PAT_CHECK_BIT_DIFFERENCEScxx . . $ `lib/pat.c:329:9`!(check));
5539 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, ",");
5540 if (PAT_CHECK_IS_TERMINATEDcxx . . $ `lib/pat.c:331:9`!(check)) {
5541 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "true");
5542 } else {
5543 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "false");
5544 }
5545 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "}");
5546 }
5547
5548 static void
5549 grn_pat_inspect_nodecxx . . $ grn_pat_inspect_node(d1df0b3e37d77f0b).(grn_ctxcxx . . $ grn_ctx# *ctx,
5550 grn_patcxx . . $ grn_pat# *pat,
5551 grn_idcxx . . $ grn_id# id,
5552 int check,
5553 grn_objcxx . . $ grn_obj# *key_buf,
5554 int indent,
5555 const char *prefix,
5556 grn_objcxx . . $ grn_obj# *buf)
5557 {
5558 pat_node_commoncxx . . $ pat_node_common# *node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5559 int i, c;
5560
5561 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
5562 c = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
5563
5564 for (i = 0; i < indent; i++) {
5565 GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, buf, ' ');
5566 }
5567 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, prefix);
5568 grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, buf, id);
5569 grn_pat_inspect_checkcxx . . $ grn_pat_inspect_check(abd6289432040828).(ctx, buf, c);
5570
5571 if (c > check) {
5572 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "\n");
5573 grn_pat_inspect_nodecxx . . $ grn_pat_inspect_node(d1df0b3e37d77f0b).(ctx,
5574 pat,
5575 pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node),
5576 c,
5577 key_buf,
5578 indent + 2,
5579 "L:",
5580 buf);
5581 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "\n");
5582 grn_pat_inspect_nodecxx . . $ grn_pat_inspect_node(d1df0b3e37d77f0b).(ctx,
5583 pat,
5584 pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node),
5585 c,
5586 key_buf,
5587 indent + 2,
5588 "R:",
5589 buf);
5590 } else if (id != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
5591 int key_size;
5592 uint8_tcxx . . $ uint8_t# *key;
5593
5594 key_size = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
5595 GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(key_buf);
5596 grn_bulk_spacecxx . . $ grn_bulk_space(f9a66385f261f61d).(ctx, key_buf, key_size);
5597 grn_pat_get_keycxx . . $ grn_pat_get_key(52cd598958564ca7).(ctx, pat, id, GRN_BULK_HEADcxx . . $ `include/groonga/groonga.h:2648:9`!(key_buf), key_size);
5598 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "(");
5599 grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, buf, key_buf);
5600 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, ")");
5601
5602 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "[");
5603 key = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, node);
5604 for (i = 0; i < key_size; i++) {
5605 int j;
5606 uint8_tcxx . . $ uint8_t# byte = key[i];
5607 if (i != 0) {
5608 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, " ");
5609 }
5610 for (j = 0; j < 8; j++) {
5611 grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, buf, (byte >> (7 - j)) & 1);
5612 }
5613 }
5614 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "]");
5615 }
5616 }
5617
5618 void
5619 grn_pat_inspect_nodescxx . . $ grn_pat_inspect_nodes(542fb80be6c64613).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_objcxx . . $ grn_obj# *buf)
5620 {
5621 pat_node_commoncxx . . $ pat_node_common# *node;
5622 grn_objcxx . . $ grn_obj# key_buf;
5623
5624 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "{");
5625 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!, node);
5626 if (node) {
5627 grn_idcxx . . $ grn_id# right_node_id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
5628 if (right_node_id != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
5629 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "\n");
5630 GRN_OBJ_INITcxx . . $ `include/groonga/groonga.h:947:9`!(&key_buf, GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`!, 0, pat->obj.header.domain);
5631 grn_pat_inspect_nodecxx . . $ grn_pat_inspect_node(d1df0b3e37d77f0b).(ctx, pat, right_node_id, -1, &key_buf, 0, "", buf);
5632 GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &key_buf);
5633 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "\n");
5634 }
5635 }
5636 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "}");
5637 }
5638
5639 static void
5640 grn_pat_cursor_inspect_entriescxx . . $ grn_pat_cursor_inspect_entries(b7bb675372818c70).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_cursorcxx . . $ grn_pat_cursor# *c, grn_objcxx . . $ grn_obj# *buf)
5641 {
5642 uint32_tcxx . . $ uint32_t# i;
5643 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "[");
5644 for (i = 0; i < c->spcxx . . $ _grn_pat_cursor#sp.; i++) {
5645 grn_pat_cursor_entrycxx . . $ grn_pat_cursor_entry# *e = c->sscxx . . $ _grn_pat_cursor#ss. + i;
5646 if (i != 0) {
5647 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, ", ");
5648 }
5649 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "[");
5650 grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, buf, e->idcxx . . $ _grn_pat_cursor_entry#id.);
5651 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, ",");
5652 grn_pat_inspect_checkcxx . . $ grn_pat_inspect_check(abd6289432040828).(ctx, buf, e->checkcxx . . $ _grn_pat_cursor_entry#check.);
5653 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "]");
5654 }
5655 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "]");
5656 }
5657
5658 void
5659 grn_pat_cursor_inspectcxx . . $ grn_pat_cursor_inspect(b7bb675372818c70).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_pat_cursorcxx . . $ grn_pat_cursor# *c, grn_objcxx . . $ grn_obj# *buf)
5660 {
5661 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "#<cursor:pat:");
5662 grn_inspect_namecxx . . $ grn_inspect_name(88456f97fe0d41a).(ctx, buf, (grn_objcxx . . $ grn_obj# *)(c->patcxx . . $ _grn_pat_cursor#pat.));
5663
5664 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, " ");
5665 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "current:");
5666 grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, buf, c->curr_reccxx . . $ _grn_pat_cursor#curr_rec.);
5667
5668 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, " ");
5669 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "tail:");
5670 grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, buf, c->tailcxx . . $ _grn_pat_cursor#tail.);
5671
5672 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, " ");
5673 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "flags:");
5674 if (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_PREFIXcxx . . $ `include/groonga/table.h:281:9`!) {
5675 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "prefix");
5676 } else {
5677 if (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
5678 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "descending");
5679 } else {
5680 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "ascending");
5681 }
5682 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "|");
5683 if (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!) {
5684 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "greater-than");
5685 } else {
5686 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "greater");
5687 }
5688 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "|");
5689 if (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_LTcxx . . $ `include/groonga/table.h:278:9`!) {
5690 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "less-than");
5691 } else {
5692 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "less");
5693 }
5694 if (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_BY_IDcxx . . $ `include/groonga/table.h:280:9`!) {
5695 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "|by-id");
5696 }
5697 if (c->objcxx . . $ _grn_pat_cursor#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..flagscxx . . $ _grn_obj_header#flags. & GRN_CURSOR_BY_KEYcxx . . $ `include/groonga/table.h:279:9`!) {
5698 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "|by-key");
5699 }
5700 }
5701
5702 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, " ");
5703 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "rest:");
5704 grn_text_lltoacxx . . $ grn_text_lltoa(1b142823d3915b88).(ctx, buf, c->restcxx . . $ _grn_pat_cursor#rest.);
5705
5706 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, " ");
5707 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, "entries:");
5708 grn_pat_cursor_inspect_entriescxx . . $ grn_pat_cursor_inspect_entries(b7bb675372818c70).(ctx, c, buf);
5709
5710 GRN_TEXT_PUTScxx . . $ `include/groonga/groonga.h:2781:9`!(ctx, buf, ">");
5711 }
5712
5713 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_15# {
5714 uint8_tcxx . . $ uint8_t# codecxx . . $ $anonymous_type_d195c43ed9cfff57_15#code.;
5715 uint8_tcxx . . $ uint8_t# nextcxx . . $ $anonymous_type_d195c43ed9cfff57_15#next.;
5716 uint8_tcxx . . $ uint8_t# emitcxx . . $ $anonymous_type_d195c43ed9cfff57_15#emit.;
5717 uint8_tcxx . . $ uint8_t# attrcxx . . $ $anonymous_type_d195c43ed9cfff57_15#attr.;
5718 } rk_tree_nodecxx . . $ rk_tree_node#;
5719
5720 static uint16_tcxx . . $ uint16_t# rk_str_idxcxx . . $ rk_str_idx.[] = {
5721 0x0003, 0x0006, 0x0009, 0x000c, 0x0012, 0x0015, 0x0018, 0x001e, 0x0024,
5722 0x002a, 0x0030, 0x0036, 0x003c, 0x0042, 0x0048, 0x004e, 0x0054, 0x005a,
5723 0x0060, 0x0066, 0x006c, 0x0072, 0x0078, 0x007e, 0x0084, 0x008a, 0x0090,
5724 0x0096, 0x009c, 0x00a2, 0x00a8, 0x00ae, 0x00b4, 0x00ba, 0x00c0, 0x00c3,
5725 0x00c6, 0x00c9, 0x00cc, 0x00cf, 0x00d2, 0x00d5, 0x00db, 0x00e1, 0x00e7,
5726 0x00ea, 0x00f0, 0x00f6, 0x00fc, 0x00ff, 0x0105, 0x0108, 0x010e, 0x0111,
5727 0x0114, 0x0117, 0x011a, 0x011d, 0x0120, 0x0123, 0x0129, 0x012f, 0x0135,
5728 0x013b, 0x013e, 0x0144, 0x014a, 0x0150, 0x0156, 0x0159, 0x015c, 0x015f,
5729 0x0162, 0x0165, 0x0168, 0x016b, 0x016e, 0x0171, 0x0177, 0x017d, 0x0183,
5730 0x0189, 0x018c, 0x0192, 0x0198, 0x019e, 0x01a1, 0x01a4, 0x01aa, 0x01b0,
5731 0x01b6, 0x01bc, 0x01bf, 0x01c2, 0x01c8, 0x01ce, 0x01d1, 0x01d7, 0x01dd,
5732 0x01e0, 0x01e6, 0x01e9, 0x01ef, 0x01f2, 0x01f5, 0x01fb, 0x0201, 0x0207,
5733 0x020d, 0x0213, 0x0216, 0x0219, 0x021c, 0x021f, 0x0222, 0x0225, 0x0228,
5734 0x022e, 0x0234, 0x023a, 0x023d, 0x0243, 0x0249, 0x024f, 0x0252, 0x0258,
5735 0x025e, 0x0264, 0x0267, 0x026d, 0x0273, 0x0279, 0x027f, 0x0285, 0x0288,
5736 0x028b, 0x028e, 0x0291, 0x0294, 0x0297, 0x029a, 0x029d, 0x02a0, 0x02a3,
5737 0x02a9, 0x02af, 0x02b5, 0x02b8, 0x02bb, 0x02be, 0x02c1, 0x02c4, 0x02c7,
5738 0x02ca, 0x02cd, 0x02d0, 0x02d3, 0x02d6, 0x02dc, 0x02e2, 0x02e8, 0x02eb,
5739 0x02ee, 0x02f1, 0x02f4, 0x02f7, 0x02fa, 0x02fd, 0x0300, 0x0303, 0x0309,
5740 0x030c, 0x0312, 0x0318, 0x031e, 0x0324, 0x0327, 0x032a, 0x032d};
5741 static char rk_strcxx . . $ rk_str.[] = {
5742 0xe3, 0x82, 0xa1, 0xe3, 0x82, 0xa2, 0xe3, 0x82, 0xa3, 0xe3, 0x82, 0xa4, 0xe3,
5743 0x82, 0xa4, 0xe3, 0x82, 0xa7, 0xe3, 0x82, 0xa5, 0xe3, 0x82, 0xa6, 0xe3, 0x82,
5744 0xa6, 0xe3, 0x82, 0xa2, 0xe3, 0x82, 0xa6, 0xe3, 0x82, 0xa3, 0xe3, 0x82, 0xa6,
5745 0xe3, 0x82, 0xa4, 0xe3, 0x82, 0xa6, 0xe3, 0x82, 0xa6, 0xe3, 0x82, 0xa6, 0xe3,
5746 0x82, 0xa7, 0xe3, 0x82, 0xa6, 0xe3, 0x82, 0xa8, 0xe3, 0x82, 0xa6, 0xe3, 0x82,
5747 0xaa, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xa0, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xa1,
5748 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xa2, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xa3, 0xe3,
5749 0x82, 0xa6, 0xe3, 0x83, 0xa4, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xa5, 0xe3, 0x82,
5750 0xa6, 0xe3, 0x83, 0xa6, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xa7, 0xe3, 0x82, 0xa6,
5751 0xe3, 0x83, 0xa8, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xa9, 0xe3, 0x82, 0xa6, 0xe3,
5752 0x83, 0xaa, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xab, 0xe3, 0x82, 0xa6, 0xe3, 0x83,
5753 0xac, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xad, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xae,
5754 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xaf, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xb0, 0xe3,
5755 0x82, 0xa6, 0xe3, 0x83, 0xb1, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xb2, 0xe3, 0x82,
5756 0xa6, 0xe3, 0x83, 0xb3, 0xe3, 0x82, 0xa6, 0xe3, 0x83, 0xbc, 0xe3, 0x82, 0xa7,
5757 0xe3, 0x82, 0xa8, 0xe3, 0x82, 0xa9, 0xe3, 0x82, 0xaa, 0xe3, 0x82, 0xab, 0xe3,
5758 0x82, 0xac, 0xe3, 0x82, 0xad, 0xe3, 0x82, 0xad, 0xe3, 0x83, 0xa3, 0xe3, 0x82,
5759 0xad, 0xe3, 0x83, 0xa5, 0xe3, 0x82, 0xad, 0xe3, 0x83, 0xa7, 0xe3, 0x82, 0xae,
5760 0xe3, 0x82, 0xae, 0xe3, 0x83, 0xa3, 0xe3, 0x82, 0xae, 0xe3, 0x83, 0xa5, 0xe3,
5761 0x82, 0xae, 0xe3, 0x83, 0xa7, 0xe3, 0x82, 0xaf, 0xe3, 0x82, 0xaf, 0xe3, 0x82,
5762 0xa1, 0xe3, 0x82, 0xb0, 0xe3, 0x82, 0xb0, 0xe3, 0x82, 0xa1, 0xe3, 0x82, 0xb1,
5763 0xe3, 0x82, 0xb2, 0xe3, 0x82, 0xb3, 0xe3, 0x82, 0xb4, 0xe3, 0x82, 0xb5, 0xe3,
5764 0x82, 0xb6, 0xe3, 0x82, 0xb7, 0xe3, 0x82, 0xb7, 0xe3, 0x82, 0xa7, 0xe3, 0x82,
5765 0xb7, 0xe3, 0x83, 0xa3, 0xe3, 0x82, 0xb7, 0xe3, 0x83, 0xa5, 0xe3, 0x82, 0xb7,
5766 0xe3, 0x83, 0xa7, 0xe3, 0x82, 0xb8, 0xe3, 0x82, 0xb8, 0xe3, 0x82, 0xa7, 0xe3,
5767 0x82, 0xb8, 0xe3, 0x83, 0xa3, 0xe3, 0x82, 0xb8, 0xe3, 0x83, 0xa5, 0xe3, 0x82,
5768 0xb8, 0xe3, 0x83, 0xa7, 0xe3, 0x82, 0xb9, 0xe3, 0x82, 0xba, 0xe3, 0x82, 0xbb,
5769 0xe3, 0x82, 0xbc, 0xe3, 0x82, 0xbd, 0xe3, 0x82, 0xbe, 0xe3, 0x82, 0xbf, 0xe3,
5770 0x83, 0x80, 0xe3, 0x83, 0x81, 0xe3, 0x83, 0x81, 0xe3, 0x82, 0xa7, 0xe3, 0x83,
5771 0x81, 0xe3, 0x83, 0xa3, 0xe3, 0x83, 0x81, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0x81,
5772 0xe3, 0x83, 0xa7, 0xe3, 0x83, 0x82, 0xe3, 0x83, 0x82, 0xe3, 0x83, 0xa3, 0xe3,
5773 0x83, 0x82, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0x82, 0xe3, 0x83, 0xa7, 0xe3, 0x83,
5774 0x83, 0xe3, 0x83, 0x84, 0xe3, 0x83, 0x84, 0xe3, 0x82, 0xa1, 0xe3, 0x83, 0x84,
5775 0xe3, 0x82, 0xa3, 0xe3, 0x83, 0x84, 0xe3, 0x82, 0xa7, 0xe3, 0x83, 0x84, 0xe3,
5776 0x82, 0xa9, 0xe3, 0x83, 0x85, 0xe3, 0x83, 0x86, 0xe3, 0x83, 0x86, 0xe3, 0x82,
5777 0xa3, 0xe3, 0x83, 0x86, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0x87, 0xe3, 0x83, 0x87,
5778 0xe3, 0x82, 0xa3, 0xe3, 0x83, 0x87, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0x88, 0xe3,
5779 0x83, 0x88, 0xe3, 0x82, 0xa5, 0xe3, 0x83, 0x89, 0xe3, 0x83, 0x89, 0xe3, 0x82,
5780 0xa5, 0xe3, 0x83, 0x8a, 0xe3, 0x83, 0x8b, 0xe3, 0x83, 0x8b, 0xe3, 0x82, 0xa3,
5781 0xe3, 0x83, 0x8b, 0xe3, 0x82, 0xa7, 0xe3, 0x83, 0x8b, 0xe3, 0x83, 0xa3, 0xe3,
5782 0x83, 0x8b, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0x8b, 0xe3, 0x83, 0xa7, 0xe3, 0x83,
5783 0x8c, 0xe3, 0x83, 0x8d, 0xe3, 0x83, 0x8e, 0xe3, 0x83, 0x8f, 0xe3, 0x83, 0x90,
5784 0xe3, 0x83, 0x91, 0xe3, 0x83, 0x92, 0xe3, 0x83, 0x92, 0xe3, 0x83, 0xa3, 0xe3,
5785 0x83, 0x92, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0x92, 0xe3, 0x83, 0xa7, 0xe3, 0x83,
5786 0x93, 0xe3, 0x83, 0x93, 0xe3, 0x83, 0xa3, 0xe3, 0x83, 0x93, 0xe3, 0x83, 0xa5,
5787 0xe3, 0x83, 0x93, 0xe3, 0x83, 0xa7, 0xe3, 0x83, 0x94, 0xe3, 0x83, 0x94, 0xe3,
5788 0x83, 0xa3, 0xe3, 0x83, 0x94, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0x94, 0xe3, 0x83,
5789 0xa7, 0xe3, 0x83, 0x95, 0xe3, 0x83, 0x95, 0xe3, 0x82, 0xa1, 0xe3, 0x83, 0x95,
5790 0xe3, 0x82, 0xa3, 0xe3, 0x83, 0x95, 0xe3, 0x82, 0xa7, 0xe3, 0x83, 0x95, 0xe3,
5791 0x82, 0xa9, 0xe3, 0x83, 0x95, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0x96, 0xe3, 0x83,
5792 0x97, 0xe3, 0x83, 0x98, 0xe3, 0x83, 0x99, 0xe3, 0x83, 0x9a, 0xe3, 0x83, 0x9b,
5793 0xe3, 0x83, 0x9c, 0xe3, 0x83, 0x9d, 0xe3, 0x83, 0x9e, 0xe3, 0x83, 0x9f, 0xe3,
5794 0x83, 0x9f, 0xe3, 0x83, 0xa3, 0xe3, 0x83, 0x9f, 0xe3, 0x83, 0xa5, 0xe3, 0x83,
5795 0x9f, 0xe3, 0x83, 0xa7, 0xe3, 0x83, 0xa0, 0xe3, 0x83, 0xa1, 0xe3, 0x83, 0xa2,
5796 0xe3, 0x83, 0xa3, 0xe3, 0x83, 0xa4, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0xa6, 0xe3,
5797 0x83, 0xa7, 0xe3, 0x83, 0xa8, 0xe3, 0x83, 0xa9, 0xe3, 0x83, 0xaa, 0xe3, 0x83,
5798 0xaa, 0xe3, 0x83, 0xa3, 0xe3, 0x83, 0xaa, 0xe3, 0x83, 0xa5, 0xe3, 0x83, 0xaa,
5799 0xe3, 0x83, 0xa7, 0xe3, 0x83, 0xab, 0xe3, 0x83, 0xac, 0xe3, 0x83, 0xad, 0xe3,
5800 0x83, 0xae, 0xe3, 0x83, 0xaf, 0xe3, 0x83, 0xb0, 0xe3, 0x83, 0xb1, 0xe3, 0x83,
5801 0xb2, 0xe3, 0x83, 0xb3, 0xe3, 0x83, 0xb3, 0xe3, 0x83, 0xbc, 0xe3, 0x83, 0xb4,
5802 0xe3, 0x83, 0xb4, 0xe3, 0x82, 0xa1, 0xe3, 0x83, 0xb4, 0xe3, 0x82, 0xa3, 0xe3,
5803 0x83, 0xb4, 0xe3, 0x82, 0xa7, 0xe3, 0x83, 0xb4, 0xe3, 0x82, 0xa9, 0xe3, 0x83,
5804 0xb5, 0xe3, 0x83, 0xb6, 0xe3, 0x83, 0xbc};
5805 static uint16_tcxx . . $ uint16_t# rk_tree_idxcxx . . $ rk_tree_idx.[] = {
5806 0x001b, 0x0022, 0x0025, 0x0028, 0x002d, 0x0030, 0x0039, 0x003b, 0x003c,
5807 0x003f, 0x0046, 0x0047, 0x004f, 0x0050, 0x0053, 0x005a, 0x005d, 0x0064,
5808 0x0067, 0x006f, 0x0070, 0x0073, 0x007d, 0x007f, 0x0081, 0x0082, 0x0083,
5809 0x0088, 0x008f, 0x0092, 0x00af, 0x00b5, 0x00bc, 0x00bf, 0x00c6, 0x00c9,
5810 0x00d1, 0x00d6, 0x00da, 0x00e4, 0x00e6, 0x00eb, 0x00ec, 0x00f0, 0x00f6,
5811 0x00fc, 0x00fe, 0x0108, 0x010a, 0x010c, 0x010d, 0x010e, 0x0113, 0x0118,
5812 0x011f, 0x0123, 0x0125, 0x0164, 0x0180, 0x0183, 0x0199, 0x01ad};
5813 static rk_tree_nodecxx . . $ rk_tree_node# rk_treecxx . . $ rk_tree.[] = {
5814 {0x2d, 0x00, 0xb2, 0x01}, {0x61, 0x00, 0x01, 0x01}, {0x62, 0x01, 0xff, 0x01},
5815 {0x63, 0x03, 0xff, 0x01}, {0x64, 0x06, 0xff, 0x01}, {0x65, 0x00, 0x24, 0x01},
5816 {0x66, 0x0a, 0xff, 0x01}, {0x67, 0x0c, 0xff, 0x01}, {0x68, 0x0f, 0xff, 0x01},
5817 {0x69, 0x00, 0x03, 0x01}, {0x6a, 0x11, 0xff, 0x01}, {0x6b, 0x13, 0xff, 0x01},
5818 {0x6c, 0x16, 0xff, 0x01}, {0x6d, 0x1c, 0xff, 0x01}, {0x6e, 0x1e, 0xff, 0x01},
5819 {0x6f, 0x00, 0x26, 0x01}, {0x70, 0x20, 0xff, 0x01}, {0x72, 0x22, 0xff, 0x01},
5820 {0x73, 0x24, 0xff, 0x01}, {0x74, 0x27, 0xff, 0x01}, {0x75, 0x00, 0x06, 0x01},
5821 {0x76, 0x2c, 0xff, 0x01}, {0x77, 0x2d, 0xff, 0x01}, {0x78, 0x2f, 0xff, 0x01},
5822 {0x79, 0x35, 0xff, 0x01}, {0x7a, 0x36, 0xff, 0x01}, {0xe3, 0x38, 0xff, 0x01},
5823 {0x61, 0x00, 0x72, 0x01}, {0x62, 0x01, 0x56, 0x01}, {0x65, 0x00, 0x89, 0x01},
5824 {0x69, 0x00, 0x78, 0x01}, {0x6f, 0x00, 0x8c, 0x01}, {0x75, 0x00, 0x86, 0x01},
5825 {0x79, 0x02, 0xff, 0x00}, {0x61, 0x00, 0x79, 0x01}, {0x6f, 0x00, 0x7b, 0x01},
5826 {0x75, 0x00, 0x7a, 0x01}, {0x63, 0x03, 0x56, 0x01}, {0x68, 0x04, 0xff, 0x01},
5827 {0x79, 0x05, 0xff, 0x01}, {0x61, 0x00, 0x4f, 0x00}, {0x65, 0x00, 0x4e, 0x00},
5828 {0x69, 0x00, 0x4d, 0x01}, {0x6f, 0x00, 0x51, 0x00}, {0x75, 0x00, 0x50, 0x00},
5829 {0x61, 0x00, 0x4f, 0x01}, {0x6f, 0x00, 0x51, 0x01}, {0x75, 0x00, 0x50, 0x01},
5830 {0x61, 0x00, 0x4c, 0x01}, {0x64, 0x06, 0x56, 0x01}, {0x65, 0x00, 0x60, 0x01},
5831 {0x68, 0x07, 0xff, 0x00}, {0x69, 0x00, 0x61, 0x00}, {0x6f, 0x00, 0x65, 0x01},
5832 {0x75, 0x00, 0x5c, 0x01}, {0x77, 0x08, 0xff, 0x00}, {0x79, 0x09, 0xff, 0x01},
5833 {0x69, 0x00, 0x61, 0x01}, {0x75, 0x00, 0x62, 0x01}, {0x75, 0x00, 0x66, 0x01},
5834 {0x61, 0x00, 0x53, 0x01}, {0x6f, 0x00, 0x55, 0x01}, {0x75, 0x00, 0x54, 0x01},
5835 {0x61, 0x00, 0x81, 0x00}, {0x65, 0x00, 0x83, 0x00}, {0x66, 0x0a, 0x56, 0x01},
5836 {0x69, 0x00, 0x82, 0x00}, {0x6f, 0x00, 0x84, 0x00}, {0x75, 0x00, 0x80, 0x01},
5837 {0x79, 0x0b, 0xff, 0x00}, {0x75, 0x00, 0x85, 0x01}, {0x61, 0x00, 0x28, 0x01},
5838 {0x65, 0x00, 0x36, 0x01}, {0x67, 0x0c, 0x56, 0x01}, {0x69, 0x00, 0x2d, 0x01},
5839 {0x6f, 0x00, 0x38, 0x01}, {0x75, 0x00, 0x33, 0x01}, {0x77, 0x0d, 0xff, 0x00},
5840 {0x79, 0x0e, 0xff, 0x00}, {0x61, 0x00, 0x34, 0x01}, {0x61, 0x00, 0x2e, 0x01},
5841 {0x6f, 0x00, 0x30, 0x01}, {0x75, 0x00, 0x2f, 0x01}, {0x61, 0x00, 0x71, 0x01},
5842 {0x65, 0x00, 0x88, 0x01}, {0x68, 0x0f, 0x56, 0x01}, {0x69, 0x00, 0x74, 0x01},
5843 {0x6f, 0x00, 0x8b, 0x01}, {0x75, 0x00, 0x80, 0x01}, {0x79, 0x10, 0xff, 0x00},
5844 {0x61, 0x00, 0x75, 0x01}, {0x6f, 0x00, 0x77, 0x01}, {0x75, 0x00, 0x76, 0x01},
5845 {0x61, 0x00, 0x42, 0x00}, {0x65, 0x00, 0x41, 0x00}, {0x69, 0x00, 0x40, 0x01},
5846 {0x6a, 0x11, 0x56, 0x01}, {0x6f, 0x00, 0x44, 0x00}, {0x75, 0x00, 0x43, 0x00},
5847 {0x79, 0x12, 0xff, 0x00}, {0x61, 0x00, 0x42, 0x01}, {0x6f, 0x00, 0x44, 0x01},
5848 {0x75, 0x00, 0x43, 0x01}, {0x61, 0x00, 0x27, 0x01}, {0x65, 0x00, 0x35, 0x01},
5849 {0x69, 0x00, 0x29, 0x01}, {0x6b, 0x13, 0x56, 0x01}, {0x6f, 0x00, 0x37, 0x01},
5850 {0x75, 0x00, 0x31, 0x01}, {0x77, 0x14, 0xff, 0x00}, {0x79, 0x15, 0xff, 0x00},
5851 {0x61, 0x00, 0x32, 0x01}, {0x61, 0x00, 0x2a, 0x01}, {0x6f, 0x00, 0x2c, 0x01},
5852 {0x75, 0x00, 0x2b, 0x01}, {0x61, 0x00, 0x00, 0x01}, {0x65, 0x00, 0x23, 0x01},
5853 {0x69, 0x00, 0x02, 0x01}, {0x6b, 0x17, 0xff, 0x01}, {0x6c, 0x16, 0x56, 0x01},
5854 {0x6f, 0x00, 0x25, 0x01}, {0x74, 0x18, 0xff, 0x01}, {0x75, 0x00, 0x05, 0x01},
5855 {0x77, 0x1a, 0xff, 0x01}, {0x79, 0x1b, 0xff, 0x01}, {0x61, 0x00, 0xb0, 0x01},
5856 {0x65, 0x00, 0xb1, 0x01}, {0x73, 0x19, 0xff, 0x00}, {0x75, 0x00, 0x56, 0x01},
5857 {0x75, 0x00, 0x56, 0x01}, {0x61, 0x00, 0xa4, 0x01}, {0x61, 0x00, 0x96, 0x01},
5858 {0x65, 0x00, 0x23, 0x01}, {0x69, 0x00, 0x02, 0x01}, {0x6f, 0x00, 0x9a, 0x01},
5859 {0x75, 0x00, 0x98, 0x01}, {0x61, 0x00, 0x8e, 0x01}, {0x65, 0x00, 0x94, 0x01},
5860 {0x69, 0x00, 0x8f, 0x01}, {0x6d, 0x1c, 0x56, 0x01}, {0x6f, 0x00, 0x95, 0x01},
5861 {0x75, 0x00, 0x93, 0x01}, {0x79, 0x1d, 0xff, 0x00}, {0x61, 0x00, 0x90, 0x01},
5862 {0x6f, 0x00, 0x92, 0x01}, {0x75, 0x00, 0x91, 0x01}, {0x00, 0x00, 0xa9, 0x01},
5863 {0x27, 0x00, 0xa9, 0x00}, {0x2d, 0x00, 0xaa, 0x00}, {0x61, 0x00, 0x67, 0x01},
5864 {0x62, 0x01, 0xa9, 0x00}, {0x63, 0x03, 0xa9, 0x00}, {0x64, 0x06, 0xa9, 0x00},
5865 {0x65, 0x00, 0x6f, 0x01}, {0x66, 0x0a, 0xa9, 0x00}, {0x67, 0x0c, 0xa9, 0x00},
5866 {0x68, 0x0f, 0xa9, 0x00}, {0x69, 0x00, 0x68, 0x01}, {0x6a, 0x11, 0xa9, 0x00},
5867 {0x6b, 0x13, 0xa9, 0x00}, {0x6c, 0x16, 0xa9, 0x00}, {0x6d, 0x1c, 0xa9, 0x00},
5868 {0x6e, 0x00, 0xa9, 0x00}, {0x6f, 0x00, 0x70, 0x01}, {0x70, 0x20, 0xa9, 0x00},
5869 {0x72, 0x22, 0xa9, 0x00}, {0x73, 0x24, 0xa9, 0x00}, {0x74, 0x27, 0xa9, 0x00},
5870 {0x75, 0x00, 0x6e, 0x01}, {0x76, 0x2c, 0xa9, 0x00}, {0x77, 0x2d, 0xa9, 0x00},
5871 {0x78, 0x2f, 0xa9, 0x00}, {0x79, 0x1f, 0xff, 0x00}, {0x7a, 0x36, 0xa9, 0x00},
5872 {0xe3, 0x38, 0xa9, 0x00}, {0x00, 0x00, 0xa9, 0x01}, {0x61, 0x00, 0x6b, 0x01},
5873 {0x65, 0x00, 0x6a, 0x01}, {0x69, 0x00, 0x69, 0x01}, {0x6f, 0x00, 0x6d, 0x01},
5874 {0x75, 0x00, 0x6c, 0x01}, {0x61, 0x00, 0x73, 0x01}, {0x65, 0x00, 0x8a, 0x01},
5875 {0x69, 0x00, 0x7c, 0x01}, {0x6f, 0x00, 0x8d, 0x01}, {0x70, 0x20, 0x56, 0x01},
5876 {0x75, 0x00, 0x87, 0x01}, {0x79, 0x21, 0xff, 0x00}, {0x61, 0x00, 0x7d, 0x01},
5877 {0x6f, 0x00, 0x7f, 0x01}, {0x75, 0x00, 0x7e, 0x01}, {0x61, 0x00, 0x9c, 0x01},
5878 {0x65, 0x00, 0xa2, 0x01}, {0x69, 0x00, 0x9d, 0x01}, {0x6f, 0x00, 0xa3, 0x01},
5879 {0x72, 0x22, 0x56, 0x01}, {0x75, 0x00, 0xa1, 0x01}, {0x79, 0x23, 0xff, 0x00},
5880 {0x61, 0x00, 0x9e, 0x01}, {0x6f, 0x00, 0xa0, 0x01}, {0x75, 0x00, 0x9f, 0x01},
5881 {0x61, 0x00, 0x39, 0x01}, {0x65, 0x00, 0x47, 0x01}, {0x68, 0x25, 0xff, 0x00},
5882 {0x69, 0x00, 0x3b, 0x01}, {0x6f, 0x00, 0x49, 0x01}, {0x73, 0x24, 0x56, 0x01},
5883 {0x75, 0x00, 0x45, 0x01}, {0x79, 0x26, 0xff, 0x00}, {0x61, 0x00, 0x3d, 0x00},
5884 {0x65, 0x00, 0x3c, 0x00}, {0x69, 0x00, 0x3b, 0x01}, {0x6f, 0x00, 0x3f, 0x00},
5885 {0x75, 0x00, 0x3e, 0x00}, {0x61, 0x00, 0x3d, 0x01}, {0x65, 0x00, 0x3c, 0x01},
5886 {0x6f, 0x00, 0x3f, 0x01}, {0x75, 0x00, 0x3e, 0x01}, {0x61, 0x00, 0x4b, 0x01},
5887 {0x65, 0x00, 0x5d, 0x01}, {0x68, 0x28, 0xff, 0x00}, {0x69, 0x00, 0x4d, 0x01},
5888 {0x6f, 0x00, 0x63, 0x01}, {0x73, 0x29, 0xff, 0x00}, {0x74, 0x27, 0x56, 0x01},
5889 {0x75, 0x00, 0x57, 0x01}, {0x77, 0x2a, 0xff, 0x00}, {0x79, 0x2b, 0xff, 0x00},
5890 {0x69, 0x00, 0x5e, 0x01}, {0x75, 0x00, 0x5f, 0x01}, {0x61, 0x00, 0x58, 0x00},
5891 {0x65, 0x00, 0x5a, 0x00}, {0x69, 0x00, 0x59, 0x00}, {0x6f, 0x00, 0x5b, 0x00},
5892 {0x75, 0x00, 0x57, 0x01}, {0x75, 0x00, 0x64, 0x01}, {0x61, 0x00, 0x4f, 0x01},
5893 {0x65, 0x00, 0x4e, 0x01}, {0x6f, 0x00, 0x51, 0x01}, {0x75, 0x00, 0x50, 0x01},
5894 {0x61, 0x00, 0xac, 0x00}, {0x65, 0x00, 0xae, 0x00}, {0x69, 0x00, 0xad, 0x00},
5895 {0x6f, 0x00, 0xaf, 0x00}, {0x75, 0x00, 0xab, 0x01}, {0x76, 0x2c, 0x56, 0x01},
5896 {0x61, 0x00, 0xa5, 0x01}, {0x65, 0x00, 0x0b, 0x01}, {0x69, 0x00, 0x08, 0x01},
5897 {0x6f, 0x00, 0xa8, 0x01}, {0x77, 0x2d, 0x56, 0x01}, {0x79, 0x2e, 0xff, 0x01},
5898 {0x65, 0x00, 0xa7, 0x01}, {0x69, 0x00, 0xa6, 0x01}, {0x61, 0x00, 0x00, 0x01},
5899 {0x65, 0x00, 0x23, 0x01}, {0x69, 0x00, 0x02, 0x01}, {0x6b, 0x30, 0xff, 0x01},
5900 {0x6f, 0x00, 0x25, 0x01}, {0x74, 0x31, 0xff, 0x01}, {0x75, 0x00, 0x05, 0x01},
5901 {0x77, 0x33, 0xff, 0x01}, {0x78, 0x2f, 0x56, 0x01}, {0x79, 0x34, 0xff, 0x01},
5902 {0x61, 0x00, 0xb0, 0x01}, {0x65, 0x00, 0xb1, 0x01}, {0x73, 0x32, 0xff, 0x00},
5903 {0x75, 0x00, 0x56, 0x01}, {0x75, 0x00, 0x56, 0x01}, {0x61, 0x00, 0xa4, 0x01},
5904 {0x61, 0x00, 0x96, 0x01}, {0x65, 0x00, 0x23, 0x01}, {0x69, 0x00, 0x02, 0x01},
5905 {0x6f, 0x00, 0x9a, 0x01}, {0x75, 0x00, 0x98, 0x01}, {0x61, 0x00, 0x97, 0x01},
5906 {0x65, 0x00, 0x04, 0x01}, {0x6f, 0x00, 0x9b, 0x01}, {0x75, 0x00, 0x99, 0x01},
5907 {0x79, 0x35, 0x56, 0x01}, {0x61, 0x00, 0x3a, 0x01}, {0x65, 0x00, 0x48, 0x01},
5908 {0x69, 0x00, 0x40, 0x01}, {0x6f, 0x00, 0x4a, 0x01}, {0x75, 0x00, 0x46, 0x01},
5909 {0x79, 0x37, 0xff, 0x00}, {0x7a, 0x36, 0x56, 0x01}, {0x61, 0x00, 0x42, 0x01},
5910 {0x65, 0x00, 0x41, 0x01}, {0x6f, 0x00, 0x44, 0x01}, {0x75, 0x00, 0x43, 0x01},
5911 {0x81, 0x39, 0xff, 0x01}, {0x82, 0x3d, 0xff, 0x01}, {0x81, 0x00, 0x00, 0x01},
5912 {0x82, 0x00, 0x01, 0x01}, {0x83, 0x00, 0x02, 0x01}, {0x84, 0x00, 0x03, 0x01},
5913 {0x85, 0x00, 0x05, 0x01}, {0x86, 0x3a, 0xff, 0x01}, {0x87, 0x00, 0x23, 0x01},
5914 {0x88, 0x00, 0x24, 0x01}, {0x89, 0x00, 0x25, 0x01}, {0x8a, 0x00, 0x26, 0x01},
5915 {0x8b, 0x00, 0x27, 0x01}, {0x8c, 0x00, 0x28, 0x01}, {0x8d, 0x00, 0x29, 0x01},
5916 {0x8e, 0x00, 0x2d, 0x01}, {0x8f, 0x00, 0x31, 0x01}, {0x90, 0x00, 0x33, 0x01},
5917 {0x91, 0x00, 0x35, 0x01}, {0x92, 0x00, 0x36, 0x01}, {0x93, 0x00, 0x37, 0x01},
5918 {0x94, 0x00, 0x38, 0x01}, {0x95, 0x00, 0x39, 0x01}, {0x96, 0x00, 0x3a, 0x01},
5919 {0x97, 0x00, 0x3b, 0x01}, {0x98, 0x00, 0x40, 0x01}, {0x99, 0x00, 0x45, 0x01},
5920 {0x9a, 0x00, 0x46, 0x01}, {0x9b, 0x00, 0x47, 0x01}, {0x9c, 0x00, 0x48, 0x01},
5921 {0x9d, 0x00, 0x49, 0x01}, {0x9e, 0x00, 0x4a, 0x01}, {0x9f, 0x00, 0x4b, 0x01},
5922 {0xa0, 0x00, 0x4c, 0x01}, {0xa1, 0x00, 0x4d, 0x01}, {0xa2, 0x00, 0x52, 0x01},
5923 {0xa3, 0x00, 0x56, 0x01}, {0xa4, 0x00, 0x57, 0x01}, {0xa5, 0x00, 0x5c, 0x01},
5924 {0xa6, 0x00, 0x5d, 0x01}, {0xa7, 0x00, 0x60, 0x01}, {0xa8, 0x00, 0x63, 0x01},
5925 {0xa9, 0x00, 0x65, 0x01}, {0xaa, 0x00, 0x67, 0x01}, {0xab, 0x00, 0x68, 0x01},
5926 {0xac, 0x00, 0x6e, 0x01}, {0xad, 0x00, 0x6f, 0x01}, {0xae, 0x00, 0x70, 0x01},
5927 {0xaf, 0x00, 0x71, 0x01}, {0xb0, 0x00, 0x72, 0x01}, {0xb1, 0x00, 0x73, 0x01},
5928 {0xb2, 0x00, 0x74, 0x01}, {0xb3, 0x00, 0x78, 0x01}, {0xb4, 0x00, 0x7c, 0x01},
5929 {0xb5, 0x00, 0x80, 0x01}, {0xb6, 0x00, 0x86, 0x01}, {0xb7, 0x00, 0x87, 0x01},
5930 {0xb8, 0x00, 0x88, 0x01}, {0xb9, 0x00, 0x89, 0x01}, {0xba, 0x00, 0x8a, 0x01},
5931 {0xbb, 0x00, 0x8b, 0x01}, {0xbc, 0x00, 0x8c, 0x01}, {0xbd, 0x00, 0x8d, 0x01},
5932 {0xbe, 0x00, 0x8e, 0x01}, {0xbf, 0x00, 0x8f, 0x01}, {0x00, 0x00, 0x06, 0x00},
5933 {0x2d, 0x00, 0x22, 0x00}, {0x61, 0x00, 0x07, 0x00}, {0x62, 0x01, 0x06, 0x00},
5934 {0x63, 0x03, 0x06, 0x00}, {0x64, 0x06, 0x06, 0x00}, {0x65, 0x00, 0x0c, 0x00},
5935 {0x66, 0x0a, 0x06, 0x00}, {0x67, 0x0c, 0x06, 0x00}, {0x68, 0x0f, 0x06, 0x00},
5936 {0x69, 0x00, 0x09, 0x00}, {0x6a, 0x11, 0x06, 0x00}, {0x6b, 0x13, 0x06, 0x00},
5937 {0x6c, 0x16, 0x06, 0x00}, {0x6d, 0x1c, 0x06, 0x00}, {0x6e, 0x1e, 0x06, 0x00},
5938 {0x6f, 0x00, 0x0d, 0x00}, {0x70, 0x20, 0x06, 0x00}, {0x72, 0x22, 0x06, 0x00},
5939 {0x73, 0x24, 0x06, 0x00}, {0x74, 0x27, 0x06, 0x00}, {0x75, 0x00, 0x0a, 0x00},
5940 {0x76, 0x2c, 0x06, 0x00}, {0x77, 0x2d, 0x06, 0x00}, {0x78, 0x2f, 0x06, 0x00},
5941 {0x79, 0x35, 0x06, 0x00}, {0x7a, 0x36, 0x06, 0x00}, {0xe3, 0x3b, 0xff, 0x01},
5942 {0x00, 0x00, 0x06, 0x00}, {0x81, 0x39, 0x06, 0x00}, {0x82, 0x3c, 0xff, 0x01},
5943 {0x00, 0x00, 0x06, 0x01}, {0x80, 0x00, 0x0e, 0x00}, {0x81, 0x00, 0x0f, 0x00},
5944 {0x82, 0x00, 0x10, 0x00}, {0x83, 0x00, 0x11, 0x00}, {0x84, 0x00, 0x12, 0x00},
5945 {0x85, 0x00, 0x13, 0x00}, {0x86, 0x00, 0x14, 0x00}, {0x87, 0x00, 0x15, 0x00},
5946 {0x88, 0x00, 0x16, 0x00}, {0x89, 0x00, 0x17, 0x00}, {0x8a, 0x00, 0x18, 0x00},
5947 {0x8b, 0x00, 0x19, 0x00}, {0x8c, 0x00, 0x1a, 0x00}, {0x8d, 0x00, 0x1b, 0x00},
5948 {0x8e, 0x00, 0x1c, 0x00}, {0x8f, 0x00, 0x1d, 0x00}, {0x90, 0x00, 0x1e, 0x00},
5949 {0x91, 0x00, 0x1f, 0x00}, {0x92, 0x00, 0x20, 0x00}, {0x93, 0x00, 0x21, 0x00},
5950 {0x9b, 0x00, 0xab, 0x01}, {0x80, 0x00, 0x93, 0x01}, {0x81, 0x00, 0x94, 0x01},
5951 {0x82, 0x00, 0x95, 0x01}, {0x83, 0x00, 0x96, 0x01}, {0x84, 0x00, 0x97, 0x01},
5952 {0x85, 0x00, 0x98, 0x01}, {0x86, 0x00, 0x99, 0x01}, {0x87, 0x00, 0x9a, 0x01},
5953 {0x88, 0x00, 0x9b, 0x01}, {0x89, 0x00, 0x9c, 0x01}, {0x8a, 0x00, 0x9d, 0x01},
5954 {0x8b, 0x00, 0xa1, 0x01}, {0x8c, 0x00, 0xa2, 0x01}, {0x8d, 0x00, 0xa3, 0x01},
5955 {0x8e, 0x00, 0xa4, 0x01}, {0x8f, 0x00, 0xa5, 0x01}, {0x90, 0x00, 0xa6, 0x01},
5956 {0x91, 0x00, 0xa7, 0x01}, {0x92, 0x00, 0xa8, 0x01}, {0x93, 0x00, 0xa9, 0x01}};
5957
5958 static rk_tree_nodecxx . . $ rk_tree_node# *
5959 rk_lookupcxx . . $ rk_lookup(559aa8913833076c).(uint8_tcxx . . $ uint8_t# state, uint8_tcxx . . $ uint8_t# code)
5960 {
5961 if (state < sizeof(rk_tree_idxcxx . . $ rk_tree_idx.) / sizeof(uint16_tcxx . . $ uint16_t#)) {
5962 uint16_tcxx . . $ uint16_t# ns = state ? rk_tree_idxcxx . . $ rk_tree_idx.[state - 1] : 0;
5963 uint16_tcxx . . $ uint16_t# ne = rk_tree_idxcxx . . $ rk_tree_idx.[state];
5964 while (ns < ne) {
5965 uint16_tcxx . . $ uint16_t# m = (ns + ne) >> 1;
5966 rk_tree_nodecxx . . $ rk_tree_node# *rn = &rk_treecxx . . $ rk_tree.[m];
5967 if (rn->codecxx . . $ $anonymous_type_d195c43ed9cfff57_15#code. == code) {
5968 return rn;
5969 }
5970 if (rn->codecxx . . $ $anonymous_type_d195c43ed9cfff57_15#code. < code) {
5971 ns = m + 1;
5972 } else {
5973 ne = m;
5974 }
5975 }
5976 }
5977 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5978 }
5979
5980 static uint32_tcxx . . $ uint32_t#
5981 rk_emitcxx . . $ rk_emit(a14ec721f81af7ed).(rk_tree_nodecxx . . $ rk_tree_node# *rn, char **str)
5982 {
5983 if (rn && rn->emitcxx . . $ $anonymous_type_d195c43ed9cfff57_15#emit. != 0xff) {
5984 uint16_tcxx . . $ uint16_t# pos = rn->emitcxx . . $ $anonymous_type_d195c43ed9cfff57_15#emit. ? rk_str_idxcxx . . $ rk_str_idx.[rn->emitcxx . . $ $anonymous_type_d195c43ed9cfff57_15#emit. - 1] : 0;
5985 *str = &rk_strcxx . . $ rk_str.[pos];
5986 return (uint32_tcxx . . $ uint32_t#)(rk_str_idxcxx . . $ rk_str_idx.[rn->emitcxx . . $ $anonymous_type_d195c43ed9cfff57_15#emit.] - pos);
5987 } else {
5988 *str = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
5989 return 0;
5990 }
5991 }
5992
5993 #define RK_OUTPUTcxx . . $ `lib/pat.c:5993:9`!(e, l) \
5994 do { \
5995 if (oc < oe) { \
5996 uint32_t l_ = (oc + (l) < oe) ? (l) : (oe - oc); \
5997 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(oc, (e), l_); \
5998 oc += l_; \
5999 ic_ = ic; \
6000 } \
6001 } while (0)
6002
6003 static uint32_tcxx . . $ uint32_t#
6004 rk_convcxx . . $ rk_conv(f330d261486335dc).(const char *str,
6005 uint32_tcxx . . $ uint32_t# str_len,
6006 uint8_tcxx . . $ uint8_t# *buf,
6007 uint32_tcxx . . $ uint32_t# buf_size,
6008 uint8_tcxx . . $ uint8_t# *statep)
6009 {
6010 uint32_tcxx . . $ uint32_t# l;
6011 uint8_tcxx . . $ uint8_t# state = 0;
6012 rk_tree_nodecxx . . $ rk_tree_node# *rn;
6013 char *e;
6014 uint8_tcxx . . $ uint8_t# *oc = buf, *oe = oc + buf_size;
6015 const uint8_tcxx . . $ uint8_t# *ic = (uint8_tcxx . . $ uint8_t# *)str, *ic_ = ic, *ie = ic + str_len;
6016 while (ic < ie) {
6017 if ((rn = rk_lookupcxx . . $ rk_lookup(559aa8913833076c).(state, *ic))) {
6018 ic++;
6019 if ((l = rk_emitcxx . . $ rk_emit(a14ec721f81af7ed).(rn, &e))) {
6020 RK_OUTPUTcxx . . $ `lib/pat.c:5993:9`!(e, l);
6021 }
6022 state = rn->nextcxx . . $ $anonymous_type_d195c43ed9cfff57_15#next.;
6023 } else {
6024 if (!state) {
6025 ic++;
6026 }
6027 if (ic_ < ic) {
6028 RK_OUTPUTcxx . . $ `lib/pat.c:5993:9`!(ic_, ic - ic_);
6029 }
6030 state = 0;
6031 }
6032 }
6033 #ifdef FLUSH_UNRESOLVED_INPUT
6034 if ((rn = rk_lookup(state, 0))) {
6035 if ((l = rk_emit(rn, &e))) {
6036 RK_OUTPUT(e, l);
6037 }
6038 state = rn->next;
6039 } else {
6040 if (ic_ < ic) {
6041 RK_OUTPUT(ic_, ic - ic_);
6042 }
6043 }
6044 #endif /* FLUSH_UNRESOLVED_INPUT */
6045 *statep = state;
6046 return oc - buf;
6047 }
6048
6049 static grn_idcxx . . $ grn_id#
6050 sub_searchcxx . . $ sub_search(15c78d3d90ac36a1).(grn_ctxcxx . . $ grn_ctx# *ctx,
6051 grn_patcxx . . $ grn_pat# *pat,
6052 grn_idcxx . . $ grn_id# id,
6053 int32_tcxx . . $ int32_t# *c0,
6054 uint8_tcxx . . $ uint8_t# *key,
6055 uint32_tcxx . . $ uint32_t# key_len)
6056 {
6057 pat_node_commoncxx . . $ pat_node_common# *pn;
6058 int32_tcxx . . $ int32_t# len = key_len * 16;
6059 if (!key_len) {
6060 return id;
6061 }
6062 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, pn);
6063 while (pn) {
6064 int32_tcxx . . $ int32_t# ch;
6065 ch = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, pn);
6066 if (*c0 < ch && ch < len - 1) {
6067 if (ch & 1) {
6068 id = (ch + 1 < len) ? pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, pn)
6069 : pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, pn);
6070 } else {
6071 id = pat_node_get_childcxx . . $ pat_node_get_child(eb8bfb37bfad0e1c).(pat, pn, nth_bitcxx . . $ `lib/pat.c:1220:9`!(key, ch));
6072 }
6073 *c0 = ch;
6074 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, pn);
6075 } else {
6076 const uint8_tcxx . . $ uint8_t# *k = pat_node_get_keycxx . . $ pat_node_get_key(3558caef389a14a2).(ctx, pat, pn);
6077 return (k && key_len <= pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, pn) &&
6078 !memcmpcxx . . $ memcmp(36f949851efa3055).(k, key, key_len))
6079 ? id
6080 : GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
6081 }
6082 }
6083 return GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
6084 }
6085
6086 static void
6087 search_pushcxx . . $ search_push(e8e3aca2d1d826b2).(grn_ctxcxx . . $ grn_ctx# *ctx,
6088 grn_patcxx . . $ grn_pat# *pat,
6089 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
6090 uint8_tcxx . . $ uint8_t# *key,
6091 uint32_tcxx . . $ uint32_t# key_len,
6092 uint8_tcxx . . $ uint8_t# state,
6093 grn_idcxx . . $ grn_id# id,
6094 int c0,
6095 int flags)
6096 {
6097 if (state) {
6098 int step;
6099 uint16_tcxx . . $ uint16_t# ns, ne;
6100 if (flags & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
6101 ns = rk_tree_idxcxx . . $ rk_tree_idx.[state - 1];
6102 ne = rk_tree_idxcxx . . $ rk_tree_idx.[state];
6103 step = 1;
6104 } else {
6105 ns = rk_tree_idxcxx . . $ rk_tree_idx.[state] - 1;
6106 ne = rk_tree_idxcxx . . $ rk_tree_idx.[state - 1] - 1;
6107 step = -1;
6108 }
6109 for (; ns != ne; ns += step) {
6110 rk_tree_nodecxx . . $ rk_tree_node# *rn = &rk_treecxx . . $ rk_tree.[ns];
6111 if (rn->attrcxx . . $ $anonymous_type_d195c43ed9cfff57_15#attr.) {
6112 char *e;
6113 uint32_tcxx . . $ uint32_t# l = rk_emitcxx . . $ rk_emit(a14ec721f81af7ed).(rn, &e);
6114 if (l) {
6115 if (l + key_len <= GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!) {
6116 int32_tcxx . . $ int32_t# ch = c0;
6117 grn_idcxx . . $ grn_id# i;
6118 grn_memcpycxx . . $ `include/groonga/portability.h:32:13`!(key + key_len, e, l);
6119 if ((i = sub_searchcxx . . $ sub_search(15c78d3d90ac36a1).(ctx, pat, id, &ch, key, key_len + l))) {
6120 search_pushcxx . . $ search_push(e8e3aca2d1d826b2).(ctx,
6121 pat,
6122 c,
6123 key,
6124 key_len + l,
6125 rn->nextcxx . . $ $anonymous_type_d195c43ed9cfff57_15#next.,
6126 i,
6127 ch,
6128 flags);
6129 }
6130 }
6131 } else {
6132 search_pushcxx . . $ search_push(e8e3aca2d1d826b2).(ctx, pat, c, key, key_len, rn->nextcxx . . $ $anonymous_type_d195c43ed9cfff57_15#next., id, c0, flags);
6133 }
6134 }
6135 }
6136 } else {
6137 pat_node_commoncxx . . $ pat_node_common# *node;
6138 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, id, node);
6139 if (node) {
6140 int32_tcxx . . $ int32_t# check = pat_node_get_checkcxx . . $ pat_node_get_check(146835cb2747d99f).(pat, node);
6141 int32_tcxx . . $ int32_t# check_max = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(key_len, 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
6142 if (c0 < check) {
6143 if (flags & GRN_CURSOR_DESCENDINGcxx . . $ `include/groonga/table.h:274:9`!) {
6144 if ((check > check_max - 1) || !(flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!)) {
6145 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), check);
6146 }
6147 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), check);
6148 } else {
6149 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node), check);
6150 if ((check > check_max - 1) || !(flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!)) {
6151 pushcxx . . $ push(82233c8eae791b0f).(c, pat_node_get_leftcxx . . $ pat_node_get_left(e39d22ab323af76a).(pat, node), check);
6152 }
6153 }
6154 } else {
6155 if (PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(pat_node_get_key_length(pat, node), 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!) >
6156 (uint32_tcxx . . $ uint32_t#)check_max ||
6157 !(flags & GRN_CURSOR_GTcxx . . $ `include/groonga/table.h:276:9`!)) {
6158 pushcxx . . $ push(82233c8eae791b0f).(c, id, check);
6159 }
6160 }
6161 }
6162 }
6163 }
6164
6165 static grn_rccxx . . $ grn_rc#
6166 set_cursor_rkcxx . . $ set_cursor_rk(90a2438889753746).(grn_ctxcxx . . $ grn_ctx# *ctx,
6167 grn_patcxx . . $ grn_pat# *pat,
6168 grn_pat_cursorcxx . . $ grn_pat_cursor# *c,
6169 const void *key,
6170 uint32_tcxx . . $ uint32_t# key_len,
6171 int flags)
6172 {
6173 grn_idcxx . . $ grn_id# id;
6174 uint8_tcxx . . $ uint8_t# state;
6175 pat_node_commoncxx . . $ pat_node_common# *node;
6176 int c0 = -1;
6177 uint32_tcxx . . $ uint32_t# byte_len;
6178 uint8_tcxx . . $ uint8_t# keybuf[GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!];
6179 if (flags & GRN_CURSOR_SIZE_BY_BITcxx . . $ `include/groonga/table.h:282:9`!) {
6180 return GRN_OPERATION_NOT_SUPPORTEDcxx . . $ GRN_OPERATION_NOT_SUPPORTED.;
6181 }
6182 byte_len = rk_convcxx . . $ rk_conv(f330d261486335dc).(key, key_len, keybuf, GRN_TABLE_MAX_KEY_SIZEcxx . . $ `include/groonga/table.h:26:9`!, &state);
6183 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, 0, node);
6184 if (node) {
6185 id = pat_node_get_rightcxx . . $ pat_node_get_right(e39d22ab323af76a).(pat, node);
6186 if ((id = sub_searchcxx . . $ sub_search(15c78d3d90ac36a1).(ctx, pat, id, &c0, keybuf, byte_len))) {
6187 search_pushcxx . . $ search_push(e8e3aca2d1d826b2).(ctx, pat, c, keybuf, byte_len, state, id, c0, flags);
6188 }
6189 }
6190 return ctx->rccxx . . $ _grn_ctx#rc.;
6191 }
6192
6193 uint64_tcxx . . $ uint64_t#
6194 grn_pat_total_key_sizecxx . . $ grn_pat_total_key_size(3626315f4fc444a).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6195 {
6196 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
6197 return pat->headercxx . . $ _grn_pat#header.->curr_key_largecxx . . $ grn_pat_header#curr_key_large.;
6198 } else {
6199 return pat->headercxx . . $ _grn_pat#header.->curr_keycxx . . $ grn_pat_header#curr_key.;
6200 }
6201 }
6202
6203 uint64_tcxx . . $ uint64_t#
6204 grn_pat_max_total_key_sizecxx . . $ grn_pat_max_total_key_size(3626315f4fc444a).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6205 {
6206 if (pat_is_key_largecxx . . $ pat_is_key_large(76080995ea43c591).(pat)) {
6207 return GRN_PAT_MAX_TOTAL_KEY_SIZE_LARGEcxx . . $ `lib/pat.c:53:9`!;
6208 } else {
6209 return GRN_PAT_MAX_TOTAL_KEY_SIZEcxx . . $ `lib/pat.c:52:9`!;
6210 }
6211 }
6212
6213 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
6214 grn_pat_is_key_encodedcxx . . $ grn_pat_is_key_encoded(dc1a7a7f3d29367f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6215 {
6216 grn_objcxx . . $ grn_obj# *domain;
6217 uint32_tcxx . . $ uint32_t# key_size;
6218
6219 domain = grn_ctx_atcxx . . $ grn_ctx_at(ac4544c8400954c9).(ctx, pat->objcxx . . $ _grn_pat#obj..headercxx . . $ $anonymous_type_4a7c1014017e4c5d_0#header..domaincxx . . $ _grn_obj_header#domain.);
6220 if (grn_obj_is_typecxx . . $ grn_obj_is_type(a5760e5c319a06ee).(ctx, domain)) {
6221 key_size = grn_type_sizecxx . . $ grn_type_size(8dd58acc9865e889).(ctx, domain);
6222 } else {
6223 key_size = sizeof(grn_idcxx . . $ grn_id#);
6224 }
6225
6226 return KEY_NEEDS_CONVERTcxx . . $ `lib/pat.c:2697:9`!(pat, key_size);
6227 }
6228
6229 grn_rccxx . . $ grn_rc#
6230 grn_pat_dirtycxx . . $ grn_pat_dirty(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6231 {
6232 grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.;
6233
6234 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(pat->lock);
6235 if (!pat->is_dirtycxx . . $ _grn_pat#is_dirty.) {
6236 uint32_tcxx . . $ uint32_t# n_dirty_opens;
6237 pat->is_dirtycxx . . $ _grn_pat#is_dirty. = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
6238 GRN_ATOMIC_ADD_EXcxx . . $ `lib/grn.h:420:11`!(&(pat->header->n_dirty_opens), 1, n_dirty_opens);
6239 rc = grn_io_flushcxx . . $ grn_io_flush(117c07c672382ce3).(ctx, pat->iocxx . . $ _grn_pat#io.);
6240 }
6241 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(pat->lock);
6242
6243 return rc;
6244 }
6245
6246 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`!
6247 grn_pat_is_dirtycxx . . $ grn_pat_is_dirty(dc1a7a7f3d29367f).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6248 {
6249 return pat->headercxx . . $ _grn_pat#header.->n_dirty_openscxx . . $ grn_pat_header#n_dirty_opens. > 0;
6250 }
6251
6252 grn_rccxx . . $ grn_rc#
6253 grn_pat_cleancxx . . $ grn_pat_clean(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6254 {
6255 grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.;
6256
6257 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(pat->lock);
6258 if (pat->is_dirtycxx . . $ _grn_pat#is_dirty.) {
6259 uint32_tcxx . . $ uint32_t# n_dirty_opens;
6260 pat->is_dirtycxx . . $ _grn_pat#is_dirty. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
6261 GRN_ATOMIC_ADD_EXcxx . . $ `lib/grn.h:420:11`!(&(pat->header->n_dirty_opens), -1, n_dirty_opens);
6262 rc = grn_io_flushcxx . . $ grn_io_flush(117c07c672382ce3).(ctx, pat->iocxx . . $ _grn_pat#io.);
6263 }
6264 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(pat->lock);
6265
6266 return rc;
6267 }
6268
6269 grn_rccxx . . $ grn_rc#
6270 grn_pat_clear_dirtycxx . . $ grn_pat_clear_dirty(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6271 {
6272 grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.;
6273
6274 CRITICAL_SECTION_ENTERcxx . . $ `lib/grn.h:227:11`!(pat->lock);
6275 pat->is_dirtycxx . . $ _grn_pat#is_dirty. = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
6276 pat->headercxx . . $ _grn_pat#header.->n_dirty_openscxx . . $ grn_pat_header#n_dirty_opens. = 0;
6277 rc = grn_io_flushcxx . . $ grn_io_flush(117c07c672382ce3).(ctx, pat->iocxx . . $ _grn_pat#io.);
6278 CRITICAL_SECTION_LEAVEcxx . . $ `lib/grn.h:228:11`!(pat->lock);
6279
6280 return rc;
6281 }
6282
6283 typedef structcxx . . $ $anonymous_type_d195c43ed9cfff57_16# {
6284 grn_ctxcxx . . $ grn_ctx# *ctxcxx . . $ $anonymous_type_d195c43ed9cfff57_16#ctx.;
6285 grn_patcxx . . $ grn_pat# *patcxx . . $ $anonymous_type_d195c43ed9cfff57_16#pat.;
6286 } pat_node_compare_by_key_datacxx . . $ pat_node_compare_by_key_data#;
6287
6288 int
6289 grn_pat_node_compare_by_keycxx . . $ grn_pat_node_compare_by_key(f92f559881c6899e).(const grn_idcxx . . $ grn_id# id1, const grn_idcxx . . $ grn_id# id2, void *arg)
6290 {
6291 grn_ctxcxx . . $ grn_ctx# *ctx = ((pat_node_compare_by_key_datacxx . . $ pat_node_compare_by_key_data# *)arg)->ctxcxx . . $ $anonymous_type_d195c43ed9cfff57_16#ctx.;
6292 grn_patcxx . . $ grn_pat# *pat = ((pat_node_compare_by_key_datacxx . . $ pat_node_compare_by_key_data# *)arg)->patcxx . . $ $anonymous_type_d195c43ed9cfff57_16#pat.;
6293
6294 pat_node_commoncxx . . $ pat_node_common# *node1 = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, id1);
6295 pat_node_commoncxx . . $ pat_node_common# *node2 = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, id2);
6296 uint64_tcxx . . $ uint64_t# node1_key_offset = pat_node_get_key_offsetcxx . . $ pat_node_get_key_offset(c391a6707c7f46d8).(pat, node1);
6297 uint64_tcxx . . $ uint64_t# node2_key_offset = pat_node_get_key_offsetcxx . . $ pat_node_get_key_offset(c391a6707c7f46d8).(pat, node2);
6298
6299 if (node1_key_offset > node2_key_offset) {
6300 return 1;
6301 }
6302 if (node1_key_offset < node2_key_offset) {
6303 return -1;
6304 }
6305 return 0;
6306 }
6307
6308 static inline void
6309 pat_key_movecxx . . $ pat_key_move(ba4d1a593c9da0fe).(grn_ctxcxx . . $ grn_ctx# *ctx,
6310 grn_patcxx . . $ grn_pat# *pat,
6311 pat_node_commoncxx . . $ pat_node_common# *node,
6312 uint64_tcxx . . $ uint64_t# new_position,
6313 uint8_tcxx . . $ uint8_t# *key,
6314 uint32_tcxx . . $ uint32_t# key_size)
6315 {
6316 uint8_tcxx . . $ uint8_t# *new_key_address;
6317 KEY_ATcxx . . $ `lib/pat.c:1295:9`!(pat, new_position, new_key_address, 0);
6318 grn_memmovecxx . . $ `include/groonga/portability.h:39:11`!(new_key_address, key, key_size);
6319 pat_node_set_key_positioncxx . . $ pat_node_set_key_position(51f1878679485402).(pat, node, new_position);
6320 }
6321
6322 typedef void (*pat_key_defrag_each_callbackcxx . . $ pat_key_defrag_each_callback#)(
6323 grn_ctxcxx . . $ grn_ctx# *ctx, pat_node_commoncxx . . $ pat_node_common# *node, grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *wal_data);
6324
6325 static inline void
6326 pat_key_defrag_callbackcxx . . $ pat_key_defrag_callback(f75a623d00247487).(grn_ctxcxx . . $ grn_ctx# *ctx,
6327 pat_node_commoncxx . . $ pat_node_common# *node,
6328 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *wal_data)
6329 {
6330 pat_key_movecxx . . $ pat_key_move(ba4d1a593c9da0fe).(ctx,
6331 wal_data->patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat.,
6332 node,
6333 wal_data->key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset.,
6334 (uint8_tcxx . . $ uint8_t# *)(wal_data->keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key.),
6335 wal_data->key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size.);
6336 }
6337
6338 static inline void
6339 pat_key_defrag_wal_add_entry_callbackcxx . . $ pat_key_defrag_wal_add_entry_callback(f75a623d00247487).(grn_ctxcxx . . $ grn_ctx# *ctx,
6340 pat_node_commoncxx . . $ pat_node_common# *node,
6341 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# *wal_data)
6342 {
6343 grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, wal_data);
6344 }
6345
6346 static inline uint64_tcxx . . $ uint64_t#
6347 pat_key_defrag_eachcxx . . $ pat_key_defrag_each(5b07d3d738a40edd).(grn_ctxcxx . . $ grn_ctx# *ctx,
6348 grn_patcxx . . $ grn_pat# *pat,
6349 grn_idcxx . . $ grn_id# *target_ids,
6350 size_t n_targets,
6351 pat_key_defrag_each_callbackcxx . . $ pat_key_defrag_each_callback# callback)
6352 {
6353 uint64_tcxx . . $ uint64_t# new_curr_key = 0;
6354 for (size_t i = 0; i < n_targets; i++) {
6355 grn_idcxx . . $ grn_id# record_id = target_ids[i];
6356 pat_node_commoncxx . . $ pat_node_common# *node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, record_id);
6357
6358 /* Check if the key to be added can fit in the current segment. */
6359 uint32_tcxx . . $ uint32_t# key_length = pat_node_get_key_lengthcxx . . $ pat_node_get_key_length(e39d22ab323af76a).(pat, node);
6360 uint64_tcxx . . $ uint64_t# new_end_segment =
6361 (new_curr_key + key_length - 1) >> W_OF_KEY_IN_A_SEGMENTcxx . . $ `lib/pat.c:38:9`!;
6362 if (new_curr_key >> W_OF_KEY_IN_A_SEGMENTcxx . . $ `lib/pat.c:38:9`! != new_end_segment) {
6363 /* If it does not fit, update `new_curr_key` to add it to the next
6364 * segment. */
6365 new_curr_key = new_end_segment << W_OF_KEY_IN_A_SEGMENTcxx . . $ `lib/pat.c:38:9`!;
6366 }
6367
6368 /* If the offset is the same, do not copy because the same key is already
6369 * there. */
6370 uint64_tcxx . . $ uint64_t# node_key_offset = pat_node_get_key_offsetcxx . . $ pat_node_get_key_offset(c391a6707c7f46d8).(pat, node);
6371 if (node_key_offset != new_curr_key) {
6372 uint8_tcxx . . $ uint8_t# *key_address;
6373 KEY_ATcxx . . $ `lib/pat.c:1295:9`!(pat, node_key_offset, key_address, 0);
6374
6375 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# wal_data = {0};
6376 wal_data.eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_DEFRAG_KEYcxx . . $ GRN_WAL_EVENT_DEFRAG_KEY.;
6377 wal_data.patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat. = pat;
6378 wal_data.record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = record_id;
6379 wal_data.keycxx . . $ $anonymous_type_d195c43ed9cfff57_6#key. = key_address;
6380 wal_data.key_sizecxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_size. = key_length;
6381 wal_data.key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset. = new_curr_key;
6382 wal_data.tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag. = "[pat][defrag][key]";
6383
6384 callback(ctx, node, &wal_data);
6385 }
6386 new_curr_key += key_length;
6387 }
6388 return new_curr_key;
6389 }
6390
6391 static inline grn_rccxx . . $ grn_rc#
6392 delinfos_turn_2_forcecxx . . $ delinfos_turn_2_force(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6393 {
6394 for (uint32_tcxx . . $ uint32_t# di_index = 0; di_index < GRN_PAT_NDELINFOScxx . . $ `lib/grn_pat.h:52:9`!; di_index++) {
6395 grn_pat_delinfocxx . . $ grn_pat_delinfo# *delete_info = &(pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[di_index]);
6396 if (delete_info->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. != DL_PHASE1cxx . . $ DL_PHASE1.) {
6397 continue;
6398 }
6399
6400 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# wal_data = {0};
6401 wal_data.tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag. = "[pat][defrag][delinfos][phase2]";
6402 wal_data.patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat. = pat;
6403 wal_data.delete_info_indexcxx . . $ $anonymous_type_d195c43ed9cfff57_6#delete_info_index. = di_index;
6404 grn_rccxx . . $ grn_rc# rc = delinfo_turn_2cxx . . $ delinfo_turn_2(399d0bcfe141f692).(ctx, pat, &wal_data, di_index);
6405 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6406 ERRcxx . . $ `lib/grn_error.h:156:9`!(rc, "%s: failed %d", wal_data.tag, delete_info->ld);
6407 return rc;
6408 }
6409 delinfo_turn_2_postcxx . . $ delinfo_turn_2_post(ff189d7ae511a139).(ctx, pat);
6410 }
6411 return GRN_SUCCESScxx . . $ GRN_SUCCESS.;
6412 }
6413
6414 /* Clear to avoid reuse of unexpected nodes. */
6415 static inline void
6416 grn_pat_defrag_clear_delinfoscxx . . $ grn_pat_defrag_clear_delinfos(ce502570eadde858).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat, grn_idcxx . . $ grn_id# active_max_id)
6417 {
6418 memsetcxx . . $ memset(d1de1e4fb215f1c6).(pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages., 0, sizeof(pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.));
6419 memsetcxx . . $ memset(d1de1e4fb215f1c6).(pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos., 0, sizeof(pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.));
6420 pat->headercxx . . $ _grn_pat#header.->curr_reccxx . . $ grn_pat_header#curr_rec. = active_max_id;
6421 pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del. = 0;
6422 pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2. = 0;
6423 pat->headercxx . . $ _grn_pat#header.->curr_del3cxx . . $ grn_pat_header#curr_del3. = 0;
6424 pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages. = 0;
6425 }
6426
6427 /* See test/command/suite/defrag/pat/README.md when you change this.
6428 * You must update tests for this too.
6429 * If you're using a grn_pat in multi-thread/multi-process environment, you must
6430 * use grn_obj_defrag() instead of using this function directly. */
6431 uint64_tcxx . . $ uint64_t#
6432 grn_pat_defragcxx . . $ grn_pat_defrag(3626315f4fc444a).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6433 {
6434 grn_pat_wal_add_entry_datacxx . . $ grn_pat_wal_add_entry_data# wal_data = {0};
6435 wal_data.eventcxx . . $ $anonymous_type_d195c43ed9cfff57_6#event. = GRN_WAL_EVENT_DEFRAG_CURRENT_KEYcxx . . $ GRN_WAL_EVENT_DEFRAG_CURRENT_KEY.;
6436 wal_data.patcxx . . $ $anonymous_type_d195c43ed9cfff57_6#pat. = pat;
6437 wal_data.tagcxx . . $ $anonymous_type_d195c43ed9cfff57_6#tag. = "[pat][defrag][current-key]";
6438
6439 uint64_tcxx . . $ uint64_t# reduced_bytes = 0;
6440 /* We will clear grn_pat_header::delinfos and grn_pat_header::garbages after
6441 * defragmentation. Execute delinfo_turn_2() on the data remaining in
6442 * grn_pat_header::delinfos before clearing.
6443 *
6444 * Since grn_pat_header::delinfos and grn_pat_header::garbages are cleared
6445 * after defragmentation, exercise of delinfo_turn_3() is not needed. */
6446 if (delinfos_turn_2_forcecxx . . $ delinfos_turn_2_force(6044f5e1d38adedf).(ctx, pat) != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6447 return reduced_bytes;
6448 }
6449
6450 uint32_tcxx . . $ uint32_t# n_records = grn_pat_sizecxx . . $ grn_pat_size(801003d623e3bbf5).(ctx, pat);
6451 if (n_records == 0) {
6452 uint64_tcxx . . $ uint64_t# new_curr_key = 0;
6453 grn_idcxx . . $ grn_id# active_max_id = 0;
6454 wal_data.key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset. = new_curr_key;
6455 wal_data.record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = active_max_id;
6456 grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &wal_data);
6457
6458 reduced_bytes = grn_pat_total_key_sizecxx . . $ grn_pat_total_key_size(3626315f4fc444a).(ctx, pat);
6459 pat_update_total_key_sizecxx . . $ pat_update_total_key_size(ad3bb8074492b44e).(ctx, pat, new_curr_key);
6460 grn_pat_defrag_clear_delinfoscxx . . $ grn_pat_defrag_clear_delinfos(ce502570eadde858).(ctx, pat, active_max_id);
6461 return reduced_bytes;
6462 }
6463
6464 /* First, get the number of targets. */
6465 size_t n_targets = 0;
6466 grn_idcxx . . $ grn_id# active_max_id = GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!;
6467 GRN_PAT_EACH_BEGINcxx . . $ `include/groonga/pat.h:176:9`!(ctx, pat, cursor, id)
6468 {
6469 pat_node_commoncxx . . $ pat_node_common# *node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, id);
6470 if (active_max_id < id) {
6471 active_max_id = id;
6472 }
6473 if (pat_node_is_key_immediatecxx . . $ pat_node_is_key_immediate(e829a7c3dd493304).(pat, node)) {
6474 continue;
6475 }
6476 n_targets++;
6477 }
6478 GRN_PAT_EACH_ENDcxx . . $ `include/groonga/pat.h:185:9`!(ctx, cursor);
6479
6480 /* Allocate only the necessary areas. */
6481 grn_idcxx . . $ grn_id# *target_ids = GRN_MALLOCcxx . . $ `lib/grn_alloc.h:41:9`!(sizeof(grn_id) * n_targets);
6482 n_targets = 0;
6483 GRN_PAT_EACH_BEGINcxx . . $ `include/groonga/pat.h:176:9`!(ctx, pat, cursor, id)
6484 {
6485 pat_node_commoncxx . . $ pat_node_common# *node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, id);
6486 if (pat_node_is_key_immediatecxx . . $ pat_node_is_key_immediate(e829a7c3dd493304).(pat, node)) {
6487 continue;
6488 }
6489 target_ids[n_targets++] = id;
6490 }
6491 GRN_PAT_EACH_ENDcxx . . $ `include/groonga/pat.h:185:9`!(ctx, cursor);
6492
6493 /* Defragment from the head of the key segment. */
6494 pat_node_compare_by_key_datacxx . . $ pat_node_compare_by_key_data# data = {ctx, pat};
6495 grn_qsort_r_grn_idcxx . . $ grn_qsort_r_grn_id(903e1516cd44fe56).(target_ids, n_targets, grn_pat_node_compare_by_keycxx . . $ grn_pat_node_compare_by_key(f92f559881c6899e)., &data);
6496
6497 uint64_tcxx . . $ uint64_t# new_curr_key =
6498 pat_key_defrag_eachcxx . . $ pat_key_defrag_each(5b07d3d738a40edd).(ctx,
6499 pat,
6500 target_ids,
6501 n_targets,
6502 pat_key_defrag_wal_add_entry_callbackcxx . . $ pat_key_defrag_wal_add_entry_callback(f75a623d00247487).);
6503 wal_data.record_idcxx . . $ $anonymous_type_d195c43ed9cfff57_6#record_id. = active_max_id;
6504 wal_data.key_offsetcxx . . $ $anonymous_type_d195c43ed9cfff57_6#key_offset. = new_curr_key;
6505 grn_pat_wal_add_entrycxx . . $ grn_pat_wal_add_entry(d5c67881074b6fbe).(ctx, &wal_data);
6506
6507 pat_key_defrag_eachcxx . . $ pat_key_defrag_each(5b07d3d738a40edd).(ctx, pat, target_ids, n_targets, pat_key_defrag_callbackcxx . . $ pat_key_defrag_callback(f75a623d00247487).);
6508 reduced_bytes = grn_pat_total_key_sizecxx . . $ grn_pat_total_key_size(3626315f4fc444a).(ctx, pat) - new_curr_key;
6509 pat_update_total_key_sizecxx . . $ pat_update_total_key_size(ad3bb8074492b44e).(ctx, pat, new_curr_key);
6510 grn_pat_defrag_clear_delinfoscxx . . $ grn_pat_defrag_clear_delinfos(ce502570eadde858).(ctx, pat, active_max_id);
6511
6512 GRN_FREEcxx . . $ `lib/grn_alloc.h:49:9`!(target_ids);
6513 return reduced_bytes;
6514 }
6515
6516 static void
6517 grn_pat_wal_recover_add_entrycxx . . $ grn_pat_wal_recover_add_entry(bac171ca189f7000).(grn_ctxcxx . . $ grn_ctx# *ctx,
6518 grn_patcxx . . $ grn_pat# *pat,
6519 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6520 const char *tag,
6521 const char *wal_error_tag)
6522 {
6523 pat_update_total_key_sizecxx . . $ pat_update_total_key_size(ad3bb8074492b44e).(ctx, pat, entry->key_offsetcxx . . $ $anonymous_type_e53e4c44496b1987_9#key_offset.);
6524 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries. = entry->n_entriescxx . . $ $anonymous_type_e53e4c44496b1987_9#n_entries.;
6525 pat_node_commoncxx . . $ pat_node_common# *node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.);
6526 if (!node) {
6527 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6528 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6529 (grn_objcxx . . $ grn_obj# *)pat,
6530 entry,
6531 wal_error_tag,
6532 "failed to refer node");
6533 return;
6534 }
6535 pat_node_commoncxx . . $ pat_node_common# *parent_node =
6536 pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, entry->parent_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#parent_record_id.);
6537 if (!parent_node) {
6538 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6539 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6540 (grn_objcxx . . $ grn_obj# *)pat,
6541 entry,
6542 wal_error_tag,
6543 "failed to refer parent node");
6544 return;
6545 }
6546 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6547 return;
6548 }
6549 grn_idcxx . . $ grn_id# *id_location =
6550 pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat, parent_node, entry->record_directioncxx . . $ $anonymous_type_e53e4c44496b1987_9#record_direction.);
6551 *id_location = entry->previous_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#previous_record_id.;
6552 int32_tcxx . . $ int32_t# check_max = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(entry->key.content.binary.size, 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
6553 grn_pat_add_nodecxx . . $ grn_pat_add_node(2ce6e5dc68db2643).(ctx,
6554 pat,
6555 node,
6556 entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.,
6557 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..datacxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#data.,
6558 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..sizecxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#size.,
6559 entry->checkcxx . . $ $anonymous_type_e53e4c44496b1987_9#check.,
6560 check_max,
6561 id_location,
6562 tag);
6563 }
6564
6565 static void
6566 grn_pat_wal_recover_add_shared_entrycxx . . $ grn_pat_wal_recover_add_shared_entry(d8e1365c0ff1b6f8).(grn_ctxcxx . . $ grn_ctx# *ctx,
6567 grn_patcxx . . $ grn_pat# *pat,
6568 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6569 const char *wal_error_tag)
6570 {
6571 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries. = entry->n_entriescxx . . $ $anonymous_type_e53e4c44496b1987_9#n_entries.;
6572 pat_node_commoncxx . . $ pat_node_common# *node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.);
6573 if (!node) {
6574 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6575 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6576 (grn_objcxx . . $ grn_obj# *)pat,
6577 entry,
6578 wal_error_tag,
6579 "failed to refer node");
6580 return;
6581 }
6582 pat_node_commoncxx . . $ pat_node_common# *parent_node =
6583 pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, entry->parent_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#parent_record_id.);
6584 if (!parent_node) {
6585 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6586 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6587 (grn_objcxx . . $ grn_obj# *)pat,
6588 entry,
6589 wal_error_tag,
6590 "failed to refer parent node");
6591 return;
6592 }
6593 grn_idcxx . . $ grn_id# *id_location =
6594 pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat, parent_node, entry->record_directioncxx . . $ $anonymous_type_e53e4c44496b1987_9#record_direction.);
6595 *id_location = entry->previous_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#previous_record_id.;
6596 int32_tcxx . . $ int32_t# check_max = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(entry->key.content.binary.size, 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
6597 grn_pat_add_shared_nodecxx . . $ grn_pat_add_shared_node(322ccd73539cf9a5).(ctx,
6598 pat,
6599 node,
6600 entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.,
6601 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..datacxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#data.,
6602 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..sizecxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#size.,
6603 (uint32_tcxx . . $ uint32_t#)(entry->shared_key_offsetcxx . . $ $anonymous_type_e53e4c44496b1987_9#shared_key_offset.),
6604 entry->checkcxx . . $ $anonymous_type_e53e4c44496b1987_9#check.,
6605 check_max,
6606 id_location);
6607 }
6608
6609 static void
6610 grn_pat_wal_recover_reuse_entrycxx . . $ grn_pat_wal_recover_reuse_entry(bac171ca189f7000).(grn_ctxcxx . . $ grn_ctx# *ctx,
6611 grn_patcxx . . $ grn_pat# *pat,
6612 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6613 const char *tag,
6614 const char *wal_error_tag)
6615 {
6616 pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages. = entry->n_garbagescxx . . $ $anonymous_type_e53e4c44496b1987_9#n_garbages.;
6617 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries. = entry->n_entriescxx . . $ $anonymous_type_e53e4c44496b1987_9#n_entries.;
6618 pat_node_commoncxx . . $ pat_node_common# *node;
6619 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, entry->record_id, node);
6620 if (!node) {
6621 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6622 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6623 (grn_objcxx . . $ grn_obj# *)pat,
6624 entry,
6625 wal_error_tag,
6626 "failed to refer node");
6627 return;
6628 }
6629 pat_node_commoncxx . . $ pat_node_common# *parent_node;
6630 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, entry->parent_record_id, parent_node);
6631 if (!parent_node) {
6632 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6633 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6634 (grn_objcxx . . $ grn_obj# *)pat,
6635 entry,
6636 wal_error_tag,
6637 "failed to refer parent node");
6638 return;
6639 }
6640 grn_idcxx . . $ grn_id# *id_location =
6641 pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat, parent_node, entry->record_directioncxx . . $ $anonymous_type_e53e4c44496b1987_9#record_direction.);
6642 *id_location = entry->previous_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#previous_record_id.;
6643 int32_tcxx . . $ int32_t# check_max = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(entry->key.content.binary.size, 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
6644 grn_pat_reuse_nodecxx . . $ grn_pat_reuse_node(2ce6e5dc68db2643).(ctx,
6645 pat,
6646 node,
6647 entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.,
6648 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..datacxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#data.,
6649 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..sizecxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#size.,
6650 entry->checkcxx . . $ $anonymous_type_e53e4c44496b1987_9#check.,
6651 check_max,
6652 id_location,
6653 tag);
6654 }
6655
6656 static void
6657 grn_pat_wal_recover_reuse_shared_entrycxx . . $ grn_pat_wal_recover_reuse_shared_entry(d8e1365c0ff1b6f8).(grn_ctxcxx . . $ grn_ctx# *ctx,
6658 grn_patcxx . . $ grn_pat# *pat,
6659 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6660 const char *wal_error_tag)
6661 {
6662 pat_node_commoncxx . . $ pat_node_common# *node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.);
6663 if (!node) {
6664 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6665 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6666 (grn_objcxx . . $ grn_obj# *)pat,
6667 entry,
6668 wal_error_tag,
6669 "failed to refer node");
6670 return;
6671 }
6672 pat_node_set_leftcxx . . $ pat_node_set_left(17210a70016b3f10).(pat, node, entry->next_garbage_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#next_garbage_record_id.);
6673 pat_node_commoncxx . . $ pat_node_common# *parent_node =
6674 pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, entry->parent_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#parent_record_id.);
6675 if (!parent_node) {
6676 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6677 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6678 (grn_objcxx . . $ grn_obj# *)pat,
6679 entry,
6680 wal_error_tag,
6681 "failed to refer parent node");
6682 return;
6683 }
6684 grn_idcxx . . $ grn_id# *id_location =
6685 pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat, parent_node, entry->record_directioncxx . . $ $anonymous_type_e53e4c44496b1987_9#record_direction.);
6686 *id_location = entry->previous_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#previous_record_id.;
6687 int32_tcxx . . $ int32_t# check_max = PAT_CHECK_PACKcxx . . $ `lib/pat.c:323:9`!(entry->key.content.binary.size, 0, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!);
6688 pat->headercxx . . $ _grn_pat#header.->n_garbagescxx . . $ grn_pat_header#n_garbages. = entry->n_garbagescxx . . $ $anonymous_type_e53e4c44496b1987_9#n_garbages.;
6689 pat->headercxx . . $ _grn_pat#header.->n_entriescxx . . $ grn_pat_header#n_entries. = entry->n_entriescxx . . $ $anonymous_type_e53e4c44496b1987_9#n_entries.;
6690 grn_pat_reuse_shared_nodecxx . . $ grn_pat_reuse_shared_node(322ccd73539cf9a5).(ctx,
6691 pat,
6692 node,
6693 entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.,
6694 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..datacxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#data.,
6695 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..sizecxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#size.,
6696 (uint32_tcxx . . $ uint32_t#)(entry->shared_key_offsetcxx . . $ $anonymous_type_e53e4c44496b1987_9#shared_key_offset.),
6697 entry->checkcxx . . $ $anonymous_type_e53e4c44496b1987_9#check.,
6698 check_max,
6699 id_location);
6700 }
6701
6702 static void
6703 grn_pat_wal_recover_delete_info_phase1cxx . . $ grn_pat_wal_recover_delete_info_phase1(d8e1365c0ff1b6f8).(grn_ctxcxx . . $ grn_ctx# *ctx,
6704 grn_patcxx . . $ grn_pat# *pat,
6705 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6706 const char *wal_error_tag)
6707 {
6708 pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del. = entry->delete_info_phase1_indexcxx . . $ $anonymous_type_e53e4c44496b1987_9#delete_info_phase1_index.;
6709 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di;
6710 uint32_tcxx . . $ uint32_t# next_delete_info_index = delinfo_turn_1_precxx . . $ delinfo_turn_1_pre(c0bb13f07a06745c).(ctx, pat, &di);
6711 di->sharedcxx . . $ $anonymous_type_3cbf03c15cd18141_0#shared. = entry->is_sharedcxx . . $ $anonymous_type_e53e4c44496b1987_9#is_shared.;
6712 delinfo_turn_1_postcxx . . $ delinfo_turn_1_post(ce502570eadde858).(ctx, pat, next_delete_info_index);
6713 }
6714
6715 static void
6716 grn_pat_wal_recover_delete_info_phase2cxx . . $ grn_pat_wal_recover_delete_info_phase2(d8e1365c0ff1b6f8).(grn_ctxcxx . . $ grn_ctx# *ctx,
6717 grn_patcxx . . $ grn_pat# *pat,
6718 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6719 const char *wal_error_tag)
6720 {
6721 pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2. = entry->delete_info_phase2_indexcxx . . $ $anonymous_type_e53e4c44496b1987_9#delete_info_phase2_index.;
6722 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di = &(pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2.]);
6723 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE1cxx . . $ DL_PHASE1.;
6724 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.;
6725 pat_node_commoncxx . . $ pat_node_common# *node;
6726 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, di->d, node);
6727 if (!node) {
6728 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6729 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6730 (grn_objcxx . . $ grn_obj# *)pat,
6731 entry,
6732 wal_error_tag,
6733 "failed to refer node");
6734 return;
6735 }
6736 di->ldcxx . . $ $anonymous_type_3cbf03c15cd18141_0#ld. = entry->parent_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#parent_record_id.;
6737 pat_node_commoncxx . . $ pat_node_common# *parent_node;
6738 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, di->ld, parent_node);
6739 if (!parent_node) {
6740 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6741 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6742 (grn_objcxx . . $ grn_obj# *)pat,
6743 entry,
6744 wal_error_tag,
6745 "failed to refer parent node");
6746 return;
6747 }
6748 pat_node_set_key_lengthcxx . . $ pat_node_set_key_length(17210a70016b3f10).(pat, node, (uint16_tcxx . . $ uint16_t#)(entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..uint64cxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#uint64.));
6749 pat_node_set_checkcxx . . $ pat_node_set_check(18b96d60ead2a18e).(pat, node, entry->checkcxx . . $ $anonymous_type_e53e4c44496b1987_9#check.);
6750 pat_node_set_leftcxx . . $ pat_node_set_left(17210a70016b3f10).(pat, node, entry->left_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#left_record_id.);
6751 pat_node_set_rightcxx . . $ pat_node_set_right(17210a70016b3f10).(pat, node, entry->right_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#right_record_id.);
6752 delinfo_turn_2_internalcxx . . $ delinfo_turn_2_internal(8ef28dccac5628c).(ctx, pat, di, parent_node, node);
6753 delinfo_turn_2_postcxx . . $ delinfo_turn_2_post(ff189d7ae511a139).(ctx, pat);
6754 }
6755
6756 static void
6757 grn_pat_wal_recover_delete_info_phase3cxx . . $ grn_pat_wal_recover_delete_info_phase3(d8e1365c0ff1b6f8).(grn_ctxcxx . . $ grn_ctx# *ctx,
6758 grn_patcxx . . $ grn_pat# *pat,
6759 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6760 const char *wal_error_tag)
6761 {
6762 pat->headercxx . . $ _grn_pat#header.->curr_del3cxx . . $ grn_pat_header#curr_del3. = entry->delete_info_phase3_indexcxx . . $ $anonymous_type_e53e4c44496b1987_9#delete_info_phase3_index.;
6763 grn_pat_delinfocxx . . $ grn_pat_delinfo# *di = &(pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[pat->headercxx . . $ _grn_pat#header.->curr_del3cxx . . $ grn_pat_header#curr_del3.]);
6764 di->statcxx . . $ $anonymous_type_3cbf03c15cd18141_0#stat. = DL_PHASE2cxx . . $ DL_PHASE2.;
6765 di->dcxx . . $ $anonymous_type_3cbf03c15cd18141_0#d. = entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.;
6766 pat_node_commoncxx . . $ pat_node_common# *node;
6767 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, di->d, node);
6768 if (!node) {
6769 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6770 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6771 (grn_objcxx . . $ grn_obj# *)pat,
6772 entry,
6773 wal_error_tag,
6774 "failed to refer node");
6775 return;
6776 }
6777 di->sharedcxx . . $ $anonymous_type_3cbf03c15cd18141_0#shared. = entry->is_sharedcxx . . $ $anonymous_type_e53e4c44496b1987_9#is_shared.;
6778 uint32_tcxx . . $ uint32_t# size = delinfo_compute_storage_sizecxx . . $ delinfo_compute_storage_size(321b98b494583f7).(ctx, pat, di, node);
6779 pat->headercxx . . $ _grn_pat#header.->garbagescxx . . $ grn_pat_header#garbages.[size] = entry->next_garbage_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#next_garbage_record_id.;
6780 delinfo_turn_3_internalcxx . . $ delinfo_turn_3_internal(1276c9ce42aee9ff).(ctx, pat, di, node);
6781 delinfo_turn_3_postcxx . . $ delinfo_turn_3_post(ff189d7ae511a139).(ctx, pat);
6782 }
6783
6784 static void
6785 grn_pat_wal_recover_delete_entrycxx . . $ grn_pat_wal_recover_delete_entry(d8e1365c0ff1b6f8).(grn_ctxcxx . . $ grn_ctx# *ctx,
6786 grn_patcxx . . $ grn_pat# *pat,
6787 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6788 const char *wal_error_tag)
6789 {
6790 pat->headercxx . . $ _grn_pat#header.->curr_delcxx . . $ grn_pat_header#curr_del. = entry->delete_info_phase1_indexcxx . . $ $anonymous_type_e53e4c44496b1987_9#delete_info_phase1_index.;
6791 pat->headercxx . . $ _grn_pat#header.->curr_del2cxx . . $ grn_pat_header#curr_del2. = entry->delete_info_phase2_indexcxx . . $ $anonymous_type_e53e4c44496b1987_9#delete_info_phase2_index.;
6792 grn_pat_del_datacxx . . $ grn_pat_del_data# data = {0};
6793 data.dicxx . . $ $anonymous_type_d195c43ed9cfff57_14#di. = &(pat->headercxx . . $ _grn_pat#header.->delinfoscxx . . $ grn_pat_header#delinfos.[entry->delete_info_indexcxx . . $ $anonymous_type_e53e4c44496b1987_9#delete_info_index.]);
6794 data.idcxx . . $ $anonymous_type_d195c43ed9cfff57_14#id. = entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.;
6795 data.checkcxx . . $ $anonymous_type_d195c43ed9cfff57_14#check. = entry->checkcxx . . $ $anonymous_type_e53e4c44496b1987_9#check.;
6796 data.check0cxx . . $ $anonymous_type_d195c43ed9cfff57_14#check0. = entry->parent_checkcxx . . $ $anonymous_type_e53e4c44496b1987_9#parent_check.;
6797 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, data.id, data.node);
6798 if (!data.nodecxx . . $ $anonymous_type_d195c43ed9cfff57_14#node.) {
6799 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6800 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6801 (grn_objcxx . . $ grn_obj# *)pat,
6802 entry,
6803 wal_error_tag,
6804 "failed to refer node");
6805 return;
6806 }
6807 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, entry->parent_record_id, data.node_previous);
6808 if (!data.node_previouscxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_previous.) {
6809 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6810 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6811 (grn_objcxx . . $ grn_obj# *)pat,
6812 entry,
6813 wal_error_tag,
6814 "failed to refer parent node");
6815 return;
6816 }
6817 pat_node_commoncxx . . $ pat_node_common# *grandparent_node;
6818 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, entry->grandparent_record_id, grandparent_node);
6819 if (!grandparent_node) {
6820 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6821 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6822 (grn_objcxx . . $ grn_obj# *)pat,
6823 entry,
6824 wal_error_tag,
6825 "failed to refer grandparent node");
6826 return;
6827 }
6828 data.othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#otherside. = entry->otherside_record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#otherside_record_id.;
6829 if (data.othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#otherside. != GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!) {
6830 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, data.otherside, data.node_otherside);
6831 if (!data.node_othersidecxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_otherside.) {
6832 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6833 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6834 (grn_objcxx . . $ grn_obj# *)pat,
6835 entry,
6836 wal_error_tag,
6837 "failed to refer otherside node");
6838 return;
6839 }
6840 }
6841 pat_node_commoncxx . . $ pat_node_common# *root_node;
6842 PAT_ATcxx . . $ `lib/pat.c:1229:9`!(pat, GRN_ID_NILcxx . . $ `include/groonga/groonga.h:55:9`!, root_node);
6843 if (!root_node) {
6844 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6845 GRN_NO_MEMORY_AVAILABLEcxx . . $ GRN_NO_MEMORY_AVAILABLE.,
6846 (grn_objcxx . . $ grn_obj# *)pat,
6847 entry,
6848 wal_error_tag,
6849 "failed to refer root node");
6850 return;
6851 }
6852 data.prootcxx . . $ $anonymous_type_d195c43ed9cfff57_14#proot. = pat_node_get_right_addresscxx . . $ pat_node_get_right_address(611d92fad5637a27).(pat, root_node);
6853 data.pcxx . . $ $anonymous_type_d195c43ed9cfff57_14#p. = pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat,
6854 data.node_previouscxx . . $ $anonymous_type_d195c43ed9cfff57_14#node_previous.,
6855 entry->record_directioncxx . . $ $anonymous_type_e53e4c44496b1987_9#record_direction.);
6856 data.p0cxx . . $ $anonymous_type_d195c43ed9cfff57_14#p0. = pat_node_get_child_addresscxx . . $ pat_node_get_child_address(fdc07a7464bef690).(pat,
6857 grandparent_node,
6858 entry->parent_record_directioncxx . . $ $anonymous_type_e53e4c44496b1987_9#parent_record_direction.);
6859 data.n_garbagescxx . . $ $anonymous_type_d195c43ed9cfff57_14#n_garbages. = entry->n_garbagescxx . . $ $anonymous_type_e53e4c44496b1987_9#n_garbages.;
6860 data.n_entriescxx . . $ $anonymous_type_d195c43ed9cfff57_14#n_entries. = entry->n_entriescxx . . $ $anonymous_type_e53e4c44496b1987_9#n_entries.;
6861 grn_pat_del_internalcxx . . $ grn_pat_del_internal(6122918d34eb9d91).(ctx, pat, &data);
6862 }
6863
6864 static void
6865 grn_pat_wal_recover_defrag_keycxx . . $ grn_pat_wal_recover_defrag_key(d8e1365c0ff1b6f8).(grn_ctxcxx . . $ grn_ctx# *ctx,
6866 grn_patcxx . . $ grn_pat# *pat,
6867 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6868 const char *wal_error_tag)
6869 {
6870 pat_node_commoncxx . . $ pat_node_common# *node = pat_node_getcxx . . $ pat_node_get(df9661126a97d158).(ctx, pat, entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.);
6871 if (!node) {
6872 grn_rccxx . . $ grn_rc# rc = ctx->rccxx . . $ _grn_ctx#rc.;
6873 if (rc == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6874 rc = GRN_UNKNOWN_ERRORcxx . . $ GRN_UNKNOWN_ERROR.;
6875 }
6876 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6877 rc,
6878 (grn_objcxx . . $ grn_obj# *)pat,
6879 entry,
6880 wal_error_tag,
6881 "failed to refer node");
6882 return;
6883 }
6884 pat_key_movecxx . . $ pat_key_move(ba4d1a593c9da0fe).(ctx,
6885 pat,
6886 node,
6887 entry->key_offsetcxx . . $ $anonymous_type_e53e4c44496b1987_9#key_offset.,
6888 (uint8_tcxx . . $ uint8_t# *)(entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..datacxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#data.),
6889 entry->keycxx . . $ $anonymous_type_e53e4c44496b1987_9#key..contentcxx . . $ $anonymous_type_e53e4c44496b1987_5#content..binarycxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#binary..sizecxx . . $ $anonymous_type_e53e4c44496b1987_5#$anonymous_type_6#$anonymous_type_8#size.);
6890 }
6891
6892 static void
6893 grn_pat_wal_recover_defrag_current_keycxx . . $ grn_pat_wal_recover_defrag_current_key(ffa55e7b56106c9f).(grn_ctxcxx . . $ grn_ctx# *ctx,
6894 grn_patcxx . . $ grn_pat# *pat,
6895 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# *entry,
6896 uint64_tcxx . . $ uint64_t# defrag_key_start_id,
6897 const char *tag,
6898 const char *wal_error_tag)
6899 {
6900 grn_wal_readercxx . . $ grn_wal_reader# *reader = grn_wal_reader_opencxx . . $ grn_wal_reader_open(fe182cc90cbfd5e9).(ctx, (grn_objcxx . . $ grn_obj# *)pat, tag);
6901 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6902 return;
6903 }
6904 if (!reader) {
6905 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
6906 GRN_UNKNOWN_ERRORcxx . . $ GRN_UNKNOWN_ERROR.,
6907 (grn_objcxx . . $ grn_obj# *)pat,
6908 entry,
6909 wal_error_tag,
6910 "failed to open WAL reader");
6911 return;
6912 }
6913 while (truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!) {
6914 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# defrag_key_entry = {0};
6915 grn_rccxx . . $ grn_rc# rc = grn_wal_reader_read_entrycxx . . $ grn_wal_reader_read_entry(28480d7d513ff5d1).(ctx, reader, &defrag_key_entry);
6916 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6917 break;
6918 }
6919 if (defrag_key_entry.idcxx . . $ $anonymous_type_e53e4c44496b1987_9#id. < defrag_key_start_id) {
6920 continue;
6921 }
6922 /* We don't validate here but event must be GRN_WAL_EVENT_DEFRAG_KEY or
6923 * GRN_WAL_EVENT_DEFRAG_CURRENT_KEY. */
6924 if (defrag_key_entry.eventcxx . . $ $anonymous_type_e53e4c44496b1987_9#event. != GRN_WAL_EVENT_DEFRAG_KEYcxx . . $ GRN_WAL_EVENT_DEFRAG_KEY.) {
6925 break;
6926 }
6927 grn_pat_wal_recover_defrag_keycxx . . $ grn_pat_wal_recover_defrag_key(d8e1365c0ff1b6f8).(ctx, pat, &defrag_key_entry, wal_error_tag);
6928 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6929 return;
6930 }
6931 }
6932 grn_wal_reader_closecxx . . $ grn_wal_reader_close(c101e2e85ca998d7).(ctx, reader);
6933 pat_update_total_key_sizecxx . . $ pat_update_total_key_size(ad3bb8074492b44e).(ctx, pat, entry->key_offsetcxx . . $ $anonymous_type_e53e4c44496b1987_9#key_offset.);
6934 grn_pat_defrag_clear_delinfoscxx . . $ grn_pat_defrag_clear_delinfos(ce502570eadde858).(ctx, pat, entry->record_idcxx . . $ $anonymous_type_e53e4c44496b1987_9#record_id.);
6935 }
6936
6937 grn_rccxx . . $ grn_rc#
6938 grn_pat_wal_recovercxx . . $ grn_pat_wal_recover(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
6939 {
6940 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6941 return ctx->rccxx . . $ _grn_ctx#rc.;
6942 }
6943
6944 const char *wal_error_tag = "[pat]";
6945 const char *tag = "[pat][recover]";
6946 grn_wal_readercxx . . $ grn_wal_reader# *reader = grn_wal_reader_opencxx . . $ grn_wal_reader_open(fe182cc90cbfd5e9).(ctx, (grn_objcxx . . $ grn_obj# *)pat, tag);
6947 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6948 return ctx->rccxx . . $ _grn_ctx#rc.;
6949 }
6950
6951 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_flush = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
6952 if (grn_io_is_lockedcxx . . $ grn_io_is_locked(ee95b3f473df551b).(pat->iocxx . . $ _grn_pat#io.)) {
6953 grn_io_clear_lockcxx . . $ grn_io_clear_lock(69bc83933b8864bc).(pat->iocxx . . $ _grn_pat#io.);
6954 need_flush = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
6955 }
6956
6957 if (reader) {
6958 uint64_tcxx . . $ uint64_t# defrag_key_start_id = 0;
6959 while (truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!) {
6960 grn_wal_reader_entrycxx . . $ grn_wal_reader_entry# entry = {0};
6961 grn_rccxx . . $ grn_rc# rc = grn_wal_reader_read_entrycxx . . $ grn_wal_reader_read_entry(28480d7d513ff5d1).(ctx, reader, &entry);
6962 if (rc != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
6963 break;
6964 }
6965 switch (entry.eventcxx . . $ $anonymous_type_e53e4c44496b1987_9#event.) {
6966 case GRN_WAL_EVENT_ADD_ENTRYcxx . . $ GRN_WAL_EVENT_ADD_ENTRY.:
6967 grn_pat_wal_recover_add_entrycxx . . $ grn_pat_wal_recover_add_entry(bac171ca189f7000).(ctx, pat, &entry, tag, wal_error_tag);
6968 break;
6969 case GRN_WAL_EVENT_ADD_SHARED_ENTRYcxx . . $ GRN_WAL_EVENT_ADD_SHARED_ENTRY.:
6970 grn_pat_wal_recover_add_shared_entrycxx . . $ grn_pat_wal_recover_add_shared_entry(d8e1365c0ff1b6f8).(ctx, pat, &entry, wal_error_tag);
6971 break;
6972 case GRN_WAL_EVENT_REUSE_ENTRYcxx . . $ GRN_WAL_EVENT_REUSE_ENTRY.:
6973 grn_pat_wal_recover_reuse_entrycxx . . $ grn_pat_wal_recover_reuse_entry(bac171ca189f7000).(ctx, pat, &entry, tag, wal_error_tag);
6974 break;
6975 case GRN_WAL_EVENT_REUSE_SHARED_ENTRYcxx . . $ GRN_WAL_EVENT_REUSE_SHARED_ENTRY.:
6976 grn_pat_wal_recover_reuse_shared_entrycxx . . $ grn_pat_wal_recover_reuse_shared_entry(d8e1365c0ff1b6f8).(ctx, pat, &entry, wal_error_tag);
6977 break;
6978 case GRN_WAL_EVENT_DELETE_INFO_PHASE1cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE1.:
6979 grn_pat_wal_recover_delete_info_phase1cxx . . $ grn_pat_wal_recover_delete_info_phase1(d8e1365c0ff1b6f8).(ctx, pat, &entry, wal_error_tag);
6980 break;
6981 case GRN_WAL_EVENT_DELETE_INFO_PHASE2cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE2.:
6982 grn_pat_wal_recover_delete_info_phase2cxx . . $ grn_pat_wal_recover_delete_info_phase2(d8e1365c0ff1b6f8).(ctx, pat, &entry, wal_error_tag);
6983 break;
6984 case GRN_WAL_EVENT_DELETE_INFO_PHASE3cxx . . $ GRN_WAL_EVENT_DELETE_INFO_PHASE3.:
6985 grn_pat_wal_recover_delete_info_phase3cxx . . $ grn_pat_wal_recover_delete_info_phase3(d8e1365c0ff1b6f8).(ctx, pat, &entry, wal_error_tag);
6986 break;
6987 case GRN_WAL_EVENT_DELETE_ENTRYcxx . . $ GRN_WAL_EVENT_DELETE_ENTRY.:
6988 grn_pat_wal_recover_delete_entrycxx . . $ grn_pat_wal_recover_delete_entry(d8e1365c0ff1b6f8).(ctx, pat, &entry, wal_error_tag);
6989 break;
6990 case GRN_WAL_EVENT_DEFRAG_KEYcxx . . $ GRN_WAL_EVENT_DEFRAG_KEY.:
6991 /* Defer until GRN_WAL_EVENT_DEFRAG_CURRENT_KEY is happen. */
6992 if (defrag_key_start_id == 0) {
6993 defrag_key_start_id = entry.idcxx . . $ $anonymous_type_e53e4c44496b1987_9#id.;
6994 }
6995 break;
6996 case GRN_WAL_EVENT_DEFRAG_CURRENT_KEYcxx . . $ GRN_WAL_EVENT_DEFRAG_CURRENT_KEY.:
6997 /* Other WAL entries must not be happen between
6998 * GRN_WAL_EVENT_DEFRAG_KEY{1..N} and GRN_WAL_EVENT_DEFRAG_CURRENT_KEY
6999 * but we don't validate it. WAL entries must be valid. If one or more
7000 * GRN_WAL_EVENT_DEFRAG_KEY exist but GRN_WAL_EVENT_DEFRAG_CURRENT_KEY
7001 * doesn't exist, the grn_pat_defrag() was crashed. In the case, the
7002 * defrag event is ignored. Because the defrag wasn't executed. */
7003 grn_pat_wal_recover_defrag_current_keycxx . . $ grn_pat_wal_recover_defrag_current_key(ffa55e7b56106c9f).(ctx,
7004 pat,
7005 &entry,
7006 defrag_key_start_id,
7007 tag,
7008 wal_error_tag);
7009 defrag_key_start_id = 0;
7010 break;
7011 default:
7012 grn_wal_set_recover_errorcxx . . $ grn_wal_set_recover_error(f2c1e0ebbcc51133).(ctx,
7013 GRN_FUNCTION_NOT_IMPLEMENTEDcxx . . $ GRN_FUNCTION_NOT_IMPLEMENTED.,
7014 (grn_objcxx . . $ grn_obj# *)pat,
7015 &entry,
7016 wal_error_tag,
7017 "not implemented yet");
7018 break;
7019 }
7020 if (ctx->rccxx . . $ _grn_ctx#rc. != GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
7021 break;
7022 }
7023 if (entry.eventcxx . . $ $anonymous_type_e53e4c44496b1987_9#event. == GRN_WAL_EVENT_DEFRAG_KEYcxx . . $ GRN_WAL_EVENT_DEFRAG_KEY.) {
7024 /* Don't update wal_id and need_flush until
7025 * GRN_WAL_EVENT_DEFRAG_CURRENT_KEY is happen. If
7026 * GRN_WAL_EVENT_DEFRAG_CURRENT_KEY isn't happen, grn_pat_defrag() was
7027 * crashed between writing GRN_WAL_EVENT_DEFRAG_KEY and
7028 * GRN_WAL_EVENT_DEFRAG_CURRENT_KEY. In the case, we just ignore the
7029 * defrag event. Because the defrag wasn't executed. */
7030 continue;
7031 }
7032 pat->headercxx . . $ _grn_pat#header.->wal_idcxx . . $ grn_pat_header#wal_id. = entry.idcxx . . $ $anonymous_type_e53e4c44496b1987_9#id.;
7033 need_flush = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
7034 }
7035 grn_wal_reader_closecxx . . $ grn_wal_reader_close(c101e2e85ca998d7).(ctx, reader);
7036 }
7037
7038 if (need_flush && ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.) {
7039 grn_obj_touchcxx . . $ grn_obj_touch(7ce09bc2deb0d26b).(ctx, (grn_objcxx . . $ grn_obj# *)pat, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!);
7040 grn_obj_flushcxx . . $ grn_obj_flush(4865d068a46d0f83).(ctx, (grn_objcxx . . $ grn_obj# *)pat);
7041 }
7042
7043 return ctx->rccxx . . $ _grn_ctx#rc.;
7044 }
7045
7046 grn_rccxx . . $ grn_rc#
7047 grn_pat_warmcxx . . $ grn_pat_warm(6044f5e1d38adedf).(grn_ctxcxx . . $ grn_ctx# *ctx, grn_patcxx . . $ grn_pat# *pat)
7048 {
7049 return grn_io_warmcxx . . $ grn_io_warm(117c07c672382ce3).(ctx, pat->iocxx . . $ _grn_pat#io.);
7050 }