optimizing

dev
liuwei 2015-08-18 16:43:42 +08:00
parent 9208cfde96
commit ecfafbcf38
1 changed files with 6 additions and 8 deletions

View File

@ -280,12 +280,11 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
char *pLine; char *pLine;
char *pLastEnd; char *pLastEnd;
char *pEqualChar; char *pEqualChar;
char *pFunc_name;
char *pItemName; char *pItemName;
char *pAnnoItemLine; char *pAnnoItemLine;
char *pIncludeFilename; char *pIncludeFilename;
char *pItemValue[100]; char *pItemValue[100];
char full_funcName[FAST_INI_ITEM_VALUE_LEN]; char pFunc_name[FAST_INI_ITEM_NAME_LEN + 1];
char full_filename[MAX_PATH_SIZE]; char full_filename[MAX_PATH_SIZE];
int i; int i;
int nLineLen; int nLineLen;
@ -301,7 +300,6 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
pLastEnd = content - 1; pLastEnd = content - 1;
pSection = pContext->current_section; pSection = pContext->current_section;
pItem = pSection->items + pSection->count; pItem = pSection->items + pSection->count;
pFunc_name = full_funcName;
while (pLastEnd != NULL) while (pLastEnd != NULL)
{ {
@ -377,10 +375,10 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext)
strncasecmp(pLine+1, "@function", 9) == 0 && \ strncasecmp(pLine+1, "@function", 9) == 0 && \
(*(pLine+10) == ' ' || *(pLine+10) == '\t'))) (*(pLine+10) == ' ' || *(pLine+10) == '\t')))
{ {
nNameLen = strlen(pLine + 11) + 1; nNameLen = strlen(pLine + 11);
nNameLen = nNameLen > FAST_INI_ITEM_VALUE_LEN ? nNameLen = nNameLen > FAST_INI_ITEM_NAME_LEN ?
FAST_INI_ITEM_VALUE_LEN : nNameLen; FAST_INI_ITEM_NAME_LEN : nNameLen;
memcpy(pFunc_name, pLine + 11, nNameLen); memcpy(pFunc_name, pLine + 11, nNameLen + 1);
trim(pFunc_name); trim(pFunc_name);
isAnnotation = 1; isAnnotation = 1;
pAnnoItemLine = pLastEnd + 1; pAnnoItemLine = pLastEnd + 1;