Clean up buf silliness.

This commit is contained in:
Ian Gulliver
2016-02-14 20:35:43 +00:00
parent d660117f7a
commit 93558c0a23
4 changed files with 31 additions and 34 deletions

View File

@@ -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