From ce98e53ae20bc43642632c192bf75aa417184997 Mon Sep 17 00:00:00 2001 From: yuqing Date: Mon, 10 Sep 2018 21:21:54 +0800 Subject: [PATCH] add FC_SET_STRING --- src/common_define.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/common_define.h b/src/common_define.h index 3f15992..186c44f 100644 --- a/src/common_define.h +++ b/src/common_define.h @@ -217,6 +217,15 @@ typedef void* (*MallocFunc)(size_t size); #define __gcc_attribute__(x) #endif +//for printf format %.*s +#define FC_PRINTF_STAR_STRING_PARAMS(s) (s).len, (s).str + +#define FC_SET_STRING(dest, src) \ + do { \ + (dest).str = src; \ + (dest).len = strlen(src); \ + } while (0) + #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)