Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
dt_conf_t Struct Reference

The whole configuration state. One instance lives at darktable.conf. More...

#include <conf.h>

+ Collaboration diagram for dt_conf_t:

Data Fields

dt_pthread_mutex_t mutex
 
char filename [DT_PATH_MAX]
 
GHashTable * table
 
GHashTable * x_confgen
 
GHashTable * override_entries
 
GPtrArray * retired_values
 

Detailed Description

The whole configuration state. One instance lives at darktable.conf.

Every dt_conf_*() call below reaches it through that global and dereferences it WITHOUT checking, so dt_conf_init() must have run before any of them. There is no "conf not ready" return value; calling early is a NULL dereference.

The two hash tables have opposite lifetimes, and that difference decides which returned pointers are safe to hold:

  • table is LIVE. Any thread may replace a value through dt_conf_set_*(), and g_hash_table_insert() frees the value it replaces. A pointer into it is therefore only valid while mutex is held.
  • x_confgen is built once by dt_conf_init() from the generated XML and only read afterwards, until dt_conf_cleanup(). Pointers into it stay valid for the process lifetime, which is why the dt_confgen_*() readers take no lock at all.

Definition at line 98 of file conf.h.

Field Documentation

◆ filename

◆ mutex

dt_pthread_mutex_t dt_conf_t::mutex

◆ override_entries

GHashTable* dt_conf_t::override_entries

Keys forced on the command line; they win over table on read. Written once by dt_conf_init() and read-only afterwards, so pointers into it are stable.

Definition at line 110 of file conf.h.

Referenced by _dt_conf_get_var_locked(), dt_conf_cleanup(), dt_conf_init(), dt_conf_key_exists(), and dt_conf_set_if_not_overridden().

◆ retired_values

GPtrArray* dt_conf_t::retired_values

Values displaced by a later write, kept alive until dt_conf_cleanup(). dt_conf_get_string_const() borrows pointers into table and its readers hold them without the lock, so a replaced value cannot be freed at the moment it is replaced. Grows only when a key's value actually changes.

Definition at line 115 of file conf.h.

Referenced by dt_conf_cleanup(), dt_conf_init(), and dt_conf_set_if_not_overridden().

◆ table

GHashTable* dt_conf_t::table

Live key -> value strings, user-writable. Values are replaced and freed at runtime.

Definition at line 105 of file conf.h.

Referenced by _dt_conf_get_var_locked(), dt_conf_all_string_entries(), dt_conf_cleanup(), dt_conf_init(), dt_conf_key_exists(), dt_conf_save(), and dt_conf_set_if_not_overridden().

◆ x_confgen

GHashTable* dt_conf_t::x_confgen

Defaults, bounds and descriptions from the generated XML. Immutable after init.

Definition at line 107 of file conf.h.

Referenced by _sanitize_confgen(), dt_conf_cleanup(), dt_conf_init(), dt_confgen_exists(), dt_confgen_get(), dt_confgen_get_label(), dt_confgen_get_tooltip(), dt_confgen_type(), and dt_confgen_value_exists().


The documentation for this struct was generated from the following file: