|
PER Firmware
|
Fixed-size string builder. Useful for building large CMD strings before transmission. More...
#include <stdint.h>#include <stddef.h>Go to the source code of this file.
Classes | |
| struct | strbuf_t |
Macros | |
| #define | ALLOCATE_STRBUF(NAME, MAX_SIZE) |
| Macro to allocate and initialize a strbuf_t with a fixed-size buffer. Also creates the underlying data buffer in the same scope. | |
Functions | |
| void | strbuf_clear (strbuf_t *sb) |
| Clears the buffer by resetting length to 0. | |
| size_t | strbuf_append (strbuf_t *sb, const void *data, size_t length) |
| Appends raw data to the buffer. If the data exceeds the buffer size, no data is appended. | |
| size_t | strbuf_printf (strbuf_t *sb, const char *format,...) |
| Appends formatted data to the buffer using printf-style formatting. ! | |
Fixed-size string builder. Useful for building large CMD strings before transmission.
| #define ALLOCATE_STRBUF | ( | NAME, | |
| MAX_SIZE ) |
Macro to allocate and initialize a strbuf_t with a fixed-size buffer. Also creates the underlying data buffer in the same scope.
| NAME | The name of the strbuf_t variable to create. |
| MAX_SIZE | The maximum size of the buffer. Usage: ALLOCATE_STRBUF(my_buf, 128); This creates a strbuf_t named my_buf with a buffer of 128 bytes. |
| size_t strbuf_append | ( | strbuf_t * | sb, |
| const void * | data, | ||
| size_t | length ) |
Appends raw data to the buffer. If the data exceeds the buffer size, no data is appended.
!
| void strbuf_clear | ( | strbuf_t * | sb | ) |
Clears the buffer by resetting length to 0.
| size_t strbuf_printf | ( | strbuf_t * | sb, |
| const char * | format, | ||
| ... ) |
Appends formatted data to the buffer using printf-style formatting. !