@@ -64,12 +64,14 @@ struct __attribute__ ((__packed__)) sdshdr32 {
6464 uint32_t len ; /* used */
6565 uint32_t alloc ; /* excluding the header and null terminator */
6666 unsigned char flags ; /* 3 lsb of type, 5 unused bits */
67+ char padding ; /* Added to have unique value for %8 operation*/
6768 char buf [];
6869};
6970struct __attribute__ ((__packed__ )) sdshdr64 {
7071 uint64_t len ; /* used */
7172 uint64_t alloc ; /* excluding the header and null terminator */
7273 unsigned char flags ; /* 3 lsb of type, 5 unused bits */
74+ char padding [3 ]; /* Added to have unique value for %8 operation */
7375 char buf [];
7476};
7577
@@ -83,6 +85,7 @@ struct __attribute__ ((__packed__)) sdshdr64 {
8385#define SDS_HDR_VAR (T ,s ) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T)));
8486#define SDS_HDR (T ,s ) ((struct sdshdr##T *)((s)-(sizeof(struct sdshdr##T))))
8587#define SDS_TYPE_5_LEN (f ) ((f)>>SDS_TYPE_BITS)
88+ #define SDS_MOD8 (T ) (sizeof(struct sdshdr##T)&7)
8689
8790static inline size_t sdslen (const sds s ) {
8891 unsigned char flags = s [-1 ];
@@ -221,6 +224,7 @@ sds sdsempty(void);
221224sds sdsdramempty (void );
222225sds sdsdup (const sds s );
223226void sdsfree (sds s );
227+ void sdsfreeOptim (sds s );
224228sds sdsgrowzero (sds s , size_t len );
225229sds sdscatlen (sds s , const void * t , size_t len );
226230sds sdscat (sds s , const char * t );
0 commit comments