From 4148d3d5d450ffc26c720b531c14df5ff478de5c Mon Sep 17 00:00:00 2001 From: Snaipe Date: Fri, 2 Oct 2015 15:10:41 +0200 Subject: [PATCH] [Issue #64] Prefixed all unprefixed API functions and types --- include/criterion/assert.h | 6 +++--- include/criterion/event.h | 2 +- include/criterion/types.h | 2 +- src/compat/process.c | 2 +- src/compat/process.h | 2 +- src/core/abort.c | 2 +- src/core/theories.c | 2 +- src/core/worker.c | 2 +- src/core/worker.h | 2 +- src/core/wrappers/wrap.c | 8 ++++---- src/core/wrappers/wrap.cc | 8 ++++---- src/io/event.c | 2 +- src/string/i18n.c | 2 +- 13 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/criterion/assert.h b/include/criterion/assert.h index c09fa00..444d6a1 100644 --- a/include/criterion/assert.h +++ b/include/criterion/assert.h @@ -72,7 +72,7 @@ enum criterion_assert_messages { CR_BEGIN_C_API -CR_API char *translate_assert_msg(int msg_index, ...); +CR_API char *cr_translate_assert_msg(int msg_index, ...); CR_END_C_API @@ -90,7 +90,7 @@ CR_END_C_API CR_IDENTITY Arg # define CR_TRANSLATE_DEF_MSG_(...) \ - CR_EXPAND(translate_assert_msg( \ + CR_EXPAND(cr_translate_assert_msg( \ CR_VA_HEAD(__VA_ARGS__), \ "" CR_TRANSLATE_DEF_MSG__(CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__))) \ )) @@ -145,7 +145,7 @@ CR_END_C_API stat->file = __FILE__; \ stat->line = __LINE__; \ \ - send_event(ASSERT, stat, bufsize); \ + criterion_send_event(ASSERT, stat, bufsize); \ CR_STDN free(stat); \ \ if (!passed) \ diff --git a/include/criterion/event.h b/include/criterion/event.h index 5138901..6ccc649 100644 --- a/include/criterion/event.h +++ b/include/criterion/event.h @@ -33,7 +33,7 @@ CR_BEGIN_C_API -CR_API void send_event(int kind, void *data, size_t size); +CR_API void criterion_send_event(int kind, void *data, size_t size); CR_END_C_API diff --git a/include/criterion/types.h b/include/criterion/types.h index 3354098..27cecdd 100644 --- a/include/criterion/types.h +++ b/include/criterion/types.h @@ -129,6 +129,6 @@ struct criterion_test_set { size_t tests; }; -typedef void (*f_worker_func)(struct criterion_test *, struct criterion_suite *); +typedef void (*cr_worker_func)(struct criterion_test *, struct criterion_suite *); #endif /* !CRITERION_TYPES_H_ */ diff --git a/src/compat/process.c b/src/compat/process.c index 5b246ac..0839299 100644 --- a/src/compat/process.c +++ b/src/compat/process.c @@ -98,7 +98,7 @@ struct full_context { struct criterion_test_extra_data test_data; struct criterion_suite suite; struct criterion_test_extra_data suite_data; - f_worker_func func; + cr_worker_func func; struct pipe_handle pipe; struct test_single_param param; HANDLE sync; diff --git a/src/compat/process.h b/src/compat/process.h index 103d835..8b965ab 100644 --- a/src/compat/process.h +++ b/src/compat/process.h @@ -40,7 +40,7 @@ typedef struct proc_handle s_proc_handle; struct worker_context { struct criterion_test *test; struct criterion_suite *suite; - f_worker_func func; + cr_worker_func func; struct pipe_handle *pipe; struct test_single_param *param; }; diff --git a/src/core/abort.c b/src/core/abort.c index d8d7c65..0d32188 100644 --- a/src/core/abort.c +++ b/src/core/abort.c @@ -46,7 +46,7 @@ void criterion_test_die(const char *msg, ...) { *buf = res + 1; memcpy(buf + 1, formatted_msg, res + 1); - send_event(TEST_ABORT, buf, sizeof (size_t) + res + 1); + criterion_send_event(TEST_ABORT, buf, sizeof(size_t) + res + 1); free(buf); free(formatted_msg); diff --git a/src/core/theories.c b/src/core/theories.c index 1af29bc..28d0d12 100644 --- a/src/core/theories.c +++ b/src/core/theories.c @@ -222,7 +222,7 @@ void cr_theory_main(struct criterion_datapoints *dps, size_t datapoints, void (* concat_arg(&result.msg, dps, indices, datapoints - 1); result.len = strlen(result.msg) + 1; - send_event(THEORY_FAIL, &result, result.len + sizeof (size_t)); + criterion_send_event(THEORY_FAIL, &result, result.len + sizeof(size_t)); } } diff --git a/src/core/worker.c b/src/core/worker.c index 8049fac..54d6868 100644 --- a/src/core/worker.c +++ b/src/core/worker.c @@ -91,7 +91,7 @@ void run_worker(struct worker_context *ctx) { } struct worker *spawn_test_worker(struct execution_context *ctx, - f_worker_func func, + cr_worker_func func, s_pipe_handle *pipe) { g_worker_context = (struct worker_context) { .test = ctx->test, diff --git a/src/core/worker.h b/src/core/worker.h index 649e3eb..414f374 100644 --- a/src/core/worker.h +++ b/src/core/worker.h @@ -84,7 +84,7 @@ bool is_runner(void); struct process_status wait_proc(struct worker *proc); struct process_status get_status(int status); struct worker *spawn_test_worker(struct execution_context *ctx, - f_worker_func func, + cr_worker_func func, s_pipe_handle *pipe); struct event *worker_read_event(struct worker_set *workers, s_pipe_file_handle *pipe); diff --git a/src/core/wrappers/wrap.c b/src/core/wrappers/wrap.c index 01acf62..38009a2 100644 --- a/src/core/wrappers/wrap.c +++ b/src/core/wrappers/wrap.c @@ -33,11 +33,11 @@ static INLINE void nothing(void) {} void c_wrap(struct criterion_test *test, struct criterion_suite *suite) { - send_event(PRE_INIT, NULL, 0); + criterion_send_event(PRE_INIT, NULL, 0); if (suite->data) (suite->data->init ? suite->data->init : nothing)(); (test->data->init ? test->data->init : nothing)(); - send_event(PRE_TEST, NULL, 0); + criterion_send_event(PRE_TEST, NULL, 0); struct timespec_compat ts; if (!setjmp(g_pre_test)) { @@ -56,10 +56,10 @@ void c_wrap(struct criterion_test *test, struct criterion_suite *suite) { if (!timer_end(&elapsed_time, &ts)) elapsed_time = -1; - send_event(POST_TEST, &elapsed_time, sizeof (double)); + criterion_send_event(POST_TEST, &elapsed_time, sizeof(double)); (test->data->fini ? test->data->fini : nothing)(); if (suite->data) (suite->data->fini ? suite->data->fini : nothing)(); - send_event(POST_FINI, NULL, 0); + criterion_send_event(POST_FINI, NULL, 0); } diff --git a/src/core/wrappers/wrap.cc b/src/core/wrappers/wrap.cc index f6b140a..67eeb93 100644 --- a/src/core/wrappers/wrap.cc +++ b/src/core/wrappers/wrap.cc @@ -38,7 +38,7 @@ static INLINE void nothing(void) {} void cpp_wrap(struct criterion_test *test, struct criterion_suite *suite) { - send_event(PRE_INIT, NULL, 0); + criterion_send_event(PRE_INIT, NULL, 0); try { if (suite->data) (suite->data->init ? suite->data->init : nothing)(); @@ -48,7 +48,7 @@ void cpp_wrap(struct criterion_test *test, struct criterion_suite *suite) { } catch (...) { criterion_test_die("Caught some unexpected exception during the test initialization."); } - send_event(PRE_TEST, NULL, 0); + criterion_send_event(PRE_TEST, NULL, 0); struct timespec_compat ts; if (!setjmp(g_pre_test)) { @@ -73,7 +73,7 @@ void cpp_wrap(struct criterion_test *test, struct criterion_suite *suite) { if (!timer_end(&elapsed_time, &ts)) elapsed_time = -1; - send_event(POST_TEST, &elapsed_time, sizeof (double)); + criterion_send_event(POST_TEST, &elapsed_time, sizeof(double)); try { (test->data->fini ? test->data->fini : nothing)(); if (suite->data) @@ -83,7 +83,7 @@ void cpp_wrap(struct criterion_test *test, struct criterion_suite *suite) { } catch (...) { criterion_test_die("Caught some unexpected exception during the test finalization."); } - send_event(POST_FINI, NULL, 0); + criterion_send_event(POST_FINI, NULL, 0); } diff --git a/src/io/event.c b/src/io/event.c index d7b4dc6..9720426 100644 --- a/src/io/event.c +++ b/src/io/event.c @@ -150,7 +150,7 @@ struct event *read_event(s_pipe_file_handle *f) { } } -void send_event(int kind, void *data, size_t size) { +void criterion_send_event(int kind, void *data, size_t size) { unsigned long long pid = get_process_id(); unsigned char *buf = malloc(sizeof (int) + sizeof (pid) + size); diff --git a/src/string/i18n.c b/src/string/i18n.c index c83a119..ecc2e4d 100644 --- a/src/string/i18n.c +++ b/src/string/i18n.c @@ -8,7 +8,7 @@ void init_i18n(void) { #endif } -char *translate_assert_msg(int msg_index, ...) { +char *cr_translate_assert_msg(int msg_index, ...) { static char *messages[] = { [CRITERION_ASSERT_MSG_FAIL] = N_("The conditions for this assertion were not met."), [CRITERION_ASSERT_MSG_EXPR_FALSE] = N_("The expression %s is false."),