rename trim to fc_trim

posix_api
YuQing 2022-02-25 09:43:56 +08:00
parent 9f1d1b6d48
commit 7b9c257652
8 changed files with 12 additions and 34 deletions

View File

@ -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

View File

@ -26,7 +26,6 @@
#include <stdlib.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <inttypes.h>
#include <fcntl.h>
#include "common_define.h"

View File

@ -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)
{

View File

@ -21,7 +21,6 @@
#include <net/if.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include "common_define.h"
#include "connection_pool.h"

View File

@ -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;

View File

@ -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

View File

@ -22,7 +22,6 @@
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

View File

@ -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;