koliseo 0.4.9
Loading...
Searching...
No Matches
koliseo.c File Reference
#include "koliseo.h"

Go to the source code of this file.

Functions

const char * string_koliseo_version (void)
 Returns the constant string representing current version for Koliseo.
int int_koliseo_version (void)
 Returns the constant int representing current version for Koliseo.
void KLS_OOM_default_handler__ (Koliseo *kls, ptrdiff_t available, ptrdiff_t padding, ptrdiff_t size, ptrdiff_t count)
 Used internally for handling Out-Of-Memory in push calls when no user handler is provided.
void KLS_PTRDIFF_MAX_default_handler__ (struct Koliseo *kls, ptrdiff_t size, ptrdiff_t count)
void KLS_ZEROCOUNT_default_handler__ (Koliseo *kls, ptrdiff_t available, ptrdiff_t padding, ptrdiff_t size)
 Used internally for handling zero-count in push calls when no user handler is provided.
KLS_Conf kls_conf_init_handled (int autoset_regions, int alloc_backend, ptrdiff_t reglist_kls_size, int autoset_temp_regions, int collect_stats, int verbose_lvl, int block_while_has_temp, int allow_zerocount_push, FILE *log_fp, const char *log_filepath, KLS_Err_Handlers err_handlers)
 Used to prepare a KLS_Conf without caring about KOLISEO_HAS_REGIONS.
KLS_Conf kls_conf_init (int autoset_regions, int alloc_backend, ptrdiff_t reglist_kls_size, int autoset_temp_regions, int collect_stats, int verbose_lvl, int block_while_has_temp, int allow_zerocount_push, FILE *log_fp, const char *log_filepath)
 Used to prepare a KLS_Conf without caring about KOLISEO_HAS_REGIONS.
void kls_dbg_features (void)
 Prints enabled Koliseo features to stderr.
ptrdiff_t kls_get_pos (const Koliseo *kls)
 Returns the current offset (position of pointer bumper) for the passed Koliseo.
void kls_log (Koliseo *kls, const char *tag, const char *format,...)
 Logs a message to the log_fp FILE field of the passed Koliseo pointer, if its conf.kls_verbose_lvl is >0.
Koliseo * kls_new_alloc_ext (ptrdiff_t size, kls_alloc_func alloc_func, KLS_Hooks ext_handlers, void *user)
 Takes a ptrdiff_t size and a function pointer to the allocation function.
Koliseo * kls_new_alloc (ptrdiff_t size, kls_alloc_func alloc_func)
 Takes a ptrdiff_t size and a function pointer to the allocation function.
Koliseo * kls_new_conf_alloc_ext (ptrdiff_t size, KLS_Conf conf, kls_alloc_func alloc_func, KLS_Hooks ext_handlers, void *user)
 Takes a ptrdiff_t size, a KLS_Conf to configure the new Koliseo, and an allocation function pointer.
Koliseo * kls_new_conf_alloc (ptrdiff_t size, KLS_Conf conf, kls_alloc_func alloc_func)
 Takes a ptrdiff_t size, a KLS_Conf to configure the new Koliseo, and an allocation function pointer.
Koliseo * kls_new_traced_alloc_handled (ptrdiff_t size, const char *output_path, kls_alloc_func alloc_func, KLS_Err_Handlers err_handlers)
 Takes a ptrdiff_t size, a filepath for the trace output file, and an allocation function pointer.
Koliseo * kls_new_traced_alloc (ptrdiff_t size, const char *output_path, kls_alloc_func alloc_func)
 Takes a ptrdiff_t size, a filepath for the trace output file, and an allocation function pointer.
Koliseo * kls_new_dbg_alloc_handled (ptrdiff_t size, kls_alloc_func alloc_func, KLS_Err_Handlers err_handlers)
 Takes a ptrdiff_t size and an allocation function pointer, and returns a pointer to the prepared Koliseo.
Koliseo * kls_new_dbg_alloc (ptrdiff_t size, kls_alloc_func alloc_func)
 Takes a ptrdiff_t size and an allocation function pointer, and returns a pointer to the prepared Koliseo.
int kls__check_available_failable (Koliseo *kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count, const char *caller_name)
 Takes a Koliseo, a ptrdiff_t size, align and count, and a caller name.
void * kls_push (Koliseo *kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count)
 Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.
void * kls_push_zero (Koliseo *kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count)
 Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.
void * kls_push_zero_ext (Koliseo *kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count)
 Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.
void * kls_temp_push_zero_ext (Koliseo_Temp *t_kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count)
 Takes a Koliseo_Temp, and ptrdiff_t values for size, align and count.
void print_kls_2file (FILE *fp, const Koliseo *kls)
 Prints header fields from the passed Koliseo pointer, to the passed FILE pointer.
void print_dbg_kls (const Koliseo *kls)
 Prints header fields from the passed Koliseo pointer, to stderr.
void print_temp_kls_2file (FILE *fp, const Koliseo_Temp *t_kls)
 Prints header fields from the passed Koliseo_Temp pointer, to the passed FILE pointer.
void print_dbg_temp_kls (const Koliseo_Temp *t_kls)
 Prints header fields from the passed Koliseo_Temp pointer, to stderr.
void kls_formatSize (ptrdiff_t size, char *outputBuffer, size_t bufferSize)
 Converts a ptrdiff_t size to human-readable SI units (modulo 1000).
void kls_clear (Koliseo *kls)
 Resets the offset field for the passed Koliseo pointer.
void kls_free (Koliseo *kls)
 Calls kls_clear() on the passed Koliseo pointer and the frees the actual Koliseo.
Koliseo_Temp * kls_temp_start (Koliseo *kls)
 Starts a new savestate for the passed Koliseo pointer, by initialising its Koliseo_Temp pointer and returning it.
void kls_temp_end (Koliseo_Temp *tmp_kls)
 Ends passed Koliseo_Temp pointer.
void * kls_pop (Koliseo *kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count)
 Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.
void * kls_pop_AR (Koliseo *kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count)
 Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.
void * kls_temp_pop (Koliseo_Temp *t_kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count)
 Takes a Koliseo_Temp, and ptrdiff_t values for size, align and count.
void * kls_temp_pop_AR (Koliseo_Temp *t_kls, ptrdiff_t size, ptrdiff_t align, ptrdiff_t count)
 Takes a Koliseo_Temp, and ptrdiff_t values for size, align and count.
char * kls_strdup (Koliseo *kls, char *source)
 Function to dupe a C string to a Koliseo, and return a pointer to the allocated string.
char ** kls_strdup_arr (Koliseo *kls, size_t count, char **source)
 Function to dupe a C string array to a Koliseo, and return a pointer to the allocated array.
char * kls_t_strdup (Koliseo_Temp *t_kls, char *source)
 Function to dupe a C string to a Koliseo_Temp, and return a pointer to the allocated string.
char ** kls_t_strdup_arr (Koliseo_Temp *t_kls, size_t count, char **source)
 Function to dupe a C string array to a Koliseo_Temp, and return a pointer to the allocated array.

Variables

KLS_Conf KLS_DEFAULT_CONF
 Config used by any new Koliseo by default.
KLS_Stats KLS_STATS_DEFAULT

Function Documentation

◆ int_koliseo_version()

int int_koliseo_version ( void )

Returns the constant int representing current version for Koliseo.

Returns
A constant int in numeric format for current Koliseo version.

◆ kls__check_available_failable()

int kls__check_available_failable ( Koliseo * kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count,
const char * caller_name )

Takes a Koliseo, a ptrdiff_t size, align and count, and a caller name.

Checks if the passed Koliseo can fit the requested allocation. In case of errors, tries calling the appropriate handler.

Parameters
klsThe Koliseo to check space for.
sizeThe size of the type to allocate.
alignThe alignment of the type to allocate.
countThe count of allocations.
caller_nameName for caller. Used for error reporting.
Returns
0 for success, other values for errors. May exit of some errors without a custom handler.
See also
Koliseo

◆ kls_clear()

void kls_clear ( Koliseo * kls)

Resets the offset field for the passed Koliseo pointer.

Notably, it sets the prev_offset field to the previous offset, thus remembering where last allocation was before the clear.

Parameters
klsThe Koliseo at hand.

◆ kls_conf_init()

KLS_Conf kls_conf_init ( int autoset_regions,
int alloc_backend,
ptrdiff_t reglist_kls_size,
int autoset_temp_regions,
int collect_stats,
int verbose_lvl,
int block_while_has_temp,
int allow_zerocount_push,
FILE * log_fp,
const char * log_filepath )

Used to prepare a KLS_Conf without caring about KOLISEO_HAS_REGIONS.

See also
KLS_Conf

◆ kls_conf_init_handled()

KLS_Conf kls_conf_init_handled ( int autoset_regions,
int alloc_backend,
ptrdiff_t reglist_kls_size,
int autoset_temp_regions,
int collect_stats,
int verbose_lvl,
int block_while_has_temp,
int allow_zerocount_push,
FILE * log_fp,
const char * log_filepath,
KLS_Err_Handlers err_handlers )

Used to prepare a KLS_Conf without caring about KOLISEO_HAS_REGIONS.

Passes custom error handlers for errors in push calls.

See also
KLS_Conf

◆ kls_dbg_features()

void kls_dbg_features ( void )

Prints enabled Koliseo features to stderr.

◆ kls_formatSize()

void kls_formatSize ( ptrdiff_t size,
char * outputBuffer,
size_t bufferSize )

Converts a ptrdiff_t size to human-readable SI units (modulo 1000).

Fills outputBuffer with the converted string.

Parameters
sizeThe size at hand.
outputBufferThe output buffer.
bufferSizeThe output buffer size.

◆ kls_free()

void kls_free ( Koliseo * kls)

Calls kls_clear() on the passed Koliseo pointer and the frees the actual Koliseo.

Parameters
klsThe Koliseo at hand.
See also
kls_clear()

◆ kls_get_pos()

ptrdiff_t kls_get_pos ( const Koliseo * kls)

Returns the current offset (position of pointer bumper) for the passed Koliseo.

Parameters
klsThe Koliseo at hand.
Returns
A ptrdiff_t value for current position.

◆ kls_log()

void kls_log ( Koliseo * kls,
const char * tag,
const char * format,
... )

Logs a message to the log_fp FILE field of the passed Koliseo pointer, if its conf.kls_verbose_lvl is >0.

Parameters
klsThe Koliseo pointer hosting the log_fp FILE pointer.
tagTag for a message.
formatThe message format string.

◆ kls_new_alloc()

Koliseo * kls_new_alloc ( ptrdiff_t size,
kls_alloc_func alloc_func )

Takes a ptrdiff_t size and a function pointer to the allocation function.

Allocates the backing memory for a Koliseo. Sets the KLS_Conf field to KLS_DEFAULT_CONF. Sets the fields with appropriate values if memory allocation was successful, goes to exit() otherwise.

Parameters
sizeThe size for Koliseo data field.
alloc_funcThe allocation function to use to init the Koliseo.
Returns
A pointer to the initialised Koliseo struct.
See also
Koliseo
Koliseo_Temp
KLS_DEFAULT_CONF
kls_new()
kls_temp_start()
kls_temp_end()

◆ kls_new_alloc_ext()

Koliseo * kls_new_alloc_ext ( ptrdiff_t size,
kls_alloc_func alloc_func,
KLS_Hooks ext_handlers,
void * user )

Takes a ptrdiff_t size and a function pointer to the allocation function.

Additional arguments are for extensions. Allocates the backing memory for a Koliseo. Sets the KLS_Conf field to KLS_DEFAULT_CONF. Sets the fields with appropriate values if memory allocation was successful, goes to exit() otherwise.

Parameters
sizeThe size for Koliseo data field.
alloc_funcThe allocation function to use to init the Koliseo.
Returns
A pointer to the initialised Koliseo struct.
See also
Koliseo
Koliseo_Temp
KLS_DEFAULT_CONF
KLS_Hooks
kls_new()
kls_temp_start()
kls_temp_end()

◆ kls_new_conf_alloc()

Koliseo * kls_new_conf_alloc ( ptrdiff_t size,
KLS_Conf conf,
kls_alloc_func alloc_func )

Takes a ptrdiff_t size, a KLS_Conf to configure the new Koliseo, and an allocation function pointer.

Additional arguments are for extensions. Calls kls_new_alloc() to initialise the Koliseo, then calls kls_set_conf() to update the config. Returns the new Koliseo.

Parameters
sizeThe size for Koliseo data field.
confThe KLS_Conf for the new Koliseo.
alloc_funcThe allocation function to use.
Returns
A pointer to the initialised Koliseo struct, with wanted config.
See also
Koliseo
KLS_Conf
KLS_DEFAULT_CONF
kls_new_alloc()
kls_set_conf()

◆ kls_new_conf_alloc_ext()

Koliseo * kls_new_conf_alloc_ext ( ptrdiff_t size,
KLS_Conf conf,
kls_alloc_func alloc_func,
KLS_Hooks ext_handlers,
void * user )

Takes a ptrdiff_t size, a KLS_Conf to configure the new Koliseo, and an allocation function pointer.

Additional arguments are for extensions. Calls kls_new_alloc() to initialise the Koliseo, then calls kls_set_conf() to update the config. Returns the new Koliseo.

Parameters
sizeThe size for Koliseo data field.
confThe KLS_Conf for the new Koliseo.
alloc_funcThe allocation function to use.
Returns
A pointer to the initialised Koliseo struct, with wanted config.
See also
Koliseo
KLS_Conf
KLS_DEFAULT_CONF
kls_new_alloc_ext()
kls_set_conf()

◆ kls_new_dbg_alloc()

Koliseo * kls_new_dbg_alloc ( ptrdiff_t size,
kls_alloc_func alloc_func )

Takes a ptrdiff_t size and an allocation function pointer, and returns a pointer to the prepared Koliseo.

Calls kls_new_conf_alloc() to initialise the Koliseo with the proper config for a debug Koliseo (printing to stderr).

Parameters
sizeThe size for Koliseo data field.
alloc_funcThe allocation function to use.
Returns
A pointer to the initialised Koliseo struct, with wanted config.
See also
Koliseo
KLS_Conf
kls_new_conf()

◆ kls_new_dbg_alloc_handled()

Koliseo * kls_new_dbg_alloc_handled ( ptrdiff_t size,
kls_alloc_func alloc_func,
KLS_Err_Handlers err_handlers )

Takes a ptrdiff_t size and an allocation function pointer, and returns a pointer to the prepared Koliseo.

Calls kls_new_conf_alloc() to initialise the Koliseo with the proper config for a debug Koliseo (printing to stderr).

Parameters
sizeThe size for Koliseo data field.
alloc_funcThe allocation function to use.
err_handlersThe error handlers for errors in push calls.
Returns
A pointer to the initialised Koliseo struct, with wanted config.
See also
Koliseo
KLS_Conf
kls_new_conf()

◆ kls_new_traced_alloc()

Koliseo * kls_new_traced_alloc ( ptrdiff_t size,
const char * output_path,
kls_alloc_func alloc_func )

Takes a ptrdiff_t size, a filepath for the trace output file, and an allocation function pointer.

Returns a pointer to the prepared Koliseo. Calls kls_new_conf_alloc() to initialise the Koliseo with the proper config for a traced Koliseo, logging to the passed filepath.

Parameters
sizeThe size for Koliseo data field.
output_pathThe filepath for log output.
alloc_funcThe allocation function to use.
Returns
A pointer to the initialised Koliseo struct, with wanted config.
See also
Koliseo
KLS_Conf
kls_new_conf_alloc()

◆ kls_new_traced_alloc_handled()

Koliseo * kls_new_traced_alloc_handled ( ptrdiff_t size,
const char * output_path,
kls_alloc_func alloc_func,
KLS_Err_Handlers err_handlers )

Takes a ptrdiff_t size, a filepath for the trace output file, and an allocation function pointer.

Returns a pointer to the prepared Koliseo. Calls kls_new_conf_alloc() to initialise the Koliseo with the proper config for a traced Koliseo, logging to the passed filepath.

Parameters
sizeThe size for Koliseo data field.
output_pathThe filepath for log output.
alloc_funcThe allocation function to use.
err_handlersThe error handlers struct for errors in push calls.
Returns
A pointer to the initialised Koliseo struct, with wanted config.
See also
Koliseo
KLS_Conf
kls_new_conf_alloc()

◆ KLS_OOM_default_handler__()

void KLS_OOM_default_handler__ ( Koliseo * kls,
ptrdiff_t available,
ptrdiff_t padding,
ptrdiff_t size,
ptrdiff_t count )

Used internally for handling Out-Of-Memory in push calls when no user handler is provided.

Parameters
klsThe Koliseo used in the push call
availableThe Koliseo's available memory
paddingThe current push call's padding
sizeThe current push call's size
countThe current push call's count
See also
KLS_Conf

◆ kls_pop()

void * kls_pop ( Koliseo * kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count )

Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.

Tries popping the specified amount of memory from the Koliseo data field, marking it as free (as far as Koliseo is concerned), or goes to exit() if the operation fails.

Parameters
klsThe Koliseo at hand.
sizeThe size for data to pop.
alignThe alignment for data to pop.
countThe multiplicative quantity to scale data size to pop for.
Returns
A void pointer to the start of memory just popped from the Koliseo.

◆ kls_pop_AR()

void * kls_pop_AR ( Koliseo * kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count )

Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.

Tries popping the specified amount of memory from the Koliseo data field, marking it as free (as far as Koliseo is concerned), or goes to exit() if the operation fails.

Parameters
klsThe Koliseo at hand.
sizeThe size for data to pop.
alignThe alignment for data to pop.
countThe multiplicative quantity to scale data size to pop for.
Returns
A void pointer to the start of memory just popped from the Koliseo.

◆ KLS_PTRDIFF_MAX_default_handler__()

void KLS_PTRDIFF_MAX_default_handler__ ( struct Koliseo * kls,
ptrdiff_t size,
ptrdiff_t count )

◆ kls_push()

void * kls_push ( Koliseo * kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count )

Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.

Tries pushing the specified amount of memory to the Koliseo data field, or goes to exit() if the operation fails. Notably, it does NOT zero the memory region.

Parameters
klsThe Koliseo at hand.
sizeThe size for data to push.
alignThe alignment for data to push.
countThe multiplicative quantity to scale data size to push for.
Returns
A void pointer to the start of memory just pushed to the Koliseo, or NULL for errors.

◆ kls_push_zero()

void * kls_push_zero ( Koliseo * kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count )

Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.

Tries pushing the specified amount of memory to the Koliseo data field, or goes to exit() if the operation fails. Notably, it zeroes the memory region.

Parameters
klsThe Koliseo at hand.
sizeThe size for data to push.
alignThe alignment for data to push.
countThe multiplicative quantity to scale data size to push for.
Returns
A void pointer to the start of memory just pushed to the Koliseo, or NULL for errors.

◆ kls_push_zero_ext()

void * kls_push_zero_ext ( Koliseo * kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count )

Takes a Koliseo pointer, and ptrdiff_t values for size, align and count.

Tries pushing the specified amount of memory to the Koliseo data field, or goes to exit() if the operation fails. Notably, it zeroes the memory region.

Parameters
klsThe Koliseo at hand.
sizeThe size for data to push.
alignThe alignment for data to push.
countThe multiplicative quantity to scale data size to push for.
Returns
A void pointer to the start of memory just pushed to the Koliseo, or NULL for errors.

◆ kls_strdup()

char * kls_strdup ( Koliseo * kls,
char * source )

Function to dupe a C string to a Koliseo, and return a pointer to the allocated string.

Unsafe, do not use.

See also
KLS_PUSH_STR()
KLS__STRCPY()

◆ kls_strdup_arr()

char ** kls_strdup_arr ( Koliseo * kls,
size_t count,
char ** source )

Function to dupe a C string array to a Koliseo, and return a pointer to the allocated array.

Unsafe, do not use.

See also
KLS_STRDUP()
KLS__STRCPY()

◆ kls_t_strdup()

char * kls_t_strdup ( Koliseo_Temp * t_kls,
char * source )

Function to dupe a C string to a Koliseo_Temp, and return a pointer to the allocated string.

Unsafe, do not use.

See also
KLS_PUSH_STR_T()
KLS__STRCPY()

◆ kls_t_strdup_arr()

char ** kls_t_strdup_arr ( Koliseo_Temp * t_kls,
size_t count,
char ** source )

Function to dupe a C string array to a Koliseo_Temp, and return a pointer to the allocated array.

Unsafe, do not use.

See also
KLS_STRDUP_T()
KLS__STRCPY()

◆ kls_temp_end()

void kls_temp_end ( Koliseo_Temp * tmp_kls)

Ends passed Koliseo_Temp pointer.

Parameters
tmp_klsThe Koliseo_Temp at hand.

◆ kls_temp_pop()

void * kls_temp_pop ( Koliseo_Temp * t_kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count )

Takes a Koliseo_Temp, and ptrdiff_t values for size, align and count.

Tries popping the specified amount of memory from the Koliseo data field, marking it as free (as far as Koliseo is concerned), or goes to exit() if the operation fails.

Parameters
t_klsThe Koliseo_Temp at hand.
sizeThe size for data to pop.
alignThe alignment for data to pop.
countThe multiplicative quantity to scale data size to pop for.
Returns
A void pointer to the start of memory just popped from the referred Koliseo.

◆ kls_temp_pop_AR()

void * kls_temp_pop_AR ( Koliseo_Temp * t_kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count )

Takes a Koliseo_Temp, and ptrdiff_t values for size, align and count.

Tries popping the specified amount of memory from the Koliseo data field, marking it as free (as far as Koliseo is concerned), or goes to exit() if the operation fails.

Parameters
t_klsThe Koliseo_Temp at hand.
sizeThe size for data to pop.
alignThe alignment for data to pop.
countThe multiplicative quantity to scale data size to pop for.
Returns
A void pointer to the start of memory just popped from the referred Koliseo.

◆ kls_temp_push_zero_ext()

void * kls_temp_push_zero_ext ( Koliseo_Temp * t_kls,
ptrdiff_t size,
ptrdiff_t align,
ptrdiff_t count )

Takes a Koliseo_Temp, and ptrdiff_t values for size, align and count.

Tries pushing the specified amount of memory to the referred Koliseo data field, or goes to exit() if the operation fails. Notably, it zeroes the memory region. Will be removed in 0.6, leaving kls_temp_push_zero_ext() as its replacement.

Parameters
t_klsThe Koliseo_Temp at hand.
sizeThe size for data to push.
alignThe alignment for data to push.
countThe multiplicative quantity to scale data size to push for.
Returns
A void pointer to the start of memory just pushed to the referred Koliseo.

◆ kls_temp_start()

Koliseo_Temp * kls_temp_start ( Koliseo * kls)

Starts a new savestate for the passed Koliseo pointer, by initialising its Koliseo_Temp pointer and returning it.

Notably, you should not use the original while using the copy.

Parameters
klsThe Koliseo at hand.
Returns
A Koliseo_Temp struct.
See also
Koliseo_Temp

◆ KLS_ZEROCOUNT_default_handler__()

void KLS_ZEROCOUNT_default_handler__ ( Koliseo * kls,
ptrdiff_t available,
ptrdiff_t padding,
ptrdiff_t size )

Used internally for handling zero-count in push calls when no user handler is provided.

By default, it goes to exit().

Parameters
klsThe Koliseo used in the push call
availableThe Koliseo's available memory
paddingThe current push call's padding
sizeThe current push call's size
See also
KLS_Conf

◆ print_dbg_kls()

void print_dbg_kls ( const Koliseo * kls)

Prints header fields from the passed Koliseo pointer, to stderr.

Parameters
klsThe Koliseo at hand.

◆ print_dbg_temp_kls()

void print_dbg_temp_kls ( const Koliseo_Temp * t_kls)

Prints header fields from the passed Koliseo_Temp pointer, to stderr.

Parameters
t_klsThe Koliseo_Temp at hand.

◆ print_kls_2file()

void print_kls_2file ( FILE * fp,
const Koliseo * kls )

Prints header fields from the passed Koliseo pointer, to the passed FILE pointer.

Parameters
fpThe FILE pointer to print to.
klsThe Koliseo at hand.

◆ print_temp_kls_2file()

void print_temp_kls_2file ( FILE * fp,
const Koliseo_Temp * t_kls )

Prints header fields from the passed Koliseo_Temp pointer, to the passed FILE pointer.

Parameters
fpThe FILE pointer to print to.
t_klsThe Koliseo_Temp at hand.

◆ string_koliseo_version()

const char * string_koliseo_version ( void )

Returns the constant string representing current version for Koliseo.

Returns
A constant string in MAJOR-MINOR-PATCH format for current Koliseo version.

Variable Documentation

◆ KLS_DEFAULT_CONF

KLS_Conf KLS_DEFAULT_CONF
Initial value:
= {
.kls_collect_stats = 0,
.kls_verbose_lvl = 0,
.kls_block_while_has_temp = 1,
.kls_allow_zerocount_push = 0,
.kls_log_fp = NULL,
.kls_log_filepath = "",
.err_handlers = {
.OOM_handler = &KLS_OOM_default_handler__,
.PTRDIFF_MAX_handler = &KLS_PTRDIFF_MAX_default_handler__,
.ZEROCOUNT_handler = &KLS_ZEROCOUNT_default_handler__,
},
}
void KLS_PTRDIFF_MAX_default_handler__(struct Koliseo *kls, ptrdiff_t size, ptrdiff_t count)
Definition koliseo.c:102
void KLS_ZEROCOUNT_default_handler__(Koliseo *kls, ptrdiff_t available, ptrdiff_t padding, ptrdiff_t size)
Used internally for handling zero-count in push calls when no user handler is provided.
Definition koliseo.c:144
void KLS_OOM_default_handler__(Koliseo *kls, ptrdiff_t available, ptrdiff_t padding, ptrdiff_t size, ptrdiff_t count)
Used internally for handling Out-Of-Memory in push calls when no user handler is provided.
Definition koliseo.c:82

Config used by any new Koliseo by default.

◆ KLS_STATS_DEFAULT

KLS_Stats KLS_STATS_DEFAULT
Initial value:
= {
.tot_pushes = 0,
.tot_temp_pushes = 0,
.tot_pops = 0,
.tot_temp_pops = 0,
.tot_logcalls = 0,
.tot_hiccups = 0,
.worst_pushcall_time = -1,
}