Debian Codegraph @

lib/proc/proc_reference.c

raw symbols SCIP
1 /*
2 Copyright (C) 2020-2022 Sutou Kouhei <[email protected]>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19 #include "../grn_proc.h"cxx . . $ `<file>/lib/grn_proc.h`/
20
21 #include "../grn_ctx.h"cxx . . $ `<file>/lib/grn_ctx.h`/
22 #include "../grn_db.h"cxx . . $ `<file>/lib/grn_db.h`/
23
24 #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/
25
26 static grn_objcxx . . $ grn_obj# *
27 command_reference_acquirecxx . . $ command_reference_acquire(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
28 int nargs,
29 grn_objcxx . . $ grn_obj# **args,
30 grn_user_datacxx . . $ grn_user_data# *user_data)
31 {
32 grn_raw_stringcxx . . $ grn_raw_string# target_name;
33 target_name.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. =
34 grn_plugin_proc_get_var_stringcxx . . $ grn_plugin_proc_get_var_string(b6763965d55cfbc).(ctx,
35 user_data,
36 "target_name", -1,
37 &(target_name.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
38 grn_raw_stringcxx . . $ grn_raw_string# recursive;
39 recursive.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. =
40 grn_plugin_proc_get_var_stringcxx . . $ grn_plugin_proc_get_var_string(b6763965d55cfbc).(ctx,
41 user_data,
42 "recursive", -1,
43 &(recursive.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
44
45 grn_objcxx . . $ grn_obj# *obj;
46 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_unref = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
47 if (target_name.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) {
48 obj = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, target_name.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value., (int)(target_name.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
49 need_unref = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
50 } else {
51 obj = grn_ctx_dbcxx . . $ grn_ctx_db(ddec8e3b1327ceae).(ctx);
52 }
53
54 if (obj) {
55 int32_tcxx . . $ int32_t# auto_release_count_arg = -1;
56 if (need_unref) {
57 auto_release_count_arg =
58 grn_plugin_proc_get_var_int32cxx . . $ grn_plugin_proc_get_var_int32(15a79c06634e1698).(ctx,
59 user_data,
60 "auto_release_count",
61 -1,
62 auto_release_count_arg);
63 }
64 uint32_tcxx . . $ uint32_t# auto_release_count = 0;
65 if (auto_release_count_arg > 0) {
66 /* Don't count this command */
67 auto_release_count = (uint32_tcxx . . $ uint32_t#)auto_release_count_arg + 1;
68 }
69 if (GRN_RAW_STRING_EQUAL_CSTRINGcxx . . $ `include/groonga/raw_string.h:57:9`!(recursive, "dependent")) {
70 grn_obj_refer_recursive_dependent_auto_releasecxx . . $ grn_obj_refer_recursive_dependent_auto_release(aedbc3eaefbe393f).(ctx,
71 obj,
72 auto_release_count);
73 } else if (GRN_RAW_STRING_EQUAL_CSTRINGcxx . . $ `include/groonga/raw_string.h:57:9`!(recursive, "no")) {
74 grn_obj_refer_auto_releasecxx . . $ grn_obj_refer_auto_release(aedbc3eaefbe393f).(ctx, obj, auto_release_count);
75 } else {
76 grn_obj_refer_recursive_auto_releasecxx . . $ grn_obj_refer_recursive_auto_release(aedbc3eaefbe393f).(ctx, obj, auto_release_count);
77 }
78 if (need_unref) {
79 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, obj);
80 }
81 } else {
82 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT,
83 "[reference][acquire] target object not found: <%.*s>",
84 (int)(target_name.length),
85 target_name.value);
86 }
87
88 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.);
89
90 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
91 }
92
93 void
94 grn_proc_init_reference_acquirecxx . . $ grn_proc_init_reference_acquire(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
95 {
96 grn_expr_varcxx . . $ grn_expr_var# vars[3];
97
98 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "target_name", -1);
99 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "recursive", -1);
100 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[2]), "auto_release_count", -1);
101 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
102 "reference_acquire", -1,
103 command_reference_acquirecxx . . $ command_reference_acquire(fd082858389c8bb0).,
104 3,
105 vars);
106 }
107
108 static grn_objcxx . . $ grn_obj# *
109 command_reference_releasecxx . . $ command_reference_release(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx,
110 int nargs,
111 grn_objcxx . . $ grn_obj# **args,
112 grn_user_datacxx . . $ grn_user_data# *user_data)
113 {
114 grn_raw_stringcxx . . $ grn_raw_string# target_name;
115 target_name.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. =
116 grn_plugin_proc_get_var_stringcxx . . $ grn_plugin_proc_get_var_string(b6763965d55cfbc).(ctx,
117 user_data,
118 "target_name", -1,
119 &(target_name.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
120 grn_raw_stringcxx . . $ grn_raw_string# recursive;
121 recursive.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value. =
122 grn_plugin_proc_get_var_stringcxx . . $ grn_plugin_proc_get_var_string(b6763965d55cfbc).(ctx,
123 user_data,
124 "recursive", -1,
125 &(recursive.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
126
127 grn_objcxx . . $ grn_obj# *obj;
128 boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! need_unref = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!;
129 if (target_name.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length. > 0) {
130 obj = grn_ctx_getcxx . . $ grn_ctx_get(70fde0087014f9ea).(ctx, target_name.valuecxx . . $ $anonymous_type_7f733dd816802915_0#value., (int)(target_name.lengthcxx . . $ $anonymous_type_7f733dd816802915_0#length.));
131 need_unref = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!;
132 } else {
133 obj = grn_ctx_dbcxx . . $ grn_ctx_db(ddec8e3b1327ceae).(ctx);
134 }
135
136 if (obj) {
137 if (GRN_RAW_STRING_EQUAL_CSTRINGcxx . . $ `include/groonga/raw_string.h:57:9`!(recursive, "dependent")) {
138 grn_obj_unref_recursive_dependentcxx . . $ grn_obj_unref_recursive_dependent(cda3a5f3c2e53c6b).(ctx, obj);
139 } else if (GRN_RAW_STRING_EQUAL_CSTRINGcxx . . $ `include/groonga/raw_string.h:57:9`!(recursive, "no")) {
140 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, obj);
141 } else {
142 grn_obj_unref_recursivecxx . . $ grn_obj_unref_recursive(cda3a5f3c2e53c6b).(ctx, obj);
143 }
144 if (need_unref) {
145 grn_obj_unrefcxx . . $ grn_obj_unref(cda3a5f3c2e53c6b).(ctx, obj);
146 }
147 } else {
148 GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT,
149 "[reference][release] target object not found: <%.*s>",
150 (int)(target_name.length),
151 target_name.value);
152 }
153
154 grn_ctx_output_boolcxx . . $ grn_ctx_output_bool(1112b62984b2cd7f).(ctx, ctx->rccxx . . $ _grn_ctx#rc. == GRN_SUCCESScxx . . $ GRN_SUCCESS.);
155
156 return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;
157 }
158
159 void
160 grn_proc_init_reference_releasecxx . . $ grn_proc_init_reference_release(b578cd6e53d5fe91).(grn_ctxcxx . . $ grn_ctx# *ctx)
161 {
162 grn_expr_varcxx . . $ grn_expr_var# vars[2];
163
164 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[0]), "target_name", -1);
165 grn_plugin_expr_var_initcxx . . $ grn_plugin_expr_var_init(680ef4125f11597f).(ctx, &(vars[1]), "recursive", -1);
166 grn_plugin_command_createcxx . . $ grn_plugin_command_create(2dfd920bb40f3149).(ctx,
167 "reference_release", -1,
168 command_reference_releasecxx . . $ command_reference_release(fd082858389c8bb0).,
169 2,
170 vars);
171 }