aboutsummaryrefslogtreecommitdiffstats
path: root/gb_ini.h
diff options
context:
space:
mode:
authorGravatar Bach Le 2015-11-21 23:31:38 +0800
committerGravatar Bach Le 2015-11-21 23:31:38 +0800
commitddf7c37ec779e9237f92bff53f19284e309dd120 (patch)
tree0b7f10d81fbb74a2ac7e9b6092c8325f447f1112 /gb_ini.h
parentHash_Table Bug Fixes (diff)
Fix error handling in gb_ini
- Report GB_INI_ERROR_FILE_ERROR when file cannot be read - Report error from handler
Diffstat (limited to '')
-rw-r--r--gb_ini.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gb_ini.h b/gb_ini.h
index 413298f..e6e7f9d 100644
--- a/gb_ini.h
+++ b/gb_ini.h
@@ -357,7 +357,7 @@ gb__string_copy(char* dst, const char* src, size_t size)
struct gb_Ini_Error
gb_ini_parse(const char* filename, gb_Ini_Handler* handler_func, void* data)
{
- struct gb_Ini_Error err = {GB_INI_ERROR_NONE, 0};
+ struct gb_Ini_Error err = {GB_INI_ERROR_FILE_ERROR, 0};
FILE* file = fopen(filename, "r");
if (!file)
@@ -436,7 +436,7 @@ gb_ini_parse_file(FILE* file, gb_Ini_Handler* handler_func, void* data)
gb__right_whitespace_strip(value);
gb__string_copy(prev_name, name, sizeof(prev_name));
- if (!handler_func(data, section, name, value) && err.type)
+ if (!handler_func(data, section, name, value) && !err.type)
{
err.type = GB_INI_ERROR_HANDLER_ERROR;
err.line_num = line_num;