libcucul buffer handling


Functions

cucul_buffer_tcucul_load_memory (void *, unsigned long int)
 Load a memory area into a buffer.
cucul_buffer_tcucul_load_file (char const *)
 Load a file into a buffer.
unsigned long int cucul_get_buffer_size (cucul_buffer_t *)
 Get the buffer size.
void * cucul_get_buffer_data (cucul_buffer_t *)
 Get the buffer data.
int cucul_free_buffer (cucul_buffer_t *)
 Free a buffer.

Detailed Description

These functions provide methods to handle libcucul buffers.

Function Documentation

cucul_buffer_t* cucul_load_memory void *  data,
unsigned long int  size
 

This function creates a libcucul buffer that points to the given memory area. The data is not duplicated and any changes made to the original memory area appear in the buffer.

Parameters:
data The memory area to load.
size The size of the memory area.
Returns:
A libcucul buffer pointing to the memory area, or NULL if an error occurred.

cucul_buffer_t* cucul_load_file char const *  file  ) 
 

This function loads a file into memory and returns a libcucul buffer for use with other functions.

Parameters:
file The filename
Returns:
A libcucul buffer containing the file's contents, or NULL if an error occurred.

unsigned long int cucul_get_buffer_size cucul_buffer_t buf  ) 
 

This function returns the length (in bytes) of the memory area stored in the given libcucul buffer.

This function never fails.

Parameters:
buf A libcucul buffer
Returns:
The buffer data length.

void* cucul_get_buffer_data cucul_buffer_t buf  ) 
 

This function returns a pointer to the memory area stored in the given libcucul buffer.

This function never fails.

Parameters:
buf A libcucul buffer
Returns:
A pointer to the buffer memory area.

int cucul_free_buffer cucul_buffer_t buf  ) 
 

This function frees the structures associated with the given libcucul buffer.

This function never fails.

Parameters:
buf A libcucul buffer
Returns:
This function always returns 0.