/src/open5gs/lib/sbi/openapi/model/preferred_search.c
Line | Count | Source |
1 | | |
2 | | #include <stdlib.h> |
3 | | #include <string.h> |
4 | | #include <stdio.h> |
5 | | #include "preferred_search.h" |
6 | | |
7 | | OpenAPI_preferred_search_t *OpenAPI_preferred_search_create( |
8 | | bool is_preferred_tai_match_ind, |
9 | | int preferred_tai_match_ind, |
10 | | bool is_preferred_full_plmn_match_ind, |
11 | | int preferred_full_plmn_match_ind, |
12 | | bool is_preferred_api_versions_match_ind, |
13 | | int preferred_api_versions_match_ind, |
14 | | bool is_other_api_versions_ind, |
15 | | int other_api_versions_ind, |
16 | | bool is_preferred_locality_match_ind, |
17 | | int preferred_locality_match_ind, |
18 | | bool is_other_locality_ind, |
19 | | int other_locality_ind, |
20 | | bool is_preferred_vendor_specific_features_ind, |
21 | | int preferred_vendor_specific_features_ind, |
22 | | bool is_preferred_collocated_nf_type_ind, |
23 | | int preferred_collocated_nf_type_ind, |
24 | | bool is_preferred_pgw_match_ind, |
25 | | int preferred_pgw_match_ind, |
26 | | bool is_preferred_analytics_delays_ind, |
27 | | int preferred_analytics_delays_ind, |
28 | | bool is_preferred_features_match_ind, |
29 | | int preferred_features_match_ind, |
30 | | bool is_no_preferred_features_ind, |
31 | | int no_preferred_features_ind, |
32 | | bool is_preferred_op_config_cap_ind, |
33 | | int preferred_op_config_cap_ind, |
34 | | bool is_preferred_upf_packet_inspection_match_ind, |
35 | | int preferred_upf_packet_inspection_match_ind |
36 | | ) |
37 | 0 | { |
38 | 0 | OpenAPI_preferred_search_t *preferred_search_local_var = ogs_malloc(sizeof(OpenAPI_preferred_search_t)); |
39 | 0 | ogs_assert(preferred_search_local_var); |
40 | | |
41 | 0 | preferred_search_local_var->is_preferred_tai_match_ind = is_preferred_tai_match_ind; |
42 | 0 | preferred_search_local_var->preferred_tai_match_ind = preferred_tai_match_ind; |
43 | 0 | preferred_search_local_var->is_preferred_full_plmn_match_ind = is_preferred_full_plmn_match_ind; |
44 | 0 | preferred_search_local_var->preferred_full_plmn_match_ind = preferred_full_plmn_match_ind; |
45 | 0 | preferred_search_local_var->is_preferred_api_versions_match_ind = is_preferred_api_versions_match_ind; |
46 | 0 | preferred_search_local_var->preferred_api_versions_match_ind = preferred_api_versions_match_ind; |
47 | 0 | preferred_search_local_var->is_other_api_versions_ind = is_other_api_versions_ind; |
48 | 0 | preferred_search_local_var->other_api_versions_ind = other_api_versions_ind; |
49 | 0 | preferred_search_local_var->is_preferred_locality_match_ind = is_preferred_locality_match_ind; |
50 | 0 | preferred_search_local_var->preferred_locality_match_ind = preferred_locality_match_ind; |
51 | 0 | preferred_search_local_var->is_other_locality_ind = is_other_locality_ind; |
52 | 0 | preferred_search_local_var->other_locality_ind = other_locality_ind; |
53 | 0 | preferred_search_local_var->is_preferred_vendor_specific_features_ind = is_preferred_vendor_specific_features_ind; |
54 | 0 | preferred_search_local_var->preferred_vendor_specific_features_ind = preferred_vendor_specific_features_ind; |
55 | 0 | preferred_search_local_var->is_preferred_collocated_nf_type_ind = is_preferred_collocated_nf_type_ind; |
56 | 0 | preferred_search_local_var->preferred_collocated_nf_type_ind = preferred_collocated_nf_type_ind; |
57 | 0 | preferred_search_local_var->is_preferred_pgw_match_ind = is_preferred_pgw_match_ind; |
58 | 0 | preferred_search_local_var->preferred_pgw_match_ind = preferred_pgw_match_ind; |
59 | 0 | preferred_search_local_var->is_preferred_analytics_delays_ind = is_preferred_analytics_delays_ind; |
60 | 0 | preferred_search_local_var->preferred_analytics_delays_ind = preferred_analytics_delays_ind; |
61 | 0 | preferred_search_local_var->is_preferred_features_match_ind = is_preferred_features_match_ind; |
62 | 0 | preferred_search_local_var->preferred_features_match_ind = preferred_features_match_ind; |
63 | 0 | preferred_search_local_var->is_no_preferred_features_ind = is_no_preferred_features_ind; |
64 | 0 | preferred_search_local_var->no_preferred_features_ind = no_preferred_features_ind; |
65 | 0 | preferred_search_local_var->is_preferred_op_config_cap_ind = is_preferred_op_config_cap_ind; |
66 | 0 | preferred_search_local_var->preferred_op_config_cap_ind = preferred_op_config_cap_ind; |
67 | 0 | preferred_search_local_var->is_preferred_upf_packet_inspection_match_ind = is_preferred_upf_packet_inspection_match_ind; |
68 | 0 | preferred_search_local_var->preferred_upf_packet_inspection_match_ind = preferred_upf_packet_inspection_match_ind; |
69 | |
|
70 | 0 | return preferred_search_local_var; |
71 | 0 | } |
72 | | |
73 | | void OpenAPI_preferred_search_free(OpenAPI_preferred_search_t *preferred_search) |
74 | 0 | { |
75 | 0 | OpenAPI_lnode_t *node = NULL; |
76 | |
|
77 | 0 | if (NULL == preferred_search) { |
78 | 0 | return; |
79 | 0 | } |
80 | 0 | ogs_free(preferred_search); |
81 | 0 | } |
82 | | |
83 | | cJSON *OpenAPI_preferred_search_convertToJSON(OpenAPI_preferred_search_t *preferred_search) |
84 | 0 | { |
85 | 0 | cJSON *item = NULL; |
86 | 0 | OpenAPI_lnode_t *node = NULL; |
87 | |
|
88 | 0 | if (preferred_search == NULL) { |
89 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [PreferredSearch]"); |
90 | 0 | return NULL; |
91 | 0 | } |
92 | | |
93 | 0 | item = cJSON_CreateObject(); |
94 | 0 | if (preferred_search->is_preferred_tai_match_ind) { |
95 | 0 | if (cJSON_AddBoolToObject(item, "preferredTaiMatchInd", preferred_search->preferred_tai_match_ind) == NULL) { |
96 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_tai_match_ind]"); |
97 | 0 | goto end; |
98 | 0 | } |
99 | 0 | } |
100 | | |
101 | 0 | if (preferred_search->is_preferred_full_plmn_match_ind) { |
102 | 0 | if (cJSON_AddBoolToObject(item, "preferredFullPlmnMatchInd", preferred_search->preferred_full_plmn_match_ind) == NULL) { |
103 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_full_plmn_match_ind]"); |
104 | 0 | goto end; |
105 | 0 | } |
106 | 0 | } |
107 | | |
108 | 0 | if (preferred_search->is_preferred_api_versions_match_ind) { |
109 | 0 | if (cJSON_AddBoolToObject(item, "preferredApiVersionsMatchInd", preferred_search->preferred_api_versions_match_ind) == NULL) { |
110 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_api_versions_match_ind]"); |
111 | 0 | goto end; |
112 | 0 | } |
113 | 0 | } |
114 | | |
115 | 0 | if (preferred_search->is_other_api_versions_ind) { |
116 | 0 | if (cJSON_AddBoolToObject(item, "otherApiVersionsInd", preferred_search->other_api_versions_ind) == NULL) { |
117 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [other_api_versions_ind]"); |
118 | 0 | goto end; |
119 | 0 | } |
120 | 0 | } |
121 | | |
122 | 0 | if (preferred_search->is_preferred_locality_match_ind) { |
123 | 0 | if (cJSON_AddBoolToObject(item, "preferredLocalityMatchInd", preferred_search->preferred_locality_match_ind) == NULL) { |
124 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_locality_match_ind]"); |
125 | 0 | goto end; |
126 | 0 | } |
127 | 0 | } |
128 | | |
129 | 0 | if (preferred_search->is_other_locality_ind) { |
130 | 0 | if (cJSON_AddBoolToObject(item, "otherLocalityInd", preferred_search->other_locality_ind) == NULL) { |
131 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [other_locality_ind]"); |
132 | 0 | goto end; |
133 | 0 | } |
134 | 0 | } |
135 | | |
136 | 0 | if (preferred_search->is_preferred_vendor_specific_features_ind) { |
137 | 0 | if (cJSON_AddBoolToObject(item, "preferredVendorSpecificFeaturesInd", preferred_search->preferred_vendor_specific_features_ind) == NULL) { |
138 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_vendor_specific_features_ind]"); |
139 | 0 | goto end; |
140 | 0 | } |
141 | 0 | } |
142 | | |
143 | 0 | if (preferred_search->is_preferred_collocated_nf_type_ind) { |
144 | 0 | if (cJSON_AddBoolToObject(item, "preferredCollocatedNfTypeInd", preferred_search->preferred_collocated_nf_type_ind) == NULL) { |
145 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_collocated_nf_type_ind]"); |
146 | 0 | goto end; |
147 | 0 | } |
148 | 0 | } |
149 | | |
150 | 0 | if (preferred_search->is_preferred_pgw_match_ind) { |
151 | 0 | if (cJSON_AddBoolToObject(item, "preferredPgwMatchInd", preferred_search->preferred_pgw_match_ind) == NULL) { |
152 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_pgw_match_ind]"); |
153 | 0 | goto end; |
154 | 0 | } |
155 | 0 | } |
156 | | |
157 | 0 | if (preferred_search->is_preferred_analytics_delays_ind) { |
158 | 0 | if (cJSON_AddBoolToObject(item, "preferredAnalyticsDelaysInd", preferred_search->preferred_analytics_delays_ind) == NULL) { |
159 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_analytics_delays_ind]"); |
160 | 0 | goto end; |
161 | 0 | } |
162 | 0 | } |
163 | | |
164 | 0 | if (preferred_search->is_preferred_features_match_ind) { |
165 | 0 | if (cJSON_AddBoolToObject(item, "preferredFeaturesMatchInd", preferred_search->preferred_features_match_ind) == NULL) { |
166 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_features_match_ind]"); |
167 | 0 | goto end; |
168 | 0 | } |
169 | 0 | } |
170 | | |
171 | 0 | if (preferred_search->is_no_preferred_features_ind) { |
172 | 0 | if (cJSON_AddBoolToObject(item, "noPreferredFeaturesInd", preferred_search->no_preferred_features_ind) == NULL) { |
173 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [no_preferred_features_ind]"); |
174 | 0 | goto end; |
175 | 0 | } |
176 | 0 | } |
177 | | |
178 | 0 | if (preferred_search->is_preferred_op_config_cap_ind) { |
179 | 0 | if (cJSON_AddBoolToObject(item, "preferredOpConfigCapInd", preferred_search->preferred_op_config_cap_ind) == NULL) { |
180 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_op_config_cap_ind]"); |
181 | 0 | goto end; |
182 | 0 | } |
183 | 0 | } |
184 | | |
185 | 0 | if (preferred_search->is_preferred_upf_packet_inspection_match_ind) { |
186 | 0 | if (cJSON_AddBoolToObject(item, "preferredUpfPacketInspectionMatchInd", preferred_search->preferred_upf_packet_inspection_match_ind) == NULL) { |
187 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed [preferred_upf_packet_inspection_match_ind]"); |
188 | 0 | goto end; |
189 | 0 | } |
190 | 0 | } |
191 | | |
192 | 0 | end: |
193 | 0 | return item; |
194 | 0 | } |
195 | | |
196 | | OpenAPI_preferred_search_t *OpenAPI_preferred_search_parseFromJSON(cJSON *preferred_searchJSON) |
197 | 0 | { |
198 | 0 | OpenAPI_preferred_search_t *preferred_search_local_var = NULL; |
199 | 0 | OpenAPI_lnode_t *node = NULL; |
200 | 0 | cJSON *preferred_tai_match_ind = NULL; |
201 | 0 | cJSON *preferred_full_plmn_match_ind = NULL; |
202 | 0 | cJSON *preferred_api_versions_match_ind = NULL; |
203 | 0 | cJSON *other_api_versions_ind = NULL; |
204 | 0 | cJSON *preferred_locality_match_ind = NULL; |
205 | 0 | cJSON *other_locality_ind = NULL; |
206 | 0 | cJSON *preferred_vendor_specific_features_ind = NULL; |
207 | 0 | cJSON *preferred_collocated_nf_type_ind = NULL; |
208 | 0 | cJSON *preferred_pgw_match_ind = NULL; |
209 | 0 | cJSON *preferred_analytics_delays_ind = NULL; |
210 | 0 | cJSON *preferred_features_match_ind = NULL; |
211 | 0 | cJSON *no_preferred_features_ind = NULL; |
212 | 0 | cJSON *preferred_op_config_cap_ind = NULL; |
213 | 0 | cJSON *preferred_upf_packet_inspection_match_ind = NULL; |
214 | 0 | preferred_tai_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredTaiMatchInd"); |
215 | 0 | if (preferred_tai_match_ind) { |
216 | 0 | if (!cJSON_IsBool(preferred_tai_match_ind)) { |
217 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_tai_match_ind]"); |
218 | 0 | goto end; |
219 | 0 | } |
220 | 0 | } |
221 | | |
222 | 0 | preferred_full_plmn_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredFullPlmnMatchInd"); |
223 | 0 | if (preferred_full_plmn_match_ind) { |
224 | 0 | if (!cJSON_IsBool(preferred_full_plmn_match_ind)) { |
225 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_full_plmn_match_ind]"); |
226 | 0 | goto end; |
227 | 0 | } |
228 | 0 | } |
229 | | |
230 | 0 | preferred_api_versions_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredApiVersionsMatchInd"); |
231 | 0 | if (preferred_api_versions_match_ind) { |
232 | 0 | if (!cJSON_IsBool(preferred_api_versions_match_ind)) { |
233 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_api_versions_match_ind]"); |
234 | 0 | goto end; |
235 | 0 | } |
236 | 0 | } |
237 | | |
238 | 0 | other_api_versions_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "otherApiVersionsInd"); |
239 | 0 | if (other_api_versions_ind) { |
240 | 0 | if (!cJSON_IsBool(other_api_versions_ind)) { |
241 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [other_api_versions_ind]"); |
242 | 0 | goto end; |
243 | 0 | } |
244 | 0 | } |
245 | | |
246 | 0 | preferred_locality_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredLocalityMatchInd"); |
247 | 0 | if (preferred_locality_match_ind) { |
248 | 0 | if (!cJSON_IsBool(preferred_locality_match_ind)) { |
249 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_locality_match_ind]"); |
250 | 0 | goto end; |
251 | 0 | } |
252 | 0 | } |
253 | | |
254 | 0 | other_locality_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "otherLocalityInd"); |
255 | 0 | if (other_locality_ind) { |
256 | 0 | if (!cJSON_IsBool(other_locality_ind)) { |
257 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [other_locality_ind]"); |
258 | 0 | goto end; |
259 | 0 | } |
260 | 0 | } |
261 | | |
262 | 0 | preferred_vendor_specific_features_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredVendorSpecificFeaturesInd"); |
263 | 0 | if (preferred_vendor_specific_features_ind) { |
264 | 0 | if (!cJSON_IsBool(preferred_vendor_specific_features_ind)) { |
265 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_vendor_specific_features_ind]"); |
266 | 0 | goto end; |
267 | 0 | } |
268 | 0 | } |
269 | | |
270 | 0 | preferred_collocated_nf_type_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredCollocatedNfTypeInd"); |
271 | 0 | if (preferred_collocated_nf_type_ind) { |
272 | 0 | if (!cJSON_IsBool(preferred_collocated_nf_type_ind)) { |
273 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_collocated_nf_type_ind]"); |
274 | 0 | goto end; |
275 | 0 | } |
276 | 0 | } |
277 | | |
278 | 0 | preferred_pgw_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredPgwMatchInd"); |
279 | 0 | if (preferred_pgw_match_ind) { |
280 | 0 | if (!cJSON_IsBool(preferred_pgw_match_ind)) { |
281 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_pgw_match_ind]"); |
282 | 0 | goto end; |
283 | 0 | } |
284 | 0 | } |
285 | | |
286 | 0 | preferred_analytics_delays_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredAnalyticsDelaysInd"); |
287 | 0 | if (preferred_analytics_delays_ind) { |
288 | 0 | if (!cJSON_IsBool(preferred_analytics_delays_ind)) { |
289 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_analytics_delays_ind]"); |
290 | 0 | goto end; |
291 | 0 | } |
292 | 0 | } |
293 | | |
294 | 0 | preferred_features_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredFeaturesMatchInd"); |
295 | 0 | if (preferred_features_match_ind) { |
296 | 0 | if (!cJSON_IsBool(preferred_features_match_ind)) { |
297 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_features_match_ind]"); |
298 | 0 | goto end; |
299 | 0 | } |
300 | 0 | } |
301 | | |
302 | 0 | no_preferred_features_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "noPreferredFeaturesInd"); |
303 | 0 | if (no_preferred_features_ind) { |
304 | 0 | if (!cJSON_IsBool(no_preferred_features_ind)) { |
305 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [no_preferred_features_ind]"); |
306 | 0 | goto end; |
307 | 0 | } |
308 | 0 | } |
309 | | |
310 | 0 | preferred_op_config_cap_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredOpConfigCapInd"); |
311 | 0 | if (preferred_op_config_cap_ind) { |
312 | 0 | if (!cJSON_IsBool(preferred_op_config_cap_ind)) { |
313 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_op_config_cap_ind]"); |
314 | 0 | goto end; |
315 | 0 | } |
316 | 0 | } |
317 | | |
318 | 0 | preferred_upf_packet_inspection_match_ind = cJSON_GetObjectItemCaseSensitive(preferred_searchJSON, "preferredUpfPacketInspectionMatchInd"); |
319 | 0 | if (preferred_upf_packet_inspection_match_ind) { |
320 | 0 | if (!cJSON_IsBool(preferred_upf_packet_inspection_match_ind)) { |
321 | 0 | ogs_error("OpenAPI_preferred_search_parseFromJSON() failed [preferred_upf_packet_inspection_match_ind]"); |
322 | 0 | goto end; |
323 | 0 | } |
324 | 0 | } |
325 | | |
326 | 0 | preferred_search_local_var = OpenAPI_preferred_search_create ( |
327 | 0 | preferred_tai_match_ind ? true : false, |
328 | 0 | preferred_tai_match_ind ? preferred_tai_match_ind->valueint : 0, |
329 | 0 | preferred_full_plmn_match_ind ? true : false, |
330 | 0 | preferred_full_plmn_match_ind ? preferred_full_plmn_match_ind->valueint : 0, |
331 | 0 | preferred_api_versions_match_ind ? true : false, |
332 | 0 | preferred_api_versions_match_ind ? preferred_api_versions_match_ind->valueint : 0, |
333 | 0 | other_api_versions_ind ? true : false, |
334 | 0 | other_api_versions_ind ? other_api_versions_ind->valueint : 0, |
335 | 0 | preferred_locality_match_ind ? true : false, |
336 | 0 | preferred_locality_match_ind ? preferred_locality_match_ind->valueint : 0, |
337 | 0 | other_locality_ind ? true : false, |
338 | 0 | other_locality_ind ? other_locality_ind->valueint : 0, |
339 | 0 | preferred_vendor_specific_features_ind ? true : false, |
340 | 0 | preferred_vendor_specific_features_ind ? preferred_vendor_specific_features_ind->valueint : 0, |
341 | 0 | preferred_collocated_nf_type_ind ? true : false, |
342 | 0 | preferred_collocated_nf_type_ind ? preferred_collocated_nf_type_ind->valueint : 0, |
343 | 0 | preferred_pgw_match_ind ? true : false, |
344 | 0 | preferred_pgw_match_ind ? preferred_pgw_match_ind->valueint : 0, |
345 | 0 | preferred_analytics_delays_ind ? true : false, |
346 | 0 | preferred_analytics_delays_ind ? preferred_analytics_delays_ind->valueint : 0, |
347 | 0 | preferred_features_match_ind ? true : false, |
348 | 0 | preferred_features_match_ind ? preferred_features_match_ind->valueint : 0, |
349 | 0 | no_preferred_features_ind ? true : false, |
350 | 0 | no_preferred_features_ind ? no_preferred_features_ind->valueint : 0, |
351 | 0 | preferred_op_config_cap_ind ? true : false, |
352 | 0 | preferred_op_config_cap_ind ? preferred_op_config_cap_ind->valueint : 0, |
353 | 0 | preferred_upf_packet_inspection_match_ind ? true : false, |
354 | 0 | preferred_upf_packet_inspection_match_ind ? preferred_upf_packet_inspection_match_ind->valueint : 0 |
355 | 0 | ); |
356 | |
|
357 | 0 | return preferred_search_local_var; |
358 | 0 | end: |
359 | 0 | return NULL; |
360 | 0 | } |
361 | | |
362 | | OpenAPI_preferred_search_t *OpenAPI_preferred_search_copy(OpenAPI_preferred_search_t *dst, OpenAPI_preferred_search_t *src) |
363 | 0 | { |
364 | 0 | cJSON *item = NULL; |
365 | 0 | char *content = NULL; |
366 | |
|
367 | 0 | ogs_assert(src); |
368 | 0 | item = OpenAPI_preferred_search_convertToJSON(src); |
369 | 0 | if (!item) { |
370 | 0 | ogs_error("OpenAPI_preferred_search_convertToJSON() failed"); |
371 | 0 | return NULL; |
372 | 0 | } |
373 | | |
374 | 0 | content = cJSON_Print(item); |
375 | 0 | cJSON_Delete(item); |
376 | |
|
377 | 0 | if (!content) { |
378 | 0 | ogs_error("cJSON_Print() failed"); |
379 | 0 | return NULL; |
380 | 0 | } |
381 | | |
382 | 0 | item = cJSON_Parse(content); |
383 | 0 | ogs_free(content); |
384 | 0 | if (!item) { |
385 | 0 | ogs_error("cJSON_Parse() failed"); |
386 | 0 | return NULL; |
387 | 0 | } |
388 | | |
389 | 0 | OpenAPI_preferred_search_free(dst); |
390 | 0 | dst = OpenAPI_preferred_search_parseFromJSON(item); |
391 | 0 | cJSON_Delete(item); |
392 | |
|
393 | 0 | return dst; |
394 | 0 | } |
395 | | |