aboutsummaryrefslogtreecommitdiffstats
path: root/src/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h33
1 files changed, 17 insertions, 16 deletions
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 */