aboutsummaryrefslogtreecommitdiffstats
path: root/buf.h
blob: 72bbc457ee21cc6f2d118f5de51d1e672394958d (plain) (blame)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef __IHE_BUF_H
#define __IHE_BUF_H

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>

typedef struct buf_t
{
	uint8_t *buf;
	int size;
	int buf_size;
} buf_t;

/*
create empty buffer structure
*/
buf_t* buf_init();

int buf_not_null( buf_t *bf );

/*
if empty setup new buffer
if not empty resize?
*/
int    buf_size( buf_t *bf, int size );
/*
set used buffer size
*/
int    buf_used_size( buf_t *bf, int size );
/*
change buffer size
*/
int    buf_resize( buf_t *bf, int size );
/*
make buffer full of zeros
*/
int    buf_zero( buf_t *bf );
/*
clean all buffer
*/
void   buf_free( buf_t *bf );


#endif