Skip to content
Snippets Groups Projects
Commit 5020716c authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Add iniAppendSectionWithNamedStrings()

If you have list of named strings (named_string_t) and want to add them as
a section of key/value pairs to a [section] in .ini formatted string list, this
is the function you want to use. I'm not sure if this is exactly what Deuce had
in mind (for use in SyncTERM), but it wasn't a lot of code to write and might
be useful to someone someday.
parent b083b5fb
No related branches found
No related tags found
No related merge requests found
Pipeline #8034 failed
......@@ -655,6 +655,24 @@ static char* ini_set_string(str_list_t* list, const char* section, const char* k
return strListReplace(*list, i, str);
}
size_t iniAppendSectionWithNamedStrings(str_list_t* list, const char* section, const named_string_t** key
, ini_style_t* style)
{
size_t i;
if (section == ROOT_SECTION)
return 0;
ini_add_section(list, section, style, strListCount(*list));
for (i = 0; key[i] != NULL; ++i)
if (ini_set_string(list, section, key[i]->name, key[i]->value, /* literal */false, style) == NULL)
break;
return i;
}
char* iniSetString(str_list_t* list, const char* section, const char* key, const char* value
, ini_style_t* style)
{
......
......@@ -292,6 +292,8 @@ DLLEXPORT size_t iniAppendSection(str_list_t*, const char* section
DLLEXPORT size_t iniAppendSectionWithKeys(str_list_t*, const char* section, const str_list_t keys
,ini_style_t*);
DLLEXPORT size_t iniAppendSectionWithNamedStrings(str_list_t*, const char* section, const named_string_t** keys
,ini_style_t*);
DLLEXPORT bool iniSectionExists(str_list_t, const char* section);
DLLEXPORT bool iniKeyExists(str_list_t, const char* section, const char* key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment