ini_file_reader set global section before and after directive #include

pull/4/head
yuqing 2015-06-16 10:34:35 +08:00
parent bcd00f4079
commit 7a2c942863
2 changed files with 9 additions and 34 deletions

View File

@ -1,8 +1,9 @@
Version 1.15 2015-06-15 Version 1.15 2015-06-16
* fast_mblock.c support none lock * fast_mblock.c support none lock
* ioevent support set timeout * 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 Version 1.14 2015-06-12
* fast_task_info support set_buffer_size and realloc_buffer * fast_task_info support set_buffer_size and realloc_buffer

View File

@ -256,14 +256,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
result = 0; result = 0;
pLastEnd = content - 1; pLastEnd = content - 1;
pSection = pContext->current_section; pSection = pContext->current_section;
if (pSection->count > 0) pItem = pSection->items + pSection->count;
{
pItem = pSection->items + pSection->count;
}
else
{
pItem = pSection->items;
}
while (pLastEnd != NULL) while (pLastEnd != NULL)
{ {
@ -320,6 +313,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
} }
} }
pContext->current_section = &pContext->global;
result = iniDoLoadFromFile(full_filename, pContext); result = iniDoLoadFromFile(full_filename, pContext);
if (result != 0) if (result != 0)
{ {
@ -327,15 +321,9 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
break; break;
} }
pContext->current_section = &pContext->global;
pSection = pContext->current_section; pSection = pContext->current_section;
if (pSection->count > 0) pItem = pSection->items + pSection->count; //must re-asign
{
pItem = pSection->items + pSection->count; //must re-asign
}
else
{
pItem = pSection->items;
}
free(pIncludeFilename); free(pIncludeFilename);
continue; continue;
@ -361,14 +349,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
{ {
pContext->current_section = &pContext->global; pContext->current_section = &pContext->global;
pSection = pContext->current_section; pSection = pContext->current_section;
if (pSection->count > 0) pItem = pSection->items + pSection->count;
{
pItem = pSection->items + pSection->count;
}
else
{
pItem = pSection->items;
}
continue; continue;
} }
@ -411,14 +392,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
} }
pContext->current_section = pSection; pContext->current_section = pSection;
if (pSection->count > 0) pItem = pSection->items + pSection->count;
{
pItem = pSection->items + pSection->count;
}
else
{
pItem = pSection->items;
}
continue; continue;
} }