From cb3dc49e2ab960412d21b232a418efc274ea8b8a Mon Sep 17 00:00:00 2001 From: yuqing Date: Fri, 11 Nov 2016 18:20:41 +0800 Subject: [PATCH] add macro function INI_STRING_IS_TRUE --- src/ini_file_reader.c | 5 +---- src/ini_file_reader.h | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ini_file_reader.c b/src/ini_file_reader.c index 616cbde..68d336c 100644 --- a/src/ini_file_reader.c +++ b/src/ini_file_reader.c @@ -1605,10 +1605,7 @@ bool iniGetBoolValue(const char *szSectionName, const char *szItemName, \ } else { - return strcasecmp(pValue, "true") == 0 || - strcasecmp(pValue, "yes") == 0 || - strcasecmp(pValue, "on") == 0 || - strcmp(pValue, "1") == 0; + return INI_STRING_IS_TRUE(pValue); } } diff --git a/src/ini_file_reader.h b/src/ini_file_reader.h index 2a586ee..412e7ac 100644 --- a/src/ini_file_reader.h +++ b/src/ini_file_reader.h @@ -58,6 +58,12 @@ typedef struct extern "C" { #endif +#define INI_STRING_IS_TRUE(pValue) \ + (strcasecmp(pValue, "true") == 0 || \ + strcasecmp(pValue, "yes") == 0 || \ + strcasecmp(pValue, "on") == 0 || \ + strcmp(pValue, "1") == 0) + int iniSetAnnotationCallBack(AnnotationMap *map, int count); void iniDestroyAnnotationCallBack();