Compare commits
3 Commits
8f156869f1
...
3c6abb5203
| Author | SHA1 | Date |
|---|---|---|
|
|
3c6abb5203 | |
|
|
6f4b3b7cd8 | |
|
|
a16fde8070 |
|
|
@ -66,7 +66,7 @@ libfastcommon.a: $(FAST_STATIC_OBJS)
|
|||
.c:
|
||||
$(COMPILE) -o $@ $< $(FAST_STATIC_OBJS) $(LIB_PATH) $(INC_PATH)
|
||||
.c.o:
|
||||
$(COMPILE) -c -o $@ $< $(INC_PATH)
|
||||
$(COMPILE) -c -fPIC -o $@ $< $(INC_PATH)
|
||||
.c.lo:
|
||||
$(COMPILE) -c -fPIC -o $@ $< $(INC_PATH)
|
||||
install:
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ int array_allocator_init_ex(ArrayAllocatorContext *ctx,
|
|||
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,
|
||||
obj_size, NULL, regions, region - regions, 0,
|
||||
0.9999, reclaim_interval, need_lock);
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ int free_queue_init_ex2(struct fast_task_queue *queue, const char *name,
|
|||
(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,
|
||||
queue->block_size, alloc_once, max_connections,
|
||||
(fast_mblock_object_init_func)task_alloc_init,
|
||||
|
|
|
|||
|
|
@ -912,7 +912,7 @@ static int iniAddAnnotation(char *params)
|
|||
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);
|
||||
if (init_func == NULL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ static int log_delete_old_file(LogContext *pContext,
|
|||
char full_filename[MAX_PATH_SIZE + 128];
|
||||
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
|
||||
{
|
||||
|
|
@ -652,7 +652,7 @@ static int log_delete_matched_old_files(LogContext *pContext,
|
|||
log_get_file_path(pContext, log_filepath);
|
||||
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);
|
||||
if (unlink(full_filename) != 0)
|
||||
{
|
||||
|
|
@ -765,9 +765,9 @@ static void *log_gzip_func(void *args)
|
|||
}
|
||||
|
||||
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);
|
||||
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));
|
||||
if (result != 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1460,7 +1460,7 @@ int safeWriteToFile(const char *filename, const char *buff,
|
|||
char tmpFilename[PATH_MAX];
|
||||
int result;
|
||||
|
||||
fc_combine_two_string(filename, "tmp", '.', tmpFilename);
|
||||
fc_combine_two_strings(filename, "tmp", '.', tmpFilename);
|
||||
if ((result=writeToFile(tmpFilename, buff, file_size)) != 0)
|
||||
{
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -1288,7 +1288,7 @@ static inline int resolve_path(const char *from, const char *filename,
|
|||
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 *second_str, const int second_len,
|
||||
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;
|
||||
}
|
||||
|
||||
#define fc_combine_two_string_s(first, second, seperator, combined, size) \
|
||||
fc_combine_two_string_ex(first, strlen(first), second, strlen(second), \
|
||||
#define fc_combine_two_strings_s(first, second, seperator, combined, size) \
|
||||
fc_combine_two_strings_ex(first, strlen(first), second, strlen(second), \
|
||||
seperator, combined, size)
|
||||
|
||||
#define fc_combine_two_string(first, second, seperator, combined) \
|
||||
fc_combine_two_string_s(first, second, seperator, \
|
||||
#define fc_combine_two_strings(first, second, seperator, combined) \
|
||||
fc_combine_two_strings_s(first, second, seperator, \
|
||||
combined, sizeof(combined))
|
||||
|
||||
#define fc_concat_two_string(first, second, combined) \
|
||||
fc_combine_two_string(first, second, '\0', combined)
|
||||
#define fc_concat_two_strings(first, second, combined) \
|
||||
fc_combine_two_strings(first, second, '\0', combined)
|
||||
|
||||
static inline int fc_get_full_filename_ex(
|
||||
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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -1354,6 +1354,30 @@ static inline int fc_get_full_filename_ex(
|
|||
#define fc_combine_full_filepath(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
|
||||
* return: the gzip command full filename
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue