Ruby: pm_buffer_t Struct Reference

Ruby 3.4.9p82 (2026-03-11 revision 76cca827ab52ab1d346a728f068d5b8da3e2952b)

Public Member Functions | Data Fields
pm_buffer_t Struct Reference

A pm_buffer_t is a simple memory buffer that stores data in a contiguous block of memory. More...

`#include <pm_buffer.h>`

## Public Member Functions
PRISM_EXPORTED_FUNCTION bool | pm_buffer_init (pm_buffer_t *buffer)
| Initialize a pm_buffer_t with its default values.
PRISM_EXPORTED_FUNCTION char * | pm_buffer_value (const pm_buffer_t *buffer)
| Return the value of the buffer.
PRISM_EXPORTED_FUNCTION size_t | pm_buffer_length (const pm_buffer_t *buffer)
| Return the length of the buffer.
PRISM_EXPORTED_FUNCTION void | pm_buffer_free (pm_buffer_t *buffer)
| Free the memory associated with the buffer.

## Data Fields
size_t | length
| The length of the buffer in bytes.
size_t | capacity
| The capacity of the buffer in bytes that has been allocated.
char * | value
| A pointer to the start of the buffer.

## Detailed Description

A pm_buffer_t is a simple memory buffer that stores data in a contiguous block of memory.

Definition at line 22 of file pm_buffer.h.

## Member Function Documentation

## ◆ pm_buffer_free()

PRISM_EXPORTED_FUNCTION void pm_buffer_free | ( | pm_buffer_t * | buffer | ) |

Free the memory associated with the buffer.

Parameters

  buffer | The buffer to free.

Definition at line 355 of file pm_buffer.c.

Referenced by pm_buffer_free().

## ◆ pm_buffer_init()

PRISM_EXPORTED_FUNCTION bool pm_buffer_init | ( | pm_buffer_t * | buffer | ) |

Initialize a pm_buffer_t with its default values.

Parameters

  buffer | The buffer to initialize.

Returns
  True if the buffer was initialized successfully, false otherwise.

Definition at line 27 of file pm_buffer.c.

Referenced by pm_buffer_init().

## ◆ 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.

Definition at line 43 of file pm_buffer.c.

Referenced by pm_buffer_length().

## ◆ 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.

Definition at line 35 of file pm_buffer.c.

Referenced by pm_buffer_value().

## Field Documentation

## ◆ capacity

size_t pm_buffer_t::capacity

The capacity of the buffer in bytes that has been allocated.

Definition at line 27 of file pm_buffer.h.

Referenced by pm_buffer_init_capacity().

## ◆ length

size_t pm_buffer_t::length

The length of the buffer in bytes.

Definition at line 24 of file pm_buffer.h.

Referenced by pm_buffer_append_zeroes(), pm_buffer_clear(), pm_buffer_concat(), pm_buffer_index(), pm_buffer_init_capacity(), pm_buffer_insert(), pm_buffer_length(), pm_buffer_prepend_string(), pm_buffer_rstrip(), and pm_serialize_content().

## ◆ value

char* pm_buffer_t::value

A pointer to the start of the buffer.

Definition at line 30 of file pm_buffer.h.

Referenced by pm_buffer_append_zeroes(), pm_buffer_concat(), pm_buffer_free(), pm_buffer_index(), pm_buffer_init_capacity(), pm_buffer_insert(), pm_buffer_prepend_string(), pm_buffer_rstrip(), pm_buffer_value(), and pm_serialize_content().

The documentation for this struct was generated from the following file:

- prism/util/pm_buffer.h