libonion
|
Functions | |
void | onion_low_initialize_memory_allocation (onion_low_malloc_sigt *mallocrout, onion_low_scalar_malloc_sigt *scalarmallocrout, onion_low_calloc_sigt *callocrout, onion_low_realloc_sigt *reallocrout, onion_low_strdup_sigt *strduprout, onion_low_free_sigt *freerout, onion_low_memoryfailure_sigt *memoryfailurerout) |
Our configurator for memory routines.To be called once before any other onion processing at initialization. All the routines should be explicitly provided. | |
void * | onion_low_malloc (size_t sz) |
NEVER FAILING MEMORY ALLOCATORS. | |
void * | onion_low_scalar_malloc (size_t sz) |
Our malloc wrapper for scalar data which does not contain any pointers inside.Knowing that a given zone does not contain any pointer can be useful, e.g. to Hans Boehm's conservative garbage collector on http://hboehm.info/gc/ using GC_MALLOC_ATOMIC.... | |
void * | onion_low_calloc (size_t nmemb, size_t size) |
Our calloc wrapper for any kind of data, even scalar one. | |
void * | onion_low_realloc (void *ptr, size_t size) |
Our realloc wrapper for any kind of data, even scalar one. | |
char * | onion_low_strdup (const char *str) |
Our strdup wrapper. | |
void * | onion_low_try_malloc (size_t sz) |
POSSIBLY FAILING MEMORY ALLOCATORS. | |
void * | onion_low_try_scalar_malloc (size_t sz) |
Our malloc wrapper for scalar data which does not contain any pointers inside. May return NULL on fail. | |
void * | onion_low_try_calloc (size_t nmemb, size_t size) |
Our calloc wrapper for any kind of data, even scalar one. May return NULL on fail. | |
void * | onion_low_try_realloc (void *ptr, size_t size) |
Our realloc wrapper for any kind of data, even scalar one. May return NULL on fail. | |
char * | onion_low_try_strdup (const char *str) |
Our strdup wrapper. May return NULL on fail. | |
void | onion_low_free (void *ptr) |
Our free wrapper for any kind of data, even scalar one. | |
typedef void * | onion_low_malloc_sigt (size_t sz) |
Signatures of user configurable memory routine replacement. | |
typedef void | onion_low_memoryfailure_sigt (const char *msg) |
The memory failure handler is called with a short message.It generally should not return, i.e. should exit, abort, or perhaps setjmp.... | |
typedef void * | onion_low_scalar_malloc_sigt (size_t sz) |
typedef void * | onion_low_calloc_sigt (size_t nmemb, size_t size) |
typedef void * | onion_low_realloc_sigt (void *ptr, size_t size) |
typedef char * | onion_low_strdup_sigt (const char *ptr) |
typedef void | onion_low_free_sigt (void *ptr) |
File low.h provides low level utilities, notably wrapping memory allocation and thread creation. Adventurous users could even customize them during early initialization, e.g. when using Hans Boehm conservative garbage collector from http://hboehm.info/gc/ or when using their own malloc variant so we specialize general data - which might contain pointers and could be allocated with GC_MALLOC into scalar data which is guaranteed to be pointer free and could be allocated with GC_MALLOC_ATOMIC ...
If your server does not use an alternative implementation, feel free not to use this functions, but if it might use it, please use them.
typedef void* onion_low_calloc_sigt(size_t nmemb, size_t size) |
typedef void onion_low_free_sigt(void *ptr) |
typedef void* onion_low_malloc_sigt(size_t sz) |
Signatures of user configurable memory routine replacement.
typedef void onion_low_memoryfailure_sigt(const char *msg) |
The memory failure handler is called with a short message.It generally should not return, i.e. should exit, abort, or perhaps setjmp....
typedef void* onion_low_realloc_sigt(void *ptr, size_t size) |
typedef void* onion_low_scalar_malloc_sigt(size_t sz) |
typedef char* onion_low_strdup_sigt(const char *ptr) |
void* onion_low_calloc | ( | size_t | nmemb, |
size_t | size | ||
) |
Our calloc wrapper for any kind of data, even scalar one.
References MEMORY_FAILURE.
Referenced by onion_dict_t::onion_dict_new(), onion_handler_t::onion_handler_new(), onion_https_t::onion_https_new(), onion_listen_point_t::onion_listen_point_new(), onion_new(), onion_poller_new(), onion_poller_t::onion_poller_new(), onion_poller_slot_new(), onion_request_t::onion_request_new(), onion_request_write(), and onion_url_new().
void onion_low_free | ( | void * | ptr | ) |
Our free wrapper for any kind of data, even scalar one.
Referenced by onion_block_t::onion_block_add_data(), onion_block_t::onion_block_free(), onion_dict_t::onion_dict_free(), onion_free(), onion_handler_auth_pam_delete(), onion_handler_auth_pam_handler(), onion_handler_export_local_delete(), onion_handler_export_local_new(), onion_handler_t::onion_handler_free(), onion_handler_t::onion_handler_handle(), onion_handler_opack_delete(), onion_handler_path_delete(), onion_handler_static_delete(), onion_https_t::onion_https_free_user_data(), onion_https_t::onion_https_new(), onion_listen_point_t::onion_listen_point_free(), onion_new(), onion_poller_free(), onion_poller_t::onion_poller_free(), onion_poller_t::onion_poller_new(), onion_poller_t::onion_poller_poll(), onion_ptr_list_free(), onion_request_t::onion_request_clean(), onion_request_t::onion_request_free(), onion_request_t::onion_request_guess_session_id(), onion_request_parser_data_free(), onion_request_t::onion_request_session_free(), onion_response_t::onion_response_free(), onion_response_t::onion_response_new(), onion_response_t::onion_response_vprintf(), onion_response_write_html_safe(), onion_set_hostname(), onion_set_port(), onion_shortcut_internal_redirect(), onion_url_add_handler(), onion_url_free_data(), onion_webdav_default_check_permissions(), onion_webdav_free(), onion_websocket_t::onion_websocket_free(), onion_websocket_t::onion_websocket_new(), and onion_websocket_t::onion_websocket_vprintf().
void onion_low_initialize_memory_allocation | ( | onion_low_malloc_sigt * | mallocrout, |
onion_low_scalar_malloc_sigt * | scalarmallocrout, | ||
onion_low_calloc_sigt * | callocrout, | ||
onion_low_realloc_sigt * | reallocrout, | ||
onion_low_strdup_sigt * | strduprout, | ||
onion_low_free_sigt * | freerout, | ||
onion_low_memoryfailure_sigt * | memoryfailurerout | ||
) |
Our configurator for memory routines.To be called once before any other onion processing at initialization. All the routines should be explicitly provided.
void* onion_low_malloc | ( | size_t | sz | ) |
NEVER FAILING MEMORY ALLOCATORS.
These allocators should not fail: if memory is exhausted, they invoke the memory failure routine then abort with a short failure message. Our malloc wrapper for any kind of data, including data containing pointers.
References MEMORY_FAILURE.
Referenced by onion_add_listen_point(), onion_base64_encode(), onion_block_t::onion_block_new(), onion_handler_auth_pam(), onion_handler_export_local_new(), onion_handler_opack(), onion_handler_path(), onion_handler_static(), onion_handler_webdav(), onion_listen(), onion_ptr_list_add(), onion_response_t::onion_response_new(), onion_sessions_mem_new(), onion_sessions_redis_new(), onion_sessions_sqlite3_new(), onion_url_add_handler(), onion_url_add_static(), and onion_websocket_t::onion_websocket_new().
void* onion_low_realloc | ( | void * | ptr, |
size_t | size | ||
) |
Our realloc wrapper for any kind of data, even scalar one.
References MEMORY_FAILURE.
Referenced by onion_add_listen_point(), onion_block_t::onion_block_add_char(), and onion_block_t::onion_block_min_maxsize().
void* onion_low_scalar_malloc | ( | size_t | sz | ) |
Our malloc wrapper for scalar data which does not contain any pointers inside.Knowing that a given zone does not contain any pointer can be useful, e.g. to Hans Boehm's conservative garbage collector on http://hboehm.info/gc/ using GC_MALLOC_ATOMIC....
References MEMORY_FAILURE.
Referenced by onion_base64_decode(), onion_block_t::onion_block_add_data(), onion_block_t::onion_block_new(), onion_c_quote_new(), onion_html_quote(), onion_quote_new(), onion_response_t::onion_response_vprintf(), onion_sessions_t::onion_sessions_generate_id(), onion_url_handler(), and onion_websocket_t::onion_websocket_vprintf().
char* onion_low_strdup | ( | const char * | str | ) |
Our strdup wrapper.
References MEMORY_FAILURE.
Referenced by onion_add_listen_point(), onion_handler_auth_pam(), onion_handler_opack(), onion_handler_static(), onion_handler_webdav(), onion_html_quote_dup(), onion_request_t::onion_request_get_client_description(), onion_request_t::onion_request_get_cookies_dict(), onion_request_t::onion_request_get_language_code(), onion_request_t::onion_request_guess_session_id(), onion_response_t::onion_response_new(), onion_set_certificate_va(), onion_set_hostname(), onion_set_port(), onion_set_user(), onion_shortcut_internal_redirect(), onion_url_add_handler(), and onion_url_add_static().
void* onion_low_try_calloc | ( | size_t | nmemb, |
size_t | size | ||
) |
Our calloc wrapper for any kind of data, even scalar one. May return NULL on fail.
void* onion_low_try_malloc | ( | size_t | sz | ) |
POSSIBLY FAILING MEMORY ALLOCATORS.
These allocators could fail by returning NULL. Their caller is requested to handle that failure.Our malloc wrapper for any kind of data, including data containing pointers. May return NULL on fail.
void* onion_low_try_realloc | ( | void * | ptr, |
size_t | size | ||
) |
Our realloc wrapper for any kind of data, even scalar one. May return NULL on fail.
void* onion_low_try_scalar_malloc | ( | size_t | sz | ) |
Our malloc wrapper for scalar data which does not contain any pointers inside. May return NULL on fail.
char* onion_low_try_strdup | ( | const char * | str | ) |
Our strdup wrapper. May return NULL on fail.