diff --git a/HISTORY b/HISTORY index 9c4ea47..2bbe274 100644 --- a/HISTORY +++ b/HISTORY @@ -1,9 +1,10 @@ -Version 1.35 2017-02-20 +Version 1.35 2017-02-27 * logger judge log_level in function log_it_ex and log_it_ex1 * add php extension function: fastcommon_file_put_contents * add function fc_safe_read and fc_safe_write * add function fc_ftok + * add function fc_trim to avoid conflict with trim Version 1.34 2017-02-06 * ini_file_reader: LOCAL_IP support CIDR addresses diff --git a/src/ini_file_reader.c b/src/ini_file_reader.c index 41c953a..481ac06 100644 --- a/src/ini_file_reader.c +++ b/src/ini_file_reader.c @@ -86,6 +86,12 @@ static int iniDoLoadFromFile(const char *szFilename, \ static int iniLoadItemsFromBuffer(char *content, \ IniContext *pContext); +#define STR_TRIM(pStr) \ + do { \ + trim_right(pStr); \ + trim_left(pStr); \ + } while (0) + int iniSetAnnotationCallBack(AnnotationMap *map, int count) { int bytes; @@ -423,7 +429,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) break; } - trim(pIncludeFilename); + STR_TRIM(pIncludeFilename); if (strncasecmp(pIncludeFilename, "http://", 7) == 0) { snprintf(full_filename, sizeof(full_filename),\ @@ -482,7 +488,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) } memcpy(pFuncName, pLine + 11, nNameLen); pFuncName[nNameLen] = '\0'; - trim(pFuncName); + STR_TRIM(pFuncName); if ((int)strlen(pFuncName) > 0) { isAnnotation = 1; @@ -498,7 +504,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) continue; } - trim(pLine); + STR_TRIM(pLine); if (*pLine == '#' || *pLine == '\0') { continue; @@ -513,7 +519,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) *(pLine + (nLineLen - 1)) = '\0'; section_name = pLine + 1; //skip [ - trim(section_name); + STR_TRIM(section_name); if (*section_name == '\0') //global section { pContext->current_section = &pContext->global; @@ -595,8 +601,8 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) memcpy(pItem->name, pLine, nNameLen); memcpy(pItem->value, pEqualChar + 1, nValueLen); - trim(pItem->name); - trim(pItem->value); + STR_TRIM(pItem->name); + STR_TRIM(pItem->value); if (isAnnotation) { @@ -1143,7 +1149,7 @@ static bool iniCalcCondition(char *condition, const int condition_len, _PREPROCESS_MAX_LIST_VALUE_COUNT); for (i=0; i 3 && (*value == '$' && *(value + 1) == '(') && *(value + value_len - 1) == ')') @@ -1303,7 +1309,7 @@ static int iniDoProccessSet(char *pSet, char **ppSetEnd, logWarning("file: "__FILE__", line: %d, " "empty reply when exec: %s", __LINE__, cmd); } - value = trim(output); + value = fc_trim(output); value_len = strlen(value); } diff --git a/src/local_ip_func.c b/src/local_ip_func.c index 4817fa0..7acf8fb 100644 --- a/src/local_ip_func.c +++ b/src/local_ip_func.c @@ -96,7 +96,7 @@ void load_local_host_ip_addrs() if_alias_prefixes, STORAGE_MAX_ALIAS_PREFIX_COUNT); for (k=0; k