add FilenameString type and macro

storage_pool
YuQing 2021-03-19 09:17:11 +08:00
parent 13de41bc05
commit 07ba689835
5 changed files with 45 additions and 30 deletions

View File

@ -1,8 +1,9 @@
Version 1.49 2021-03-16
Version 1.49 2021-03-19
* add macros: FC_ABS and FC_NEGATIVE
* uniq_skiplist.c: add uniq_skiplist_pair struct and init function
* add functions: fc_mkdirs and str_replace
* add FilenameString type and macro
Version 1.48 2021-02-01
* fast_buffer.[hc]: add function fast_buffer_append_binary

View File

@ -21,6 +21,7 @@
#include <pthread.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#ifdef WIN32
@ -224,6 +225,12 @@ typedef struct
pthread_cond_t cond;
} pthread_lock_cond_pair_t;
typedef struct
{
char buff[PATH_MAX];
string_t s;
} FilenameString;
typedef void (*FreeDataFunc)(void *ptr);
typedef int (*CompareFunc)(void *p1, void *p2);
typedef void* (*MallocFunc)(size_t size);
@ -283,6 +290,13 @@ typedef void* (*MallocFunc)(size_t size);
#define FC_IS_NULL_STRING(s) ((s)->str == NULL)
#define FC_IS_EMPTY_STRING(s) ((s)->len == 0)
#define FC_INIT_FILENAME_STRING(filename) \
FC_SET_STRING_EX((filename).s, (filename).buff, 0)
#define FC_FILENAME_STRING_OBJ(filename) ((filename).s)
#define FC_FILENAME_STRING_PTR(filename) ((filename).buff)
#define FC_FILENAME_BUFFER_SIZE(filename) sizeof((filename).buff)
#define fc_compare_string(s1, s2) fc_string_compare(s1, s2)
static inline int fc_string_compare(const string_t *s1, const string_t *s2)