Mercurial > code
changeset 100:85ddc81848bd
Add a little helper in ini.c to find an option
author | David Demelier <markand@malikania.fr> |
---|---|
date | Sat, 14 Jan 2012 16:47:51 +0100 |
parents | d534fdcbb319 |
children | 37eef6776cc6 |
files | ini.c ini.h |
diffstat | 2 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ini.c Fri Jan 13 22:48:08 2012 +0100 +++ b/ini.c Sat Jan 14 16:47:51 2012 +0100 @@ -113,6 +113,22 @@ } /* + * Find an option from the config, by section name and option name. + * Returns the option or NULL if not found. + */ + +INI_Option * +ini_find(const INI_Config *config, const char *sname, const char *oname) +{ + INI_Section *sc; + + if ((sc = ini_select_section(config, sname))) + return ini_select_option(sc, oname); + + return NULL; +} + +/* * Return the last error or "No error" if there is not error at all. */