Compare commits

...

5 Commits

Author SHA1 Message Date
Hongcai Deng fc237d1062
Merge a16fde8070 into 0afae48142 2025-08-19 15:40:49 +08:00
vazmin 0afae48142 gh actions: upgrade to 1.0.78-1 2025-08-16 16:31:05 +00:00
YuQing 158924f259 upgrade version to 1.0.78 2025-08-14 09:43:38 +08:00
YuQing bf7c6e5144 add function fc_get_two/three_subdirs_full_filepath etc. 2025-08-13 15:40:39 +08:00
Hongcai Deng a16fde8070 fix: compile error when build .so using .a
```
src/libfastcommon.a(hash.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
```

env: Ubuntu 14.04, gcc 4.8
2017-01-29 14:20:18 +08:00
4 changed files with 102 additions and 2 deletions

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
libfastcommon (1.0.78-1) unstable; urgency=medium
* upgrade to 1.0.78-1
-- YuQing <384681@qq.com> Sat, 16 Aug 2025 16:31:05 +0000
libfastcommon (1.0.77-1) unstable; urgency=medium
* upgrade to 1.0.77-1

View File

@ -3,7 +3,7 @@
%define CommitVersion %(echo $COMMIT_VERSION)
Name: libfastcommon
Version: 1.0.77
Version: 1.0.78
Release: 1%{?dist}
Summary: c common functions library extracted from my open source projects FastDFS
License: LGPL

View File

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

View File

@ -1378,6 +1378,100 @@ static inline int fc_get_hex_subdir_filepath(const char *base_path,
return p - file_path;
}
static inline int fc_get_two_subdirs_full_filepath_ex(
const char *base_path, const int base_len,
const char *subdir_str1, const int subdir_len1,
const char *subdir_str2, const int subdir_len2,
char *file_path, const int size)
{
char *p;
if (base_len + 1 + subdir_len1 + 1 + subdir_len2 >= size) {
return snprintf(file_path, size, "%s/%s/%s",
base_path, subdir_str1, subdir_str2);
}
memcpy(file_path, base_path, base_len);
p = file_path + base_len;
*p++ = '/';
memcpy(p, subdir_str1, subdir_len1);
p += subdir_len1;
*p++ = '/';
memcpy(p, subdir_str2, subdir_len2);
p += subdir_len2;
*p = '\0';
return p - file_path;
}
#define fc_get_two_subdirs_full_filepath(base_path, base_len, \
subdir_str1, subdir_len1, subdir_str2, subdir_len2, file_path) \
fc_get_two_subdirs_full_filepath_ex(base_path, base_len, \
subdir_str1, subdir_len1, subdir_str2, subdir_len2, \
file_path, sizeof(file_path))
#define fc_get_one_subdir_full_filename_ex(base_path, base_len, subdir_str, \
subdir_len, filename_str, filename_len, full_filename, size) \
fc_get_two_subdirs_full_filepath_ex(base_path, base_len, \
subdir_str, subdir_len, filename_str, filename_len, \
full_filename, size)
#define fc_get_one_subdir_full_filename(base_path, base_len, subdir_str, \
subdir_len, filename_str, filename_len, full_filename) \
fc_get_one_subdir_full_filename_ex(base_path, base_len, \
subdir_str, subdir_len, filename_str, filename_len, \
full_filename, sizeof(full_filename))
static inline int fc_get_three_subdirs_full_filepath_ex(
const char *base_path, const int base_len,
const char *subdir_str1, const int subdir_len1,
const char *subdir_str2, const int subdir_len2,
const char *subdir_str3, const int subdir_len3,
char *file_path, const int size)
{
char *p;
if (base_len + 1 + subdir_len1 + 1 + subdir_len2 + subdir_len3 >= size) {
return snprintf(file_path, size, "%s/%s/%s/%s",
base_path, subdir_str1, subdir_str2, subdir_str3);
}
memcpy(file_path, base_path, base_len);
p = file_path + base_len;
*p++ = '/';
memcpy(p, subdir_str1, subdir_len1);
p += subdir_len1;
*p++ = '/';
memcpy(p, subdir_str2, subdir_len2);
p += subdir_len2;
*p++ = '/';
memcpy(p, subdir_str3, subdir_len3);
p += subdir_len3;
*p = '\0';
return p - file_path;
}
#define fc_get_three_subdirs_full_filepath(base_path, base_len, \
subdir_str1, subdir_len1, subdir_str2, subdir_len2, \
subdir_str3, subdir_len3, file_path) \
fc_get_three_subdirs_full_filepath_ex(base_path, base_len, \
subdir_str1, subdir_len1, subdir_str2, subdir_len2, \
subdir_str3, subdir_len3, file_path, sizeof(file_path))
#define fc_get_two_subdirs_full_filename_ex(base_path, base_len, \
subdir_str1, subdir_len1, subdir_str2, subdir_len2, \
filename_str, filename_len, full_filename, size) \
fc_get_three_subdirs_full_filepath_ex(base_path, base_len, \
subdir_str1, subdir_len1, subdir_str2, subdir_len2, \
filename_str, filename_len, full_filename, size)
#define fc_get_two_subdirs_full_filename(base_path, base_len, \
subdir_str1, subdir_len1, subdir_str2, subdir_len2, \
filename_str, filename_len, full_filename) \
fc_get_two_subdirs_full_filename_ex(base_path, base_len, \
subdir_str1, subdir_len1, subdir_str2, subdir_len2, \
filename_str, filename_len, full_filename, sizeof(full_filename))
/** get gzip command full filename
* return: the gzip command full filename
*/