24 lines
407 B
C
24 lines
407 B
C
#ifndef _RINGBUFFER_H_
|
|
#define _RINGBUFFER_H_
|
|
|
|
#include <stdlib.h>
|
|
|
|
typedef struct ringbuffer_s
|
|
{
|
|
size_t length;
|
|
size_t head, tail;
|
|
unsigned char * buffer;
|
|
char ovf;
|
|
} * ringbuffer_t;
|
|
|
|
ringbuffer_t
|
|
ringbuffer_new(size_t size);
|
|
int
|
|
ringbuffer_nonempty(ringbuffer_t buffer);
|
|
unsigned char
|
|
ringbuffer_get_char(ringbuffer_t buffer);
|
|
int
|
|
ringbuffer_put_char(ringbuffer_t buffer
|
|
, unsigned char c);
|
|
#endif
|