Clean up buf silliness.
This commit is contained in:
21
common.h
21
common.h
@@ -2,14 +2,23 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
//////// buf
|
||||
|
||||
#define BUF_LEN 4096
|
||||
struct buf {
|
||||
char *buf;
|
||||
char *tmp;
|
||||
char buf[BUF_LEN];
|
||||
size_t start;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
#define buf_chr(buff, at) ((buff)->buf[(buff)->start + (at)])
|
||||
#define buf_at(buff, at) (&buf_chr(buff, at))
|
||||
|
||||
ssize_t buf_fill(struct buf *, int);
|
||||
void buf_consume(struct buf *, size_t);
|
||||
|
||||
|
||||
//////// packet
|
||||
|
||||
#define MLAT_HZ 60000000
|
||||
#define DATA_MAX 14
|
||||
@@ -25,10 +34,4 @@ struct packet {
|
||||
};
|
||||
|
||||
|
||||
#define buf_at(buff, at) (&(buff)->buf[(buff)->start + (at)])
|
||||
|
||||
void buf_init(struct buf *, char *, char *);
|
||||
void buf_alias(struct buf *, struct buf *);
|
||||
|
||||
ssize_t buf_fill(struct buf *, int);
|
||||
void buf_consume(struct buf *, size_t);
|
||||
//////// hex
|
||||
|
||||
Reference in New Issue
Block a user