20#if defined(__has_include) 21#if __has_include(<iniparser/iniparser.h>) 22#include <iniparser/dictionary.h> 23#include <iniparser/iniparser.h> 24#elif __has_include(<iniparser.h>) 25#include <dictionary.h> 28#error "iniparser headers not found" 31#include <iniparser/dictionary.h> 32#include <iniparser/iniparser.h> 43int ini_alloc_handle(dictionary *d) {
45 for (
int i = 1; i < (int)(
sizeof(g_ini) /
sizeof(g_ini[0])); ++i) {
46 if (!g_ini[i].in_use) {
55dictionary *ini_get(
int h) {
56 if (h > 0 && h < (
int)(
sizeof(g_ini) /
sizeof(g_ini[0])) && g_ini[h].in_use)
return g_ini[h].dict;
60int ini_free_handle(
int h) {
61 if (h <= 0 || h >= (
int)(
sizeof(g_ini) /
sizeof(g_ini[0])) || !g_ini[h].in_use)
return 0;
62 if (g_ini[h].dict) iniparser_freedict(g_ini[h].dict);
68void ini_make_full_key(
char *
buf,
size_t cap,
const char *sec,
const char *key) {
69 if (!
buf ||
cap == 0)
return;
73 snprintf(
buf,
cap,
"%s:%s", sec, key);
INI handle registry for iniparser 4.2.6 used by INI VM opcodes.