struct cf_context {
struct mempool *pool;
int is_active;
- int need_journal;
int def_loaded;
struct cf_parser_state *parser;
uns everything_committed; // after the 1st load, this flag is set on
uns postpone_commit; // used internally by cf_getopt()
uns other_options;
- clist conf_entries;
+ clist conf_entries; // files/strings to reload
struct old_pools *pools;
struct cf_journal_item *journal;
- struct item_stack stack[MAX_STACK_SIZE];
+ int need_journal;
+ struct item_stack stack[MAX_STACK_SIZE]; // interpreter stack
uns stack_level;
- uns initialized;
struct cf_section sections; // root section
+ uns sections_initialized;
dirtsec_t dirty; // dirty sections
uns dirties;
};
void
cf_init_stack(struct cf_context *cc)
{
- if (!cc->initialized++) {
+ if (!cc->sections_initialized++) {
cc->sections.flags |= SEC_FLAG_UNKNOWN;
cc->sections.size = 0; // size of allocated array used to be stored here
cf_init_section(NULL, &cc->sections, NULL, 0);
byte copy[0];
};
+void
+cf_set_journalling(int enable)
+{
+ struct cf_context *cc = cf_get_context();
+ ASSERT(!cc->journal);
+ cc->need_journal = enable;
+}
+
void
cf_journal_block(void *ptr, uns len)
{
*
* For error recovery when <<reload,reloading configuration>>.
***/
-extern uns cf_need_journal; /** Is the journal needed? If you do not reload configuration, you set this to 0 and gain a little more performance and free memory. **/
+/**
+ * By default, the configuration mechanism remembers all changes in a journal,
+ * so that the configuration can be rolled back or reloaded. This function
+ * can be used to disable journalling, which saves some memory.
+ **/
+void cf_set_journalling(int enable);
/**
* When a block of memory is about to be changed, put the old value
* into journal with this function. You need to call it from a <<hooks,commit hook>>