INI_FIND_ITEM just break instead of return

storage_pool
YuQing 2020-12-29 16:21:00 +08:00
parent 89c68e11db
commit 7d5a540a2f
2 changed files with 14 additions and 11 deletions

View File

@ -1,6 +1,7 @@
Version 1.46 2020-12-28
Version 1.46 2020-12-29
* add function get_time_item_from_conf_ex
* INI_FIND_ITEM just break instead of return
Version 1.45 2020-12-24
* add function uniq_skiplist_find_node_ex

View File

@ -2781,8 +2781,8 @@ void iniFreeContext(IniContext *pContext)
iniFreeDynamicContent(pContext);
}
#define INI_FIND_ITEM(szSectionName, szItemName, pContext, pSection, \
targetItem, pItem, return_val) \
#define INI_FIND_ITEM(szSectionName, szItemName, \
pContext, pSection, targetItem, pItem) \
do { \
if (szSectionName == NULL || *szSectionName == '\0') \
{ \
@ -2794,13 +2794,15 @@ do { \
szSectionName, strlen(szSectionName)); \
if (pSection == NULL) \
{ \
return return_val; \
pItem = NULL; \
break; \
} \
} \
\
if (pSection->count <= 0) \
{ \
return return_val; \
pItem = NULL; \
break; \
} \
\
snprintf(targetItem.name, sizeof(targetItem.name), "%s", szItemName); \
@ -2818,15 +2820,15 @@ char *iniGetStrValueEx(const char *szSectionName, const char *szItemName,
IniItem *pItem;
IniItem *pItemEnd;
INI_FIND_ITEM(szSectionName, szItemName, pContext, pSection,
targetItem, pFound, NULL);
INI_FIND_ITEM(szSectionName, szItemName, pContext,
pSection, targetItem, pFound);
if (pFound == NULL)
{
if (RETRY_FETCH_GLOBAL(szSectionName, bRetryGlobal))
{
szSectionName = NULL;
INI_FIND_ITEM(szSectionName, szItemName, pContext,
pSection, targetItem, pFound, NULL);
pSection, targetItem, pFound);
if (pFound == NULL)
{
return NULL;
@ -3060,7 +3062,7 @@ int iniGetValues(const char *szSectionName, const char *szItemName, \
return count;
}
IniItem *iniGetValuesEx(const char *szSectionName, const char *szItemName, \
IniItem *iniGetValuesEx(const char *szSectionName, const char *szItemName,
IniContext *pContext, int *nTargetCount)
{
IniItem targetItem;
@ -3071,8 +3073,8 @@ IniItem *iniGetValuesEx(const char *szSectionName, const char *szItemName, \
IniItem *pItemStart;
*nTargetCount = 0;
INI_FIND_ITEM(szSectionName, szItemName, pContext, pSection, \
targetItem, pFound, NULL);
INI_FIND_ITEM(szSectionName, szItemName, pContext,
pSection, targetItem, pFound);
if (pFound == NULL)
{
return NULL;