mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-04-21 23:08:32 +00:00
lpconfig: add lp_config_dump
This commit is contained in:
parent
2d3d975425
commit
1537a5228a
2 changed files with 43 additions and 7 deletions
|
|
@ -946,3 +946,30 @@ char* lp_config_dump_as_xml(const LpConfig *lpconfig) {
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct _entry_data {
|
||||||
|
const LpConfig *conf;
|
||||||
|
const char *section;
|
||||||
|
char** buffer;
|
||||||
|
};
|
||||||
|
|
||||||
|
static void dump_entry(const char *entry, void *data) {
|
||||||
|
struct _entry_data *d = (struct _entry_data *) data;
|
||||||
|
const char *value = lp_config_get_string(d->conf, d->section, entry, "");
|
||||||
|
*d->buffer = ms_strcat_printf(*d->buffer, "\t%s=%s\n", entry, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dump_section(const char *section, void *data) {
|
||||||
|
struct _entry_data *d = (struct _entry_data *) data;
|
||||||
|
d->section = section;
|
||||||
|
*d->buffer = ms_strcat_printf(*d->buffer, "[%s]\n", section);
|
||||||
|
lp_config_for_each_entry(d->conf, section, dump_entry, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
char* lp_config_dump(const LpConfig *lpconfig) {
|
||||||
|
char* buffer = NULL;
|
||||||
|
struct _entry_data d = { lpconfig, NULL, &buffer };
|
||||||
|
lp_config_for_each_section(lpconfig, dump_section, &d);
|
||||||
|
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -311,6 +311,15 @@ LINPHONE_PUBLIC bool_t lp_config_relative_file_exists(const LpConfig *lpconfig,
|
||||||
**/
|
**/
|
||||||
LINPHONE_PUBLIC char* lp_config_dump_as_xml(const LpConfig *lpconfig);
|
LINPHONE_PUBLIC char* lp_config_dump_as_xml(const LpConfig *lpconfig);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dumps the LpConfig as INI into a buffer
|
||||||
|
* @param[in] lpconfig The LpConfig object
|
||||||
|
* @return The buffer that contains the config dump
|
||||||
|
*
|
||||||
|
* @ingroup misc
|
||||||
|
**/
|
||||||
|
LINPHONE_PUBLIC char* lp_config_dump(const LpConfig *lpconfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the overwrite flag for a config item
|
* Retrieves the overwrite flag for a config item
|
||||||
*
|
*
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue