From 7d5e94f9dd8e434390d296eb1b589c58d59cf88f Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Tue, 15 Mar 2022 08:51:20 +0800 Subject: [PATCH] rename fc_format_path to fc_remove_redundant_slashes --- src/shared_func.c | 3 ++- src/shared_func.h | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/shared_func.c b/src/shared_func.c index 1d924f6..ee4974e 100644 --- a/src/shared_func.c +++ b/src/shared_func.c @@ -1136,7 +1136,8 @@ void chopPath(char *filePath) } } -int fc_format_path(const string_t *src, string_t *dest, const int size) +int fc_remove_redundant_slashes(const string_t *src, + string_t *dest, const int size) { #define MAX_SUBDIR_COUNT 128 const bool ignore_empty = true; diff --git a/src/shared_func.h b/src/shared_func.h index 3ecf877..c61dfbc 100644 --- a/src/shared_func.h +++ b/src/shared_func.h @@ -589,14 +589,35 @@ int get_time_item_from_str(const char *pValue, const char *item_name, */ void chopPath(char *filePath); -/** format the path +/** remove redundant slashes * parameters: * src: the input path * dest: the output path * size: the max size of dest path * return: error no , 0 success, != 0 fail */ -int fc_format_path(const string_t *src, string_t *dest, const int size); +int fc_remove_redundant_slashes(const string_t *src, + string_t *dest, const int size); + +static inline int fc_remove_redundant_slashes1(const char *input, + string_t *dest, const int size) +{ + string_t src; + + FC_SET_STRING(src, (char *)input); + return fc_remove_redundant_slashes(&src, dest, size); +} + +static inline int fc_remove_redundant_slashes2(const char *input, + char *output, const int size) +{ + string_t src; + string_t dest; + + FC_SET_STRING(src, (char *)input); + dest.str = output; + return fc_remove_redundant_slashes(&src, &dest, size); +} /** get file content by fd * parameters: