blob: 148b3692a6cbf022679f67b0af2b70977909bf15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#ifndef _SLIDING_BUF_H
#define _SLIDING_BUF_H 1
/* sliding buffer structure */
typedef struct {
int fh; /* the input filehandle for the buffer */
unsigned char *buf; /* pointer to the buffer */
unsigned char *ptr; /* start positon (used internally) */
unsigned char *segment; /* the start position of this segment */
size_t len; /* length of this segment */
size_t maxsize; /* max size of buffer */
size_t bufsize; /* current size of buffer */
int eof; /* true if there is no more to read */
size_t extent; /* if non-zero, max number of bytes to read */
size_t extent_used; /* how much we have already read */
} sliding_buffer_t;
/* sliding_buffer.c */
int s_buffer_init(sliding_buffer_t *sbuf, int size);
void s_buffer_destroy(sliding_buffer_t *sbuf);
int s_buffer_read(sliding_buffer_t *sbuf, char *matchstr);
#endif /* !_SLIDING_BUF_H */
|