From: Art Cancro Date: Tue, 5 May 2015 17:34:00 +0000 (-0400) Subject: CtdlGetConfigInt() and CtdlGetConfigLong() converted from macros to functions because... X-Git-Tag: Release_902~167^2 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=108088188d48751784f9142d51b50e91d8badeb6 CtdlGetConfigInt() and CtdlGetConfigLong() converted from macros to functions because they need to be able to handle NULL return from CtdlGetConfigStr() --- 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);