From 108088188d48751784f9142d51b50e91d8badeb6 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 5 May 2015 13:34:00 -0400 Subject: [PATCH] CtdlGetConfigInt() and CtdlGetConfigLong() converted from macros to functions because they need to be able to handle NULL return from CtdlGetConfigStr() --- citadel/config.c | 20 ++++++++++++++++++++ citadel/config.h | 6 ++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/citadel/config.c b/citadel/config.c index ed7a06914..f41533c5b 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -437,6 +437,26 @@ char *CtdlGetConfigStr(char *key) } +/* + * Fetch a system config value - integer + */ +int CtdlGetConfigInt(char *key) +{ + char *s = CtdlGetConfigStr(key); + if (s) return atoi(s); + return 0; +} + + +/* + * Fetch a system config value - long integer + */ +long CtdlGetConfigLong(char *key) +{ + char *s = CtdlGetConfigStr(key); + if (s) return atol(s); + return 0; +} diff --git a/citadel/config.h b/citadel/config.h index 79f244274..293593b81 100644 --- a/citadel/config.h +++ b/citadel/config.h @@ -13,10 +13,6 @@ #include "serv_extensions.h" #include "citadel_dirs.h" -#define CtdlGetConfigInt(x) atoi(CtdlGetConfigStr(x)) -#define CtdlGetConfigLong(x) atol(CtdlGetConfigStr(x)) - - /* @@ -112,6 +108,8 @@ void shutdown_config_system(void); void put_config(void); void CtdlSetConfigStr(char *, char *); char *CtdlGetConfigStr(char *); +int CtdlGetConfigInt(char *); +long CtdlGetConfigLong(char *); void CtdlSetConfigInt(char *key, int value); void CtdlSetConfigLong(char *key, long value); -- 2.30.2