add value processing to conf.c

This commit is contained in:
2025-12-16 11:36:31 +01:00
parent 3a2041194c
commit b595d83468
2 changed files with 49 additions and 1 deletions

View File

@@ -7,6 +7,20 @@
#include "../types.h"
#include "../util/atrb.h"
enum conf_type {
CONF_STR = 0x00,
CONF_I8 = 0x00 | 0x01,
CONF_I16 = 0x00 | 0x02,
CONF_I32 = 0x00 | 0x04,
CONF_I64 = 0x00 | 0x08,
CONF_U8 = 0x10 | 0x01,
CONF_U16 = 0x10 | 0x02,
CONF_U32 = 0x10 | 0x04,
CONF_U64 = 0x10 | 0x08,
CONF_F32 = 0x20 | 0x04,
CONF_F64 = 0x20 | 0x08,
};
/* Gets the key and value, if present. Writes the pointer for the value to `out`.
* Returns the key index, or <0 upon failure. */
int conf_getkeyval(const char *restrict buf, const char *const restrict *restrict keys, int klen,