GCC Code Coverage Report


Directory: src/gate/
File: src/gate/system/configurations.c
Date: 2025-09-14 13:10:38
Exec Total Coverage
Lines: 114 134 85.1%
Functions: 8 8 100.0%
Branches: 40 78 51.3%

Line Branch Exec Source
1 /* GATE PROJECT LICENSE:
2 +----------------------------------------------------------------------------+
3 | Copyright(c) 2018-2025, Stefan Meislinger |
4 | All rights reserved. |
5 | |
6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met:|
8 | |
9 | 1. Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. |
11 | 2. Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. |
14 | |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"|
16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
18 | ARE DISCLAIMED.IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
25 | THE POSSIBILITY OF SUCH DAMAGE. |
26 +----------------------------------------------------------------------------+
27 */
28
29 #include "gate/system/configurations.h"
30 #include "gate/results.h"
31
32 #if defined(GATE_SYS_WIN) && !defined(GATE_SYS_WIN16)
33 # define GATE_SYSTEM_CONFIGURATIONS_WINREG_IMPL 1
34 #elif defined(GATE_SYS_POSIX)
35 # define GATE_SYSTEM_CONFIGURATIONS_INIFILE_IMPL 1
36 #else
37 # define GATE_SYSTEM_CONFIGURATIONS_NO_IMPL 1
38 #endif
39
40
41 #if defined(GATE_SYSTEM_CONFIGURATIONS_WINREG_IMPL)
42
43 #include "gate/platform/windows/win32registry.h"
44
45 static int gate_appconfig_root(gate_uint32_t scope)
46 {
47 if (GATE_FLAG_ENABLED(scope, GATE_APPCONFIG_SCOPE_GLOBAL))
48 {
49 return GATE_WIN32_REGISTRY_LOCALMACHINE;
50 }
51 else
52 {
53 return GATE_WIN32_REGISTRY_CURRENTUSER;
54 }
55
56 }
57
58 static gate_size_t gate_appconfig_path(gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory,
59 gate_enumint_t scope, gate_bool_t create_keys,
60 TCHAR* buffer, gate_size_t buffer_size)
61 {
62 static TCHAR const softwarekey[] = _T("SOFTWARE\\");
63 static TCHAR const* default_app_name = _T("opengate.at");
64
65 gate_size_t len;
66 gate_size_t pos = 0;
67 int root = gate_appconfig_root(scope);
68
69 len = gate_win32_winstr_print_text(&buffer[pos], buffer_size, softwarekey, gate_win32_winstr_length(softwarekey));
70 pos += len;
71 buffer_size -= len;
72
73 {
74 /* add app_name to path */
75 if (gate_string_is_empty(app_name))
76 {
77 len = gate_win32_winstr_print_text(&buffer[pos], buffer_size, default_app_name, gate_win32_winstr_length(default_app_name));
78 }
79 else
80 {
81 len = gate_win32_utf8_2_winstr(app_name->str, app_name->length, &buffer[pos], buffer_size);
82 }
83 pos += len;
84 buffer_size -= len;
85 if (buffer_size <= 2) return 0;
86
87 if (create_keys)
88 {
89 gate_win32_registry_create_path(root, buffer);
90 }
91 }
92
93 if (!gate_string_is_empty(source_name))
94 {
95 /* add source_name to path */
96 if (buffer_size <= 2) return 0;
97 buffer[pos] = '\\';
98 ++pos;
99 buffer[pos] = 0;
100 --buffer_size;
101
102 len = gate_win32_utf8_2_winstr(source_name->str, source_name->length, &buffer[pos], buffer_size);
103 pos += len;
104 buffer_size -= len;
105 if (buffer_size <= 2) return 0;
106
107 if (create_keys)
108 {
109 gate_win32_registry_create_path(root, buffer);
110 }
111 }
112
113
114 if (!gate_string_is_empty(subcategory))
115 {
116 /* add subcategory to path */
117 if (buffer_size <= 2) return 0;
118 buffer[pos] = '\\';
119 ++pos;
120 buffer[pos] = 0;
121 --buffer_size;
122
123 len = gate_win32_utf8_2_winstr(subcategory->str, subcategory->length, &buffer[pos], buffer_size);
124 pos += len;
125 buffer_size -= len;
126 if (buffer_size <= 2) return 0;
127
128 if (create_keys)
129 {
130 gate_win32_registry_create_path(root, buffer);
131 }
132 }
133
134 return pos;
135 }
136
137
138 gate_result_t gate_appconfig_read_text(
139 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
140 gate_string_t const* key, gate_string_t* value)
141 {
142 TCHAR path[2048];
143 TCHAR key_name[1024];
144 gate_size_t path_used;
145 int root = gate_appconfig_root(scope);
146
147 gate_win32_utf8_2_winstr(key->str, key->length, key_name, sizeof(key_name) / sizeof(key_name[0]));
148 path_used = gate_appconfig_path(app_name, source_name, subcategory, scope, false, path, sizeof(path) / sizeof(path[0]));
149 return gate_win32_registry_read_string(root, path, key_name, value);
150 }
151
152 gate_result_t gate_appconfig_read_num(
153 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
154 gate_string_t const* key, gate_int32_t* num)
155 {
156 TCHAR path[2048];
157 TCHAR key_name[1024];
158 gate_size_t path_used;
159 gate_result_t ret;
160 DWORD dw = 0;
161 int root = gate_appconfig_root(scope);
162
163 gate_win32_utf8_2_winstr(key->str, key->length, key_name, sizeof(key_name) / sizeof(key_name[0]));
164 path_used = gate_appconfig_path(app_name, source_name, subcategory, scope, false, path, sizeof(path) / sizeof(path[0]));
165 ret = gate_win32_registry_read_dword(root, path, key_name, &dw);
166 if (num)
167 {
168 *num = (gate_int32_t)dw;
169 }
170 return ret;
171 }
172
173
174 gate_result_t gate_appconfig_write_text(
175 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
176 gate_string_t const* key, gate_string_t const* value)
177 {
178 TCHAR path[2048];
179 TCHAR key_name[1024];
180 gate_size_t path_used;
181 int root = gate_appconfig_root(scope);
182
183 gate_win32_utf8_2_winstr(key->str, key->length, key_name, sizeof(key_name) / sizeof(key_name[0]));
184 path_used = gate_appconfig_path(app_name, source_name, subcategory, scope, true, path, sizeof(path) / sizeof(path[0]));
185 return gate_win32_registry_write_string(root, path, key_name, value);
186 }
187
188 gate_result_t gate_appconfig_write_num(
189 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
190 gate_string_t const* key, gate_int32_t num)
191 {
192 TCHAR path[2048];
193 TCHAR key_name[1024];
194 gate_size_t path_used;
195 int root = gate_appconfig_root(scope);
196
197 gate_win32_utf8_2_winstr(key->str, key->length, key_name, sizeof(key_name) / sizeof(key_name[0]));
198 path_used = gate_appconfig_path(app_name, source_name, subcategory, scope, true, path, sizeof(path) / sizeof(path[0]));
199 return gate_win32_registry_write_dword(root, path, key_name, (DWORD)num);
200 }
201
202 gate_result_t gate_appconfig_remove(
203 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
204 gate_string_t const* key)
205 {
206 TCHAR path[2048];
207 TCHAR key_name[1024];
208 gate_size_t path_used;
209 int root = gate_appconfig_root(scope);
210
211 gate_win32_utf8_2_winstr(key->str, key->length, key_name, sizeof(key_name) / sizeof(key_name[0]));
212 path_used = gate_appconfig_path(app_name, source_name, subcategory, scope, true, path, sizeof(path) / sizeof(path[0]));
213 return gate_win32_registry_delete_value(root, path, key_name);
214 }
215
216
217 #endif /* GATE_SYSTEM_CONFIGURATIONS_WINREG_IMPL */
218
219
220
221
222 #if defined(GATE_SYSTEM_CONFIGURATIONS_INIFILE_IMPL)
223
224 #include "gate/encode/inifiles.h"
225 #include "gate/files.h"
226 #include "sys/stat.h"
227 #include "gate/environments.h"
228 #include "gate/debugging.h"
229
230 #define GATE_SYSTEM_CONFIG_SUBDIR_TOKEN "opengate.at"
231
232 static gate_string_t const default_source = GATE_STRING_INIT_STATIC("configurations");
233
234 static gate_string_t const local_config_root_dir = GATE_STRING_INIT_STATIC(".config/");
235 static gate_string_t const global_config_root_dir = GATE_STRING_INIT_STATIC("/etc/");
236 static gate_string_t const native_config_root_dir = GATE_STRING_INIT_STATIC("./");
237
238 static gate_string_t const default_app_name = GATE_STRING_INIT_STATIC("opengate.at");
239 static gate_string_t const default_source_name = GATE_STRING_INIT_STATIC("config");
240
241 12 static gate_result_t gate_appconfig_get_file(
242 gate_string_t const* app_name, gate_string_t const* source_name, gate_enumint_t scope,
243 gate_bool_t create_dirs, char* file_path, gate_size_t file_path_capacity)
244 {
245 12 gate_strbuilder_t builder = GATE_INIT_EMPTY;
246 12 gate_string_t const* str_root = NULL;
247 12 gate_string_t str_prefix = GATE_STRING_INIT_EMPTY;
248 12 gate_string_t str_path = GATE_STRING_INIT_EMPTY;
249 12 gate_result_t result = GATE_RESULT_FAILED;
250
251
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
12 if (gate_string_is_empty(app_name))
252 {
253 app_name = &default_app_name;
254 }
255
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
12 if (gate_string_is_empty(source_name))
256 {
257 source_name = &default_source_name;
258 }
259
260
1/4
✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
12 switch (scope)
261 {
262 12 case GATE_APPCONFIG_SCOPE_LOCAL:
263 12 gate_env_home_rootpath(&str_prefix);
264 12 str_root = &local_config_root_dir;
265 12 break;
266 case GATE_APPCONFIG_SCOPE_GLOBAL:
267 str_root = &global_config_root_dir;
268 break;
269 case GATE_APPCONFIG_SCOPE_NATIVE:
270 str_root = &native_config_root_dir;
271 break;
272 default:
273 return GATE_RESULT_INVALIDARG;
274 }
275
276 do
277 {
278 12 gate_strbuilder_create_static(&builder, file_path, file_path_capacity, 0);
279
280
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
12 if (0 == gate_strbuilder_append(&builder,
281 GATE_PRINT_STRING, &str_prefix,
282 GATE_PRINT_STRING, str_root,
283 GATE_PRINT_STRING, app_name,
284 GATE_PRINT_END))
285 {
286 GATE_DEBUG_TRACE("Failed to append path");
287 result = GATE_RESULT_OUTOFMEMORY;
288 break;
289 }
290
291
2/2
✓ Branch 0 taken 8 times.
✓ Branch 1 taken 4 times.
12 if (create_dirs)
292 {
293 8 gate_string_create_static_len(&str_path, gate_strbuilder_ptr(&builder, 0), gate_strbuilder_length(&builder));
294 8 result = gate_file_dir_create_all(&str_path, GATE_FILE_DIR_CREATE_DEFAULT);
295
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_BREAK_IF_FAILED(result);
296 }
297
298
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
12 if (0 == gate_strbuilder_append(&builder,
299 GATE_PRINT_CSTR, "/",
300 GATE_PRINT_STRING, source_name,
301 GATE_PRINT_CSTR, ".ini",
302 GATE_PRINT_END))
303 {
304 GATE_DEBUG_TRACE("Failed to append file name");
305 result = GATE_RESULT_OUTOFMEMORY;
306 break;
307 }
308
309 12 result = GATE_RESULT_OK;
310 } while (0);
311
312 12 gate_strbuilder_release(&builder);
313 12 gate_string_release(&str_prefix);
314 12 gate_string_release(&str_path);
315 12 return result;
316 }
317
318 4 static gate_result_t gate_appconfig_retrieve_setting(
319 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
320 gate_string_t const* key, gate_string_t* ptr_content)
321 {
322 gate_result_t ret;
323 4 char filepath[GATE_MAX_FILEPATH_LENGTH] = GATE_INIT_EMPTY;
324 4 gate_string_t inifile_path = GATE_STRING_INIT_EMPTY;
325 4 gate_controlstream_t* stream = NULL;
326 4 gate_inifile_store_t inistore = GATE_INIT_EMPTY;
327
328 do
329 {
330 4 ret = gate_appconfig_get_file(app_name, source_name, scope, false, filepath, sizeof(filepath));
331
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_DEBUG_TRACE_FAILED(ret, "Failed to build config file");
332
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_BREAK_IF_FAILED(ret);
333
334 4 gate_string_create_static(&inifile_path, filepath);
335
336 4 ret = gate_file_openstream(&inifile_path, GATE_STREAM_OPEN_READ, &stream);
337
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_DEBUG_TRACE_FAILED(ret, "Failed to open config file");
338
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_BREAK_IF_FAILED(ret);
339
340 4 ret = gate_inifile_store_create(&inistore);
341
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_DEBUG_TRACE_FAILED(ret, "Failed to create ini store");
342
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_BREAK_IF_FAILED(ret);
343
344 4 ret = gate_inifile_store_load(&inistore, (gate_stream_t*)stream);
345
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_DEBUG_TRACE_FAILED(ret, "Failed to load ini store");
346
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_BREAK_IF_FAILED(ret);
347
348 4 ret = gate_inifile_store_get(&inistore, subcategory, key, ptr_content);
349
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_DEBUG_TRACE_FAILED(ret, "Failed to retrieve ini key");
350 } while (0);
351
352
1/2
✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
4 if (stream != NULL)
353 {
354 4 gate_object_release(stream);
355 }
356 4 gate_inifile_store_destroy(&inistore);
357 4 gate_string_release(&inifile_path);
358 4 return ret;
359 }
360
361 8 static gate_result_t gate_appconfig_update_setting(
362 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
363 gate_string_t const* key, gate_string_t const* ptr_content)
364 {
365 gate_result_t ret;
366 8 char filepath[GATE_MAX_FILEPATH_LENGTH] = GATE_INIT_EMPTY;
367 8 gate_string_t inifile_path = GATE_STRING_INIT_EMPTY;
368 8 gate_controlstream_t* stream = NULL;
369 8 gate_inifile_store_t inistore = GATE_INIT_EMPTY;
370
371 do
372 {
373 8 ret = gate_appconfig_get_file(app_name, source_name, scope, true, filepath, sizeof(filepath) - 1);
374
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_DEBUG_TRACE_FAILED(ret, "Failed to build config file");
375
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_BREAK_IF_FAILED(ret);
376
377 8 gate_string_create_static(&inifile_path, filepath);
378
379 8 ret = gate_file_openstream(&inifile_path, GATE_STREAM_OPEN_READWRITE, &stream);
380
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_DEBUG_TRACE_FAILED(ret, "Failed to open config file");
381
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_BREAK_IF_FAILED(ret);
382
383 8 ret = gate_inifile_store_create(&inistore);
384
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_DEBUG_TRACE_FAILED(ret, "Failed to create ini store");
385
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_BREAK_IF_FAILED(ret);
386
387 8 ret = gate_inifile_store_load(&inistore, (gate_stream_t*)stream);
388
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_DEBUG_TRACE_FAILED(ret, "Failed to load ini store");
389
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_BREAK_IF_FAILED(ret);
390
391
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 4 times.
8 if (NULL == ptr_content)
392 {
393 4 ret = gate_inifile_store_remove(&inistore, subcategory, key);
394
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_DEBUG_TRACE_FAILED(ret, "Failed to delete ini key");
395
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_BREAK_IF_FAILED(ret);
396 }
397 else
398 {
399 4 ret = gate_inifile_store_set(&inistore, subcategory, key, ptr_content);
400
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_DEBUG_TRACE_FAILED(ret, "Failed to store ini key");
401
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 GATE_BREAK_IF_FAILED(ret);
402 }
403
404 8 ret = gate_stream_reset(stream);
405
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_DEBUG_TRACE_FAILED(ret, "Failed to reset ini stream");
406
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_BREAK_IF_FAILED(ret);
407
408 8 ret = gate_inifile_store_save(&inistore, (gate_stream_t*)stream);
409
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 GATE_DEBUG_TRACE_FAILED(ret, "Failed to save ini stream");
410 } while (0);
411
412
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 if (stream != NULL)
413 {
414 8 gate_object_release(stream);
415 }
416 8 gate_inifile_store_destroy(&inistore);
417 8 gate_string_release(&inifile_path);
418 8 return ret;
419 }
420
421
422
423 2 gate_result_t gate_appconfig_read_text(
424 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
425 gate_string_t const* key, gate_string_t* value)
426 {
427 gate_result_t ret;
428 2 ret = gate_appconfig_retrieve_setting(app_name, source_name, subcategory, scope, key, value);
429 2 return ret;
430 }
431
432 2 gate_result_t gate_appconfig_read_num(
433 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
434 gate_string_t const* key, gate_int32_t* num)
435 {
436 gate_result_t ret;
437 2 gate_string_t text = GATE_STRING_INIT_EMPTY;
438 2 gate_int64_t i64 = 0;
439 2 gate_size_t len = 0;
440
441 do
442 {
443 2 ret = gate_appconfig_retrieve_setting(app_name, source_name, subcategory, scope, key, &text);
444
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 GATE_BREAK_IF_FAILED(ret);
445
446 2 len = gate_string_parse_int(&text, &i64);
447
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (len == 0)
448 {
449 ret = GATE_RESULT_INVALIDCONTENT;
450 break;
451 }
452
453
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (num)
454 {
455 2 *num = (gate_int32_t)i64;
456 }
457 } while (0);
458
459 2 gate_string_release(&text);
460 2 return ret;
461 }
462
463
464 4 gate_result_t gate_appconfig_write_text(
465 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
466 gate_string_t const* key, gate_string_t const* value)
467 {
468 4 gate_result_t ret = gate_appconfig_update_setting(app_name, source_name, subcategory, scope, key, value);
469 4 return ret;
470 }
471
472 2 gate_result_t gate_appconfig_write_num(
473 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
474 gate_string_t const* key, gate_int32_t num)
475 {
476 2 gate_result_t ret = GATE_RESULT_FAILED;
477 char buffer[128];
478 gate_size_t len;
479 2 gate_string_t text = GATE_STRING_INIT_EMPTY;
480 do
481 {
482 2 len = gate_str_print_int64(buffer, sizeof(buffer), (gate_int64_t)num);
483
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
2 if (NULL == gate_string_create_static_len(&text, buffer, len))
484 {
485 ret = GATE_RESULT_OUTOFMEMORY;
486 break;
487 }
488 2 ret = gate_appconfig_write_text(app_name, source_name, subcategory, scope, key, &text);
489 } while (0);
490 2 gate_string_release(&text);
491 2 return ret;
492 }
493
494 4 gate_result_t gate_appconfig_remove(
495 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
496 gate_string_t const* key)
497 {
498 4 gate_result_t ret = gate_appconfig_update_setting(app_name, source_name, subcategory, scope, key, NULL);
499 4 return ret;
500 }
501
502
503 #endif /* GATE_SYSTEM_CONFIGURATIONS_APPDIR_IMPL */
504
505
506
507 #if defined(GATE_SYSTEM_CONFIGURATIONS_NO_IMPL)
508
509 gate_result_t gate_appconfig_read_text(
510 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
511 gate_string_t const* key, gate_string_t* value)
512 {
513 GATE_UNUSED_ARG(app_name);
514 GATE_UNUSED_ARG(source_name);
515 GATE_UNUSED_ARG(subcategory);
516 GATE_UNUSED_ARG(scope);
517 GATE_UNUSED_ARG(key);
518 GATE_UNUSED_ARG(value);
519 return GATE_RESULT_NOTIMPLEMENTED;
520 }
521
522 gate_result_t gate_appconfig_read_num(
523 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
524 gate_string_t const* key, gate_int32_t* num)
525 {
526 GATE_UNUSED_ARG(app_name);
527 GATE_UNUSED_ARG(source_name);
528 GATE_UNUSED_ARG(subcategory);
529 GATE_UNUSED_ARG(scope);
530 GATE_UNUSED_ARG(key);
531 GATE_UNUSED_ARG(num);
532 return GATE_RESULT_NOTIMPLEMENTED;
533 }
534
535
536 gate_result_t gate_appconfig_write_text(
537 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
538 gate_string_t const* key, gate_string_t const* value)
539 {
540 GATE_UNUSED_ARG(app_name);
541 GATE_UNUSED_ARG(source_name);
542 GATE_UNUSED_ARG(subcategory);
543 GATE_UNUSED_ARG(scope);
544 GATE_UNUSED_ARG(key);
545 GATE_UNUSED_ARG(value);
546 return GATE_RESULT_NOTIMPLEMENTED;
547 }
548
549 gate_result_t gate_appconfig_write_num(
550 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
551 gate_string_t const* key, gate_int32_t num)
552 {
553 GATE_UNUSED_ARG(app_name);
554 GATE_UNUSED_ARG(source_name);
555 GATE_UNUSED_ARG(subcategory);
556 GATE_UNUSED_ARG(scope);
557 GATE_UNUSED_ARG(key);
558 GATE_UNUSED_ARG(num);
559 return GATE_RESULT_NOTIMPLEMENTED;
560 }
561
562 gate_result_t gate_appconfig_remove(
563 gate_string_t const* app_name, gate_string_t const* source_name, gate_string_t const* subcategory, gate_enumint_t scope,
564 gate_string_t const* key)
565 {
566 GATE_UNUSED_ARG(app_name);
567 GATE_UNUSED_ARG(source_name);
568 GATE_UNUSED_ARG(subcategory);
569 GATE_UNUSED_ARG(scope);
570 GATE_UNUSED_ARG(key);
571 return GATE_RESULT_NOTIMPLEMENTED;
572 }
573
574 #endif /* GATE_SYSTEM_CONFIGURATIONS_NO_IMPL */
575