21 lines
594 B
C
21 lines
594 B
C
#ifndef _DYN_BUF_H_
|
|
#define _DYN_BUF_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
typedef struct
|
|
{
|
|
void *buffer;
|
|
unsigned int init_size;
|
|
unsigned int grow_size;
|
|
unsigned long int size;
|
|
unsigned long int used;
|
|
} dynamic_buffer_t;
|
|
|
|
//Intitialize an empty dynamic buffer *buffer. Returns 0 on success.
|
|
int init_dynamic_buffer(dynamic_buffer_t *buffer, unsigned int init_size, unsigned int grow_size);
|
|
|
|
// Resize a dynamic buffer to size elements. When size is 0, it is resized by TABLE_GROW_SIZE. Returns 0 on sucess
|
|
int resize_dynamic_buffer(dynamic_buffer_t *buffer, uint32_t size);
|
|
|
|
#endif
|