summaryrefslogtreecommitdiffstats
path: root/src/conf.c
diff options
context:
space:
mode:
authorNicolas Pitre <nico@fluxnic.net>2021-03-20 16:42:03 -0400
committerNicolas Pitre <nico@fluxnic.net>2021-03-20 20:01:22 -0400
commit5ab0f201ee0b5631939c30e323c2241007902dc8 (patch)
treede55bdc6b513864e25cd4b04c92257a055ac0878 /src/conf.c
parentff591ab004afd4451049f5c10b7c183ecf00c715 (diff)
store dictionary values as both a string and an integer value
This will allow for not doing atoi() over and over everywhere.
Diffstat (limited to 'src/conf.c')
-rw-r--r--src/conf.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/conf.c b/src/conf.c
index c152bdd..3142bd8 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -153,7 +153,7 @@ char * get_conf_values(char * salida) {
}
/**
- * \brief Retreive the value of a given key in user_conf_d
+ * \brief Retreive the string value of a given key in user_conf_d
*
* \details This function will look for a given key in the user_conf_d
* dictionary. If the key is found it will return the value of that
@@ -169,3 +169,21 @@ char * get_conf_values(char * salida) {
char * get_conf_value(char * key) {
return get(user_conf_d, key);
}
+
+/**
+ * \brief Retreive the integer value of a given key in user_conf_d
+ *
+ * \details This function will look for a given key in the user_conf_d
+ * dictionary. If the key is found it will return the value of that
+ * dictionary entry, or 0 otherwise.
+ *
+ * \param[in] key The key to search for in user_conf_d
+ *
+ * \return key value
+ */
+// TODO Make this function take a pointer to a dictionary as an
+// argument rather than using user_conf_d directly.
+
+int get_conf_int(char * key) {
+ return get_int(user_conf_d, key);
+}