From d1026167d4c9f1de9456ebbd6fb350774cca6ca2 Mon Sep 17 00:00:00 2001 From: liuwei Date: Thu, 20 Aug 2015 15:46:59 +0800 Subject: [PATCH] eliminate potential trouble --- src/ini_file_reader.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/ini_file_reader.c b/src/ini_file_reader.c index f363d1d..9eaeeea 100644 --- a/src/ini_file_reader.c +++ b/src/ini_file_reader.c @@ -336,6 +336,14 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) *pLastEnd = '\0'; } + if (isAnnotation && pLine != pAnnoItemLine) + { + logWarning("file: "__FILE__", line: %d, " \ + "the @function and annotation item " \ + "must be next to each other", __LINE__); + isAnnotation = 0; + } + if (*pLine == '#' && \ strncasecmp(pLine+1, "include", 7) == 0 && \ (*(pLine+8) == ' ' || *(pLine+8) == '\t')) @@ -414,14 +422,6 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) continue; } - if (isAnnotation && pLine != pAnnoItemLine) - { - logWarning("file: "__FILE__", line: %d, " \ - "the @function and annotation item " \ - "must be next to each other", __LINE__); - isAnnotation = 0; - } - trim(pLine); if (*pLine == '#' || *pLine == '\0') { @@ -607,6 +607,13 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) pItem++; } + if (!result && isAnnotation) + { + logWarning("file: "__FILE__", line: %d, " \ + "the @function and annotation item " \ + "must be next to each other", __LINE__); + } + return result; }