libonion
|
Data Structures | |
struct | onion_block_t |
Data type to store some raw dataNormally it will be used to store strings when the size is unknown beforehand, but it can contain any type of data. More... |
Functions | |
onion_block * | onion_block_t::onion_block_new () |
Creates a new block. | |
void | onion_block_t::onion_block_free (onion_block *bl) |
Removes the current block. | |
void | onion_block_t::onion_block_clear (onion_block *b) |
Discards all data on this block, and set the size to 0. | |
void | onion_block_t::onion_block_min_maxsize (onion_block *b, int minsize) |
Ensures the block has at least this reserved memory space. | |
const char * | onion_block_t::onion_block_data (const onion_block *b) |
Returns the current data. | |
off_t | onion_block_t::onion_block_size (const onion_block *b) |
Returns current block size. | |
void | onion_block_t::onion_block_rewind (onion_block *b, off_t n) |
Reduces the size of the block. |
void onion_block_clear | ( | onion_block * | b | ) |
Discards all data on this block, and set the size to 0.
This is usefull to reuse existing blocks
References onion_block_t::size.
const char * onion_block_data | ( | const onion_block * | b | ) |
Returns the current data.
It will be finished with a \0 (if not already, to ensure is printable.
References onion_block_t::data, onion_block_t::maxsize, onion_block_t::onion_block_add_char(), and onion_block_t::size.
Referenced by onion_sessions_redis_save(), onion_sessions_sqlite3_save(), onion_shortcut_response_json(), onion_webdav_handler(), onion_webdav_propfind(), onion_webdav_proppatch(), and onion_webdav_put().
void onion_block_free | ( | onion_block * | bl | ) |
Removes the current block.
References onion_block_t::data, and onion_low_free().
Referenced by onion_dict_t::onion_dict_to_json(), onion_request_t::onion_request_clean(), onion_request_t::onion_request_free(), onion_sessions_redis_save(), onion_sessions_sqlite3_save(), onion_shortcut_response_json(), onion_webdav_propfind(), and onion_webdav_write_propfind().
void onion_block_min_maxsize | ( | onion_block * | b, |
int | minsize | ||
) |
Ensures the block has at least this reserved memory space.
This is usefull for some speedups, and prevent sucessive mallocs if you know beforehand the size.
References onion_block_t::data, onion_block_t::maxsize, and onion_low_realloc().
Referenced by onion_json_quote_add().
onion_block * onion_block_new | ( | ) |
Creates a new block.
References onion_block_t::data, onion_block_t::maxsize, ONION_BLOCK_GROW_MIN_BLOCK, onion_low_malloc(), onion_low_scalar_malloc(), and onion_block_t::size.
Referenced by onion_dict_t::onion_dict_to_json(), and onion_webdav_write_propfind().
void onion_block_rewind | ( | onion_block * | b, |
off_t | n | ||
) |
Reduces the size of the block.
References onion_block_t::size.
Referenced by onion_dict_t::onion_dict_to_json().
off_t onion_block_size | ( | const onion_block * | b | ) |
Returns current block size.
References onion_block_t::size.
Referenced by onion_dict_t::onion_dict_to_json(), onion_json_quote_add(), onion_shortcut_response_json(), onion_webdav_propfind(), and onion_webdav_proppatch().