iniGetValues use iniGetValuesEx
parent
c049d85f96
commit
8f5c4fd3f7
3
HISTORY
3
HISTORY
|
|
@ -1,11 +1,12 @@
|
||||||
|
|
||||||
Version 1.21 2015-09-13
|
Version 1.21 2015-09-14
|
||||||
* ini_file_reader support annotation function
|
* ini_file_reader support annotation function
|
||||||
* correct PTHREAD_MUTEX_ERRORCHECK define
|
* correct PTHREAD_MUTEX_ERRORCHECK define
|
||||||
* support 32 bit OS
|
* support 32 bit OS
|
||||||
* allow_ips support CIDR addresses such as 172.16.12.0/22
|
* allow_ips support CIDR addresses such as 172.16.12.0/22
|
||||||
* add function get_first_local_ip
|
* add function get_first_local_ip
|
||||||
* ioevent for BSD ok
|
* ioevent for BSD ok
|
||||||
|
* iniGetValues use iniGetValuesEx
|
||||||
|
|
||||||
Version 1.20 2015-08-06
|
Version 1.20 2015-08-06
|
||||||
* add GEO function get_line_distance_km
|
* add GEO function get_line_distance_km
|
||||||
|
|
|
||||||
|
|
@ -831,55 +831,35 @@ bool iniGetBoolValue(const char *szSectionName, const char *szItemName, \
|
||||||
int iniGetValues(const char *szSectionName, const char *szItemName, \
|
int iniGetValues(const char *szSectionName, const char *szItemName, \
|
||||||
IniContext *pContext, char **szValues, const int max_values)
|
IniContext *pContext, char **szValues, const int max_values)
|
||||||
{
|
{
|
||||||
IniItem targetItem;
|
|
||||||
IniSection *pSection;
|
|
||||||
IniItem *pFound;
|
|
||||||
IniItem *pItem;
|
IniItem *pItem;
|
||||||
IniItem *pItemEnd;
|
IniItem *pItemEnd;
|
||||||
char **ppValues;
|
char **ppValues;
|
||||||
|
int count;
|
||||||
|
|
||||||
if (max_values <= 0)
|
if (max_values <= 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INI_FIND_ITEM(szSectionName, szItemName, pContext, pSection, \
|
pItem = iniGetValuesEx(szSectionName, szItemName,
|
||||||
targetItem, pFound, 0)
|
pContext, &count);
|
||||||
if (pFound == NULL)
|
if (count == 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (count > max_values)
|
||||||
|
{
|
||||||
|
count = max_values;
|
||||||
|
}
|
||||||
|
|
||||||
ppValues = szValues;
|
ppValues = szValues;
|
||||||
*ppValues++ = pFound->value;
|
pItemEnd = pItem + count;
|
||||||
for (pItem=pFound-1; pItem>=pSection->items; pItem--)
|
for (; pItem<pItemEnd; pItem++)
|
||||||
{
|
{
|
||||||
if (strcmp(pItem->name, szItemName) != 0)
|
*ppValues++ = pItem->value;
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppValues - szValues < max_values)
|
|
||||||
{
|
|
||||||
*ppValues++ = pItem->value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pItemEnd = pSection->items + pSection->count;
|
return 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IniItem *iniGetValuesEx(const char *szSectionName, const char *szItemName, \
|
IniItem *iniGetValuesEx(const char *szSectionName, const char *szItemName, \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue