Skip to content
Snippets Groups Projects
Commit a905d802 authored by deuce's avatar deuce
Browse files

Add iniGetSection() function which returns only the specified section

as a string list.  This allows for massive speed improvements when reading
an entire of values small section from a large list.

(ie: Reading the generated bbslist in SyncTERM one BBS at a time)
parent b43ade84
No related branches found
No related tags found
No related merge requests found
......@@ -293,6 +293,29 @@ BOOL iniSectionExists(str_list_t list, const char* section)
return(list[i]!=NULL);
}
str_list_t iniGetSection(str_list_t list, const char *section)
{
size_t i;
str_list_t retval=strListInit();
char *p;
if(section==ROOT_SECTION)
i=0;
else
i=find_section_index(list,section);
if(list[i]!=NULL) {
strListPush(&retval, list[i]);
for(i++;list[i]!=NULL;i++) {
p=list[i];
SKIP_WHITESPACE(p);
if(*p=='[')
break;
strListPush(&retval, list[i]);
}
}
return(retval);
}
BOOL iniKeyExists(str_list_t list, const char* section, const char* key)
{
char val[INI_MAX_VALUE_LEN];
......
......@@ -158,6 +158,7 @@ double iniGetNamedFloat(str_list_t, const char* section, const char* key
,named_double_t*, double deflt);
ulong iniGetBitField(str_list_t, const char* section, const char* key
,ini_bitdesc_t* bitdesc, ulong deflt);
str_list_t iniGetSection(str_list_t, const char *section);
#define iniGetLogLevel(l,s,k,d) iniGetEnum(l,s,k,iniLogLevelStringList(),d)
#if !defined(NO_SOCKET_SUPPORT)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment