diff options
Diffstat (limited to 'conf.c')
-rw-r--r-- | conf.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -19,6 +19,7 @@ #include <stdint.h> #include <string.h> #include <stdlib.h> +#include <inttypes.h> #include "conf.h" static DB_conf_item_t *conf_items; @@ -133,6 +134,12 @@ conf_get_int (const char *key, int def) { return v ? atoi (v) : def; } +int64_t +conf_get_int64 (const char *key, int64_t def) { + const char *v = conf_get_str (key, NULL); + return v ? atoll (v) : def; +} + DB_conf_item_t * conf_find (const char *group, DB_conf_item_t *prev) { int l = strlen (group); @@ -186,6 +193,13 @@ conf_set_int (const char *key, int val) { } void +conf_set_int64 (const char *key, int64_t val) { + char s[20]; + snprintf (s, sizeof (s), PRId64, val); + conf_set_str (key, s); +} + +void conf_set_float (const char *key, float val) { char s[10]; snprintf (s, sizeof (s), "%0.7f", val); |