From 3d30c8499ae37ca0ff837e9deaad359de0297765 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Wed, 18 Feb 2026 23:23:44 +0100 Subject: Rename all identifiers to strict Linux snake_case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Types PascalCase→snake_case, functions camelCase→snake_case, static functions get _s_ prefix, globals get g_ prefix, struct members and locals to snake_case. --- src/config.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/config.h') diff --git a/src/config.h b/src/config.h index 2c5e364..c35dcd8 100644 --- a/src/config.h +++ b/src/config.h @@ -21,32 +21,32 @@ typedef struct { char *key; char *value; -} ConfigEntry; +} config_entry; /** * @brief A parsed configuration file. * - * Holds a dynamic array of ConfigEntry items. + * Holds a dynamic array of config_entry items. */ typedef struct { - ConfigEntry *entries; + config_entry *entries; size_t count; size_t capacity; -} Config; +} config; /** - * @brief Parses a configuration file into a Config structure. + * @brief Parses a configuration file into a config structure. * * Each non-blank, non-comment line must contain '=' separating key * and value. Whitespace is trimmed around both key and value. * * @param path Path to the configuration file. * @param cfg Output: the parsed configuration. Must be freed - * with configFree() when no longer needed. + * with config_free() when no longer needed. * @return 0 on success, -1 on error (logged via UA_LOG_ERROR). */ -int configLoad (const char *path, Config *cfg); +int config_load (const char *path, config *cfg); /** * @brief Looks up a single-valued key. @@ -58,12 +58,12 @@ int configLoad (const char *path, Config *cfg); * @param key The key to search for. * @return The value string (owned by cfg), or NULL. */ -const char *configGet (const Config *cfg, const char *key); +const char *config_get (const config *cfg, const char *key); /** * @brief Looks up a required single-valued key. * - * Like configGet(), but logs a FATAL error and returns NULL when + * Like config_get(), but logs a FATAL error and returns NULL when * the key is missing. * * @param cfg The parsed configuration. @@ -71,8 +71,8 @@ const char *configGet (const Config *cfg, const char *key); * @param program Program name (for error messages). * @return The value string (owned by cfg), or NULL if missing. */ -const char *configRequire (const Config *cfg, const char *key, - const char *program); +const char *config_require (const config *cfg, const char *key, + const char *program); /** * @brief Looks up a required integer-valued key. @@ -86,16 +86,17 @@ const char *configRequire (const Config *cfg, const char *key, * @param program Program name (for error messages). * @return The parsed integer, or -1 on error. */ -int configRequireInt (const Config *cfg, const char *key, const char *program); +int config_require_int (const config *cfg, const char *key, + const char *program); /** - * @brief Frees all memory owned by a Config structure. + * @brief Frees all memory owned by a config structure. * - * After this call the Config is zeroed and must not be used - * unless configLoad() is called again. + * After this call the config is zeroed and must not be used + * unless config_load() is called again. * * @param cfg The configuration to free. */ -void configFree (Config *cfg); +void config_free (config *cfg); #endif /* DISCOVERY_CONFIG_H */ -- cgit v1.2.3