Skip to content

Commit

Permalink
chore: ensure kls_conf_init() keeps its previous signature
Browse files Browse the repository at this point in the history
  • Loading branch information
jgabaut committed Sep 2, 2024
1 parent 9ac3360 commit b632f7b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
13 changes: 12 additions & 1 deletion src/koliseo.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ void KLS_PTRDIFF_MAX_default_handler_dbg__(struct Koliseo* kls, ptrdiff_t size,

/**
* Used to prepare a KLS_Conf without caring about KOLISEO_HAS_REGIONS.
* Passes custom error handlers for errors in push calls.
* @see KLS_Conf
*/
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, FILE* log_fp, const char* log_filepath, KLS_Err_Handlers err_handlers)
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, FILE* log_fp, const char* log_filepath, KLS_Err_Handlers err_handlers)
{
KLS_Conf res = {0};
#ifdef KOLISEO_HAS_REGION
Expand Down Expand Up @@ -232,6 +233,16 @@ KLS_Conf kls_conf_init(int autoset_regions, int alloc_backend, ptrdiff_t reglist
return res;
}

/**
* Used to prepare a KLS_Conf without caring about KOLISEO_HAS_REGIONS.
* @see KLS_Conf
*/
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, FILE* log_fp, const char* log_filepath)
{
KLS_Err_Handlers err_handlers = KLS_DEFAULT_ERR_HANDLERS;
return kls_conf_init_handled(autoset_regions, alloc_backend, reglist_kls_size, autoset_temp_regions, collect_stats, verbose_lvl, block_while_has_temp, log_fp, log_filepath, err_handlers);
}

/**
* Prints enabled Koliseo features to stderr.
*/
Expand Down
4 changes: 3 additions & 1 deletion src/koliseo.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ typedef struct KLS_Conf {
KLS_Err_Handlers err_handlers; /**< Used to pass custom error handlers for push calls.*/
} KLS_Conf;

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, FILE* log_fp, const char* log_filepath, KLS_Err_Handlers err_handlers);
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, FILE* log_fp, const char* log_filepath, KLS_Err_Handlers err_handlers);

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, FILE* log_fp, const char* log_filepath);

void kls_dbg_features(void);

Expand Down
2 changes: 1 addition & 1 deletion static/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(int argc, char **argv)
#endif

int block_usage_with_open_temp = 0;
KLS_Conf kls_config = kls_conf_init(1, KLS_REGLIST_ALLOC_KLS_BASIC, KLS_DEFAULT_SIZE, 1, 1, 1, block_usage_with_open_temp, NULL, "./static/debug_log.txt", KLS_DEFAULT_ERR_HANDLERS);
KLS_Conf kls_config = kls_conf_init(1, KLS_REGLIST_ALLOC_KLS_BASIC, KLS_DEFAULT_SIZE, 1, 1, 1, block_usage_with_open_temp, NULL, "./static/debug_log.txt");
printf("[Init Koliseo] [size: %i]\n", KLS_DEFAULT_SIZE);
Koliseo *kls = kls_new_conf(KLS_DEFAULT_SIZE, kls_config);

Expand Down

0 comments on commit b632f7b

Please sign in to comment.