Skip to content
Snippets Groups Projects
Commit d4e5af06 authored by Dmitriy Gerasimov's avatar Dmitriy Gerasimov
Browse files

[+] default value for string fetch function

parent 4c4c0039
No related branches found
No related tags found
1 merge request!24Support 3689
...@@ -252,6 +252,7 @@ int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_sectio ...@@ -252,6 +252,7 @@ int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_sectio
return 0; return 0;
} }
/** /**
* @brief dap_config_get_item_str * @brief dap_config_get_item_str
* @param a_config * @param a_config
...@@ -260,6 +261,19 @@ int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_sectio ...@@ -260,6 +261,19 @@ int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_sectio
* @return * @return
*/ */
const char * dap_config_get_item_str(dap_config_t * a_config, const char * a_section_path, const char * a_item_name) const char * dap_config_get_item_str(dap_config_t * a_config, const char * a_section_path, const char * a_item_name)
{
return dap_config_get_item_str_default(a_config,a_section_path,a_item_name, NULL);
}
/**
* @brief dap_config_get_item_str_default
* @param a_config
* @param a_section_path
* @param a_item_name
* @param a_value_default
* @return
*/
const char * dap_config_get_item_str_default(dap_config_t * a_config, const char * a_section_path, const char * a_item_name, const char * a_value_default)
{ {
dap_config_item_t * l_item_section = DAP_CONFIG_INTERNAL(a_config)->item_root ; dap_config_item_t * l_item_section = DAP_CONFIG_INTERNAL(a_config)->item_root ;
while(l_item_section){ while(l_item_section){
...@@ -274,7 +288,7 @@ const char * dap_config_get_item_str(dap_config_t * a_config, const char * a_sec ...@@ -274,7 +288,7 @@ const char * dap_config_get_item_str(dap_config_t * a_config, const char * a_sec
} }
l_item_section = l_item_section->item_next; l_item_section = l_item_section->item_next;
} }
return NULL; return a_value_default;
} }
/** /**
......
...@@ -15,6 +15,8 @@ void dap_config_close(dap_config_t * a_config); ...@@ -15,6 +15,8 @@ void dap_config_close(dap_config_t * a_config);
int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_section_path, const char * a_item_name); int32_t dap_config_get_item_int32(dap_config_t * a_config, const char * a_section_path, const char * a_item_name);
const char * dap_config_get_item_str(dap_config_t * a_config, const char * a_section_path, const char * a_item_name); const char * dap_config_get_item_str(dap_config_t * a_config, const char * a_section_path, const char * a_item_name);
const char * dap_config_get_item_str_default(dap_config_t * a_config, const char * a_section_path, const char * a_item_name, const char * a_value_default);
bool dap_config_get_item_bool(dap_config_t * a_config, const char * a_section_path, const char * a_item_name); bool dap_config_get_item_bool(dap_config_t * a_config, const char * a_section_path, const char * a_item_name);
double dap_config_get_item_double(dap_config_t * a_config, const char * a_section_path, const char * a_item_name); double dap_config_get_item_double(dap_config_t * a_config, const char * a_section_path, const char * a_item_name);
......
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