MGE General C Library - API Documentation v1.8.4
Library of general C functions.
Loading...
Searching...
No Matches
mge-buffer.h
Go to the documentation of this file.
1
16#ifndef MGE_BUFFER_H
17#define MGE_BUFFER_H
18
20
21#include <sys/types.h>
22
24
28struct mgebuffer {
29 char *buffer;
30 size_t size;
31 size_t proc_next;
32 size_t next_free;
33};
34
38#define MGEBUFFER_INIT \
39 { \
40 .buffer = NULL, .size = 0, .proc_next = 0, .next_free = 0 \
41 }
42
43struct mgebuffer *concat_buf(const char *s_buf, const size_t s_buf_os,
44 struct mgebuffer *m_buf);
45
46struct mgebuffer *trim_buf(struct mgebuffer *msg_buf);
47
48void print_buf(struct mgebuffer *m_buf);
49
50void print_def_buf_values(void);
51
53
54#endif /* ndef MGE_BUFFER_H */
struct mgebuffer * trim_buf(struct mgebuffer *msg_buf)
Remove processed data from a buffer object if deemed necessary.
Definition buffer.c:74
void print_def_buf_values(void)
Print the key default values to stdout, (for debugging).
Definition buffer.c:128
void print_buf(struct mgebuffer *m_buf)
Print a buffer object to stdout, (for debugging).
Definition buffer.c:115
struct mgebuffer * concat_buf(const char *s_buf, const size_t s_buf_os, struct mgebuffer *m_buf)
Concatenate the used portion of a flat buffer into a buffer object.
Definition buffer.c:34
Header file to ease portability.
#define BEGIN_C_DECLS
BEGIN_C_DECLS should be used at the beginning of declarations so that C++ compilers don't mangle thei...
Definition mge-portability.h:30
#define END_C_DECLS
Use END_C_DECLS at the end of C declarations.
Definition mge-portability.h:34
A buffer object.
Definition mge-buffer.h:28
size_t next_free
Next free buffer location.
Definition mge-buffer.h:32
size_t proc_next
Next buffer location for processing.
Definition mge-buffer.h:31
size_t size
Size of the buffer storage area.
Definition mge-buffer.h:30
char * buffer
Buffer storage.
Definition mge-buffer.h:29