43#if defined(__has_include)
44#if __has_include(<iniparser/iniparser.h>)
45#include <iniparser/dictionary.h>
46#include <iniparser/iniparser.h>
47#elif __has_include(<iniparser.h>)
48#include <dictionary.h>
51#error "iniparser headers not found"
54#include <iniparser/dictionary.h>
55#include <iniparser/iniparser.h>
94 for (
int i = 1; i < (int)(
sizeof(
g_ini) /
sizeof(
g_ini[0])); ++i) {
95 if (!
g_ini[i].in_use) {
115 if (h > 0 && h < (
int)(
sizeof(
g_ini) /
sizeof(
g_ini[0])) &&
g_ini[h].in_use)
return g_ini[h].dict;
129 if (h <= 0 || h >= (
int)(
sizeof(
g_ini) /
sizeof(
g_ini[0])) || !
g_ini[h].in_use)
return 0;
130 if (
g_ini[h].dict) iniparser_freedict(
g_ini[h].dict);
131 g_ini[h].dict = NULL;
150 if (!buf || cap == 0)
return;
154 snprintf(buf, cap,
"%s:%s", sec, key);
dictionary * ini_get(int h)
Look up a dictionary pointer by registry handle.
int ini_free_handle(int h)
Free a previously allocated handle and close its dictionary.
int ini_alloc_handle(dictionary *d)
Allocate a registry handle for a newly created dictionary.
void ini_make_full_key(char *buf, size_t cap, const char *sec, const char *key)
Build a fully qualified key of the form "section:key".
IniSlot g_ini[64]
Fixed-size registry of iniparser dictionaries.
One slot in the global INI handle registry.