iniGetValues use iniGetValuesEx

pull/5/head
yuqing 2015-09-14 18:03:49 +08:00
parent c049d85f96
commit 8f5c4fd3f7
2 changed files with 14 additions and 33 deletions

View File

@ -1,11 +1,12 @@
Version 1.21 2015-09-13
Version 1.21 2015-09-14
* ini_file_reader support annotation function
* correct PTHREAD_MUTEX_ERRORCHECK define
* support 32 bit OS
* allow_ips support CIDR addresses such as 172.16.12.0/22
* add function get_first_local_ip
* ioevent for BSD ok
* iniGetValues use iniGetValuesEx
Version 1.20 2015-08-06
* add GEO function get_line_distance_km

View File

@ -831,55 +831,35 @@ bool iniGetBoolValue(const char *szSectionName, const char *szItemName, \
int iniGetValues(const char *szSectionName, const char *szItemName, \
IniContext *pContext, char **szValues, const int max_values)
{
IniItem targetItem;
IniSection *pSection;
IniItem *pFound;
IniItem *pItem;
IniItem *pItemEnd;
char **ppValues;
int count;
if (max_values <= 0)
{
return 0;
}
INI_FIND_ITEM(szSectionName, szItemName, pContext, pSection, \
targetItem, pFound, 0)
if (pFound == NULL)
pItem = iniGetValuesEx(szSectionName, szItemName,
pContext, &count);
if (count == 0)
{
return 0;
}
if (count > max_values)
{
count = max_values;
}
ppValues = szValues;
*ppValues++ = pFound->value;
for (pItem=pFound-1; pItem>=pSection->items; pItem--)
{
if (strcmp(pItem->name, szItemName) != 0)
{
break;
}
if (ppValues - szValues < max_values)
pItemEnd = pItem + count;
for (; pItem<pItemEnd; pItem++)
{
*ppValues++ = pItem->value;
}
}
pItemEnd = pSection->items + pSection->count;
for (pItem=pFound+1; pItem<pItemEnd; pItem++)
{
if (strcmp(pItem->name, szItemName) != 0)
{
break;
}
if (ppValues - szValues < max_values)
{
*ppValues++ = pItem->value;
}
}
return ppValues - szValues;
return count;
}
IniItem *iniGetValuesEx(const char *szSectionName, const char *szItemName, \