diff --git a/HISTORY b/HISTORY index 656237c..5f3fd8d 100644 --- a/HISTORY +++ b/HISTORY @@ -1,8 +1,9 @@ -Version 1.15 2015-06-15 +Version 1.15 2015-06-16 * fast_mblock.c support none lock * ioevent support set timeout - * fast_mblock suport alloc and free object + * fast_mblock support alloc and free object + * ini_file_reader set global section before and after directive #include Version 1.14 2015-06-12 * fast_task_info support set_buffer_size and realloc_buffer diff --git a/src/ini_file_reader.c b/src/ini_file_reader.c index 09f3d7a..33459bf 100644 --- a/src/ini_file_reader.c +++ b/src/ini_file_reader.c @@ -256,14 +256,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) result = 0; pLastEnd = content - 1; pSection = pContext->current_section; - if (pSection->count > 0) - { - pItem = pSection->items + pSection->count; - } - else - { - pItem = pSection->items; - } + pItem = pSection->items + pSection->count; while (pLastEnd != NULL) { @@ -320,6 +313,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) } } + pContext->current_section = &pContext->global; result = iniDoLoadFromFile(full_filename, pContext); if (result != 0) { @@ -327,15 +321,9 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) break; } + pContext->current_section = &pContext->global; pSection = pContext->current_section; - if (pSection->count > 0) - { - pItem = pSection->items + pSection->count; //must re-asign - } - else - { - pItem = pSection->items; - } + pItem = pSection->items + pSection->count; //must re-asign free(pIncludeFilename); continue; @@ -361,14 +349,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) { pContext->current_section = &pContext->global; pSection = pContext->current_section; - if (pSection->count > 0) - { - pItem = pSection->items + pSection->count; - } - else - { - pItem = pSection->items; - } + pItem = pSection->items + pSection->count; continue; } @@ -411,14 +392,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) } pContext->current_section = pSection; - if (pSection->count > 0) - { - pItem = pSection->items + pSection->count; - } - else - { - pItem = pSection->items; - } + pItem = pSection->items + pSection->count; continue; }