rename fc_combine_two_string to fc_combine_two_strings

use_iouring
YuQing 2025-08-09 15:21:08 +08:00
parent b1f3c7894e
commit 6f4b3b7cd8
6 changed files with 40 additions and 16 deletions

View File

@ -47,7 +47,7 @@ int array_allocator_init_ex(ArrayAllocatorContext *ctx,
start = end; start = end;
} }
fc_combine_two_string(name_prefix, "array", '-', name); fc_combine_two_strings(name_prefix, "array", '-', name);
return fast_allocator_init_ex(&ctx->allocator, name, return fast_allocator_init_ex(&ctx->allocator, name,
obj_size, NULL, regions, region - regions, 0, obj_size, NULL, regions, region - regions, 0,
0.9999, reclaim_interval, need_lock); 0.9999, reclaim_interval, need_lock);

View File

@ -142,7 +142,7 @@ int free_queue_init_ex2(struct fast_task_queue *queue, const char *name,
(int64_t)max_data_size); (int64_t)max_data_size);
*/ */
fc_combine_two_string(name, "task", '-', aname); fc_combine_two_strings(name, "task", '-', aname);
return fast_mblock_init_ex1(&queue->allocator, aname, return fast_mblock_init_ex1(&queue->allocator, aname,
queue->block_size, alloc_once, max_connections, queue->block_size, alloc_once, max_connections,
(fast_mblock_object_init_func)task_alloc_init, (fast_mblock_object_init_func)task_alloc_init,

View File

@ -912,7 +912,7 @@ static int iniAddAnnotation(char *params)
return EFAULT; return EFAULT;
} }
fc_combine_two_string(func_name, "init_annotation", '_', symbol); fc_combine_two_strings(func_name, "init_annotation", '_', symbol);
init_func = dlsym(dlhandle, symbol); init_func = dlsym(dlhandle, symbol);
if (init_func == NULL) if (init_func == NULL)
{ {

View File

@ -385,7 +385,7 @@ static int log_delete_old_file(LogContext *pContext,
char full_filename[MAX_PATH_SIZE + 128]; char full_filename[MAX_PATH_SIZE + 128];
if (NEED_COMPRESS_LOG(pContext->compress_log_flags)) if (NEED_COMPRESS_LOG(pContext->compress_log_flags))
{ {
fc_concat_two_string(old_filename, GZIP_EXT_NAME_STR, full_filename); fc_concat_two_strings(old_filename, GZIP_EXT_NAME_STR, full_filename);
} }
else else
{ {
@ -652,7 +652,7 @@ static int log_delete_matched_old_files(LogContext *pContext,
log_get_file_path(pContext, log_filepath); log_get_file_path(pContext, log_filepath);
for (i=0; i<filename_array.count; i++) for (i=0; i<filename_array.count; i++)
{ {
fc_concat_two_string(log_filepath, filename_array. fc_concat_two_strings(log_filepath, filename_array.
filenames[i], full_filename); filenames[i], full_filename);
if (unlink(full_filename) != 0) if (unlink(full_filename) != 0)
{ {
@ -765,9 +765,9 @@ static void *log_gzip_func(void *args)
} }
gzip_cmd_filename = get_gzip_command_filename(); gzip_cmd_filename = get_gzip_command_filename();
fc_concat_two_string(log_filepath, filename_array. fc_concat_two_strings(log_filepath, filename_array.
filenames[i], full_filename); filenames[i], full_filename);
fc_combine_two_string(gzip_cmd_filename, full_filename, ' ', cmd); fc_combine_two_strings(gzip_cmd_filename, full_filename, ' ', cmd);
result = getExecResult(cmd, output, sizeof(output)); result = getExecResult(cmd, output, sizeof(output));
if (result != 0) if (result != 0)
{ {

View File

@ -1460,7 +1460,7 @@ int safeWriteToFile(const char *filename, const char *buff,
char tmpFilename[PATH_MAX]; char tmpFilename[PATH_MAX];
int result; int result;
fc_combine_two_string(filename, "tmp", '.', tmpFilename); fc_combine_two_strings(filename, "tmp", '.', tmpFilename);
if ((result=writeToFile(tmpFilename, buff, file_size)) != 0) if ((result=writeToFile(tmpFilename, buff, file_size)) != 0)
{ {
return result; return result;

View File

@ -1288,7 +1288,7 @@ static inline int resolve_path(const char *from, const char *filename,
size, NORMALIZE_FLAGS_URL_ENABLED_AND_APPEND_PARAMS); size, NORMALIZE_FLAGS_URL_ENABLED_AND_APPEND_PARAMS);
} }
static inline int fc_combine_two_string_ex( static inline int fc_combine_two_strings_ex(
const char *first_str, const int first_len, const char *first_str, const int first_len,
const char *second_str, const int second_len, const char *second_str, const int second_len,
const char seperator, char *combined_str, const int size) const char seperator, char *combined_str, const int size)
@ -1311,16 +1311,16 @@ static inline int fc_combine_two_string_ex(
return p - combined_str; return p - combined_str;
} }
#define fc_combine_two_string_s(first, second, seperator, combined, size) \ #define fc_combine_two_strings_s(first, second, seperator, combined, size) \
fc_combine_two_string_ex(first, strlen(first), second, strlen(second), \ fc_combine_two_strings_ex(first, strlen(first), second, strlen(second), \
seperator, combined, size) seperator, combined, size)
#define fc_combine_two_string(first, second, seperator, combined) \ #define fc_combine_two_strings(first, second, seperator, combined) \
fc_combine_two_string_s(first, second, seperator, \ fc_combine_two_strings_s(first, second, seperator, \
combined, sizeof(combined)) combined, sizeof(combined))
#define fc_concat_two_string(first, second, combined) \ #define fc_concat_two_strings(first, second, combined) \
fc_combine_two_string(first, second, '\0', combined) fc_combine_two_strings(first, second, '\0', combined)
static inline int fc_get_full_filename_ex( static inline int fc_get_full_filename_ex(
const char *base_path_str, const int base_path_len, const char *base_path_str, const int base_path_len,
@ -1328,7 +1328,7 @@ static inline int fc_get_full_filename_ex(
char *full_filename, const int size) char *full_filename, const int size)
{ {
const char seperator = '/'; const char seperator = '/';
return fc_combine_two_string_ex(base_path_str, base_path_len, return fc_combine_two_strings_ex(base_path_str, base_path_len,
filename_str, filename_len, seperator, full_filename, size); filename_str, filename_len, seperator, full_filename, size);
} }
@ -1354,6 +1354,30 @@ static inline int fc_get_full_filename_ex(
#define fc_combine_full_filepath(base_path, filepath, full_filename) \ #define fc_combine_full_filepath(base_path, filepath, full_filename) \
fc_combine_full_filename(base_path, filepath, full_filename) fc_combine_full_filename(base_path, filepath, full_filename)
static inline int fc_get_hex_subdir_filepath(const char *base_path,
const int base_len, const int subdir_index, char *file_path)
{
const int padding_len = 2;
char *p;
memcpy(file_path, base_path, base_len);
p = file_path + base_len;
*p++ = '/';
if (subdir_index <= UINT8_MAX) {
*p++ = g_upper_hex_chars[(subdir_index >> 4) & 0x0F];
*p++ = g_upper_hex_chars[subdir_index & 0x0F];
*p = '\0';
} else {
if (subdir_index <= UINT16_MAX) {
p += short2HEX(subdir_index, p, padding_len);
} else {
p += int2HEX(subdir_index, p, padding_len);
}
}
return p - file_path;
}
/** get gzip command full filename /** get gzip command full filename
* return: the gzip command full filename * return: the gzip command full filename
*/ */