}
void
-cf_declare_section(const char *name, struct cf_section *sec, uns allow_unknown)
+cf_declare_rel_section(const char *name, struct cf_section *sec, void *ptr, uns allow_unknown)
{
struct cf_context *cc = cf_obtain_context();
if (!cc->sections.cfg)
ci->cls = CC_SECTION;
ci->name = name;
ci->number = 1;
- ci->ptr = NULL;
+ ci->ptr = ptr;
ci->u.sec = sec;
inspect_section(sec);
if (allow_unknown)
}
}
+void
+cf_declare_section(const char *name, struct cf_section *sec, uns allow_unknown)
+{
+ cf_declare_rel_section(name, sec, NULL, allow_unknown);
+}
+
void
cf_init_section(const char *name, struct cf_section *sec, void *ptr, uns do_bzero)
{
* configuration contexts simultaneously.
**/
void cf_declare_section(const char *name, struct cf_section *sec, uns allow_unknown);
+/**
+ * Like @cf_declare_section(), but instead of item pointers, the section
+ * contains offsets relative to @ptr. In other words, it does the same
+ * as `CF_SECTION`, but for top-level sections.
+ **/
+void cf_declare_rel_section(const char *name, struct cf_section *sec, void *ptr, uns allow_unknown);
/**
* If you have a section in a structure and you want to initialize it
* (eg. if you want a copy of default values outside the configuration),