From 7b9c2576525fd7ec66e49bb14b7d06c215720fb3 Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Fri, 25 Feb 2022 09:43:56 +0800 Subject: [PATCH] rename trim to fc_trim --- HISTORY | 4 +++- src/id_generator.h | 1 - src/ini_file_reader.c | 23 ++++++++--------------- src/multi_socket_client.h | 1 - src/shared_func.c | 7 ------- src/shared_func.h | 7 ------- src/sockopt.h | 1 - src/tests/test_queue_perf.c | 2 +- 8 files changed, 12 insertions(+), 34 deletions(-) diff --git a/HISTORY b/HISTORY index ca33d54..e04aff4 100644 --- a/HISTORY +++ b/HISTORY @@ -1,9 +1,11 @@ -Version 1.56 2022-02-02 +Version 1.56 2022-02-25 * add function fc_gettid * function normalize_path: NULL from parameter for getcwd * sockopt.[hc] support tcpwritev and tcpreadv * add function fc_iov_get_bytes + * rename hash_xxx to fc_hash_xxx + * rename trim to fc_trim Version 1.55 2022-01-12 * fastcommon php extension adapt to php 8 diff --git a/src/id_generator.h b/src/id_generator.h index 0533eb4..4387ea9 100644 --- a/src/id_generator.h +++ b/src/id_generator.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include "common_define.h" diff --git a/src/ini_file_reader.c b/src/ini_file_reader.c index 8166bd1..8e5f0dd 100644 --- a/src/ini_file_reader.c +++ b/src/ini_file_reader.c @@ -115,13 +115,6 @@ static DynamicAnnotations *iniAllocAnnotations(IniContext *pContext, static AnnotationEntry *iniGetAnnotations(IniContext *pContext); static SetDirectiveVars *iniGetVars(IniContext *pContext); -#define STR_TRIM(pStr) \ - do { \ - trim_right(pStr); \ - trim_left(pStr); \ - } while (0) - - #define RETRY_FETCH_GLOBAL(szSectionName, bRetryGlobal) \ ((szSectionName != NULL && *szSectionName != '\0') && bRetryGlobal) @@ -359,7 +352,7 @@ static char *doReplaceVars(IniContext *pContext, const char *param, memcpy(name, start, name_len); } *(name + name_len) = '\0'; - trim(name); + fc_trim(name); name_len = strlen(name); if (name_len > 0) { value = (char *)fc_hash_find(set->vars, name, name_len); @@ -866,7 +859,7 @@ static int iniAddAnnotation(char *params) int count; int result; - trim(params); + fc_trim(params); count = fc_split_string(params, " \t", cols, MAX_PARAMS); if (count < 2) { @@ -1015,14 +1008,14 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) isAnnotation = 0; } - STR_TRIM(pLine); + fc_trim(pLine); if (*pLine == '#' && \ strncasecmp(pLine+1, "include", 7) == 0 && \ (*(pLine+8) == ' ' || *(pLine+8) == '\t')) { snprintf(pIncludeFilename, sizeof(pIncludeFilename), "%s", pLine + 9); - STR_TRIM(pIncludeFilename); + fc_trim(pIncludeFilename); if (IS_URL_RESOURCE(pIncludeFilename)) { snprintf(full_filename, sizeof(full_filename), @@ -1092,7 +1085,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) } memcpy(pFuncName, pLine + 11, nNameLen); pFuncName[nNameLen] = '\0'; - STR_TRIM(pFuncName); + fc_trim(pFuncName); if ((int)strlen(pFuncName) > 0) { isAnnotation = 1; @@ -1132,7 +1125,7 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) *(pLine + (nLineLen - 1)) = '\0'; section_name = pLine + 1; //skip [ - STR_TRIM(section_name); + fc_trim(section_name); if (*section_name == '\0') //global section { pContext->current_section = &pContext->global; @@ -1225,8 +1218,8 @@ static int iniDoLoadItemsFromBuffer(char *content, IniContext *pContext) memcpy(pItem->name, pLine, nNameLen); memcpy(pItem->value, pEqualChar + 1, nValueLen); - STR_TRIM(pItem->name); - STR_TRIM(pItem->value); + fc_trim(pItem->name); + fc_trim(pItem->value); if (isAnnotation) { diff --git a/src/multi_socket_client.h b/src/multi_socket_client.h index 9ae34bb..b079c31 100644 --- a/src/multi_socket_client.h +++ b/src/multi_socket_client.h @@ -21,7 +21,6 @@ #include #include #include -#include #include #include "common_define.h" #include "connection_pool.h" diff --git a/src/shared_func.c b/src/shared_func.c index 4847727..61bd9ed 100644 --- a/src/shared_func.c +++ b/src/shared_func.c @@ -614,13 +614,6 @@ char *trim_right(char *pStr) return pStr; } -char *trim(char *pStr) -{ - trim_right(pStr); - trim_left(pStr); - return pStr; -} - void string_ltrim(string_t *s) { char *p; diff --git a/src/shared_func.h b/src/shared_func.h index 66f6ead..a920042 100644 --- a/src/shared_func.h +++ b/src/shared_func.h @@ -299,13 +299,6 @@ char *trim_left(char *pStr); */ char *trim_right(char *pStr); -/** trim leading and tail spaces ( \t\r\n) - * parameters: - * pStr: the string to trim - * return: trimed string porinter as pStr -*/ -char *trim(char *pStr); - /** trim leading and tail spaces ( \t\r\n) * parameters: * pStr: the string to trim diff --git a/src/sockopt.h b/src/sockopt.h index 9009184..6418e47 100644 --- a/src/sockopt.h +++ b/src/sockopt.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/src/tests/test_queue_perf.c b/src/tests/test_queue_perf.c index b26c2bf..61a697d 100644 --- a/src/tests/test_queue_perf.c +++ b/src/tests/test_queue_perf.c @@ -47,7 +47,7 @@ void *producer_thread(void *arg) while (g_continue_flag && count < LOOP_COUNT) { qinfo.head = qinfo.tail = NULL; - node = fast_mblock_batch_alloc( + node = fast_mblock_batch_alloc1( &record_allocator, BATCH_SIZE); if (node == NULL) { g_continue_flag = false;