dynamic_buffer.h v0.2.2
Reference-counted byte buffer library for efficient I/O operations
Loading...
Searching...
No Matches
Functions
Buffer Slicing

Buffer slicing operations (creates independent copies) More...

Functions

DB_DEF db_buffer db_slice (db_buffer buf, size_t offset, size_t length)
 Create a slice of the buffer (creates independent copy)
 
DB_DEF db_buffer db_slice_from (db_buffer buf, size_t offset)
 Create a slice from offset to end of buffer.
 
DB_DEF db_buffer db_slice_to (db_buffer buf, size_t length)
 Create a slice from start to specified length.
 

Detailed Description

Buffer slicing operations (creates independent copies)

Function Documentation

◆ db_slice()

DB_DEF db_buffer db_slice ( db_buffer  buf,
size_t  offset,
size_t  length 
)

Create a slice of the buffer (creates independent copy)

Parameters
bufSource buffer (must not be NULL)
offsetStarting offset in bytes
lengthNumber of bytes in slice
Returns
New buffer slice or NULL if bounds are invalid
Note
The slice is an independent copy of the specified data range

◆ db_slice_from()

DB_DEF db_buffer db_slice_from ( db_buffer  buf,
size_t  offset 
)

Create a slice from offset to end of buffer.

Parameters
bufSource buffer (must not be NULL)
offsetStarting offset in bytes
Returns
New buffer slice or NULL if offset is invalid

◆ db_slice_to()

DB_DEF db_buffer db_slice_to ( db_buffer  buf,
size_t  length 
)

Create a slice from start to specified length.

Parameters
bufSource buffer (must not be NULL)
lengthNumber of bytes from start
Returns
New buffer slice or NULL if length is invalid