Skip to content

Commit

Permalink
增加 sds.h 注释
Browse files Browse the repository at this point in the history
  • Loading branch information
PansonPanson committed Nov 24, 2023
1 parent d1ee2d0 commit 8cd59c2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/sds.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,24 @@ struct __attribute__ ((__packed__)) sdshdr5 {
char buf[];
};
struct __attribute__ ((__packed__)) sdshdr8 {
/**
* 已使用长度
*/
uint8_t len; /* used */

/**
* 总长度
*/
uint8_t alloc; /* excluding the header and null terminator */

/**
* 标识,长 1 字节,低 3 位表示类型,高 5 位预留
*/
unsigned char flags; /* 3 lsb of type, 5 unused bits */

/**
* 柔性数组,用于存放真正的内容数据
*/
char buf[];
};
struct __attribute__ ((__packed__)) sdshdr16 {
Expand Down

0 comments on commit 8cd59c2

Please sign in to comment.