A wrapper around a contiguous block of allocated memory.
More...
#include "prism/compiler/exported.h"
#include "prism/compiler/nodiscard.h"
#include "prism/compiler/nonnull.h"
#include <stddef.h>
Go to the source code of this file.
|
|
typedef struct pm_buffer_t | pm_buffer_t |
| | A wrapper around a contiguous block of allocated memory.
|
| |
A wrapper around a contiguous block of allocated memory.
◆ pm_buffer_new()
| PRISM_EXPORTED_FUNCTION PRISM_NODISCARD pm_buffer_t * pm_buffer_new |
( |
void |
| ) |
|
Allocate and initialize a new buffer.
If the buffer cannot be allocated, this function will abort the process.
- Returns
- A pointer to the initialized buffer. The caller is responsible for freeing the buffer with pm_buffer_free.
◆ pm_buffer_free()
| PRISM_EXPORTED_FUNCTION void pm_buffer_free |
( |
pm_buffer_t * |
buffer | ) |
|
Free both the memory held by the buffer and the buffer itself.
- Parameters
-
| buffer | The buffer to free. |
◆ pm_buffer_value()
| PRISM_EXPORTED_FUNCTION char * pm_buffer_value |
( |
const pm_buffer_t * |
buffer | ) |
|
Return the value of the buffer.
- Parameters
-
| buffer | The buffer to get the value of. |
- Returns
- The value of the buffer.
◆ pm_buffer_length()
| PRISM_EXPORTED_FUNCTION size_t pm_buffer_length |
( |
const pm_buffer_t * |
buffer | ) |
|
Return the length of the buffer.
- Parameters
-
| buffer | The buffer to get the length of. |
- Returns
- The length of the buffer.