From 1c20e9f76bbe4cccf0e11c927dac00eda3e84ab3 Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 22 Dec 2016 10:44:33 +0000 Subject: [PATCH] Remove tox_options_copy. --- auto_tests/helpers.h | 16 +++++++++------- toxcore/tox.api.h | 6 ------ toxcore/tox.h | 6 ------ toxcore/tox_api.c | 5 ----- 4 files changed, 9 insertions(+), 24 deletions(-) diff --git a/auto_tests/helpers.h b/auto_tests/helpers.h index c3b87caa71..f7af97ce80 100644 --- a/auto_tests/helpers.h +++ b/auto_tests/helpers.h @@ -3,6 +3,7 @@ #include "../toxcore/tox.h" +#include #include #include @@ -50,17 +51,18 @@ static void print_debug_log(Tox *m, TOX_LOG_LEVEL level, const char *path, uint3 Tox *tox_new_log(struct Tox_Options *options, TOX_ERR_NEW *err, void *log_user_data) { - struct Tox_Options *my_options = tox_options_new(NULL); + struct Tox_Options *log_options = tox_options_new(NULL); + assert(log_options != NULL); if (options != NULL) { - tox_options_copy(my_options, options); + // TODO(iphydf): don't dereference Tox_Options pointers, as the type + // will become opaque soon. + *log_options = *options; } - tox_options_set_log_callback(my_options, &print_debug_log); - tox_options_set_log_user_data(my_options, log_user_data); - Tox *tox = tox_new(my_options, err); - tox_options_free(my_options); - return tox; + tox_options_set_log_callback(log_options, &print_debug_log); + tox_options_set_log_user_data(log_options, log_user_data); + return tox_new(log_options, err); } #endif // TOXCORE_TEST_HELPERS_H diff --git a/toxcore/tox.api.h b/toxcore/tox.api.h index f5e8cd7a66..2767a62fc2 100644 --- a/toxcore/tox.api.h +++ b/toxcore/tox.api.h @@ -598,12 +598,6 @@ static class options { MALLOC, } - /** - * Allocates a new $this object and initialises it with the values from the - * passed object. - */ - void copy(const this rhs); - /** * Releases all resources associated with an options objects. diff --git a/toxcore/tox.h b/toxcore/tox.h index 2637806755..5497d9e77a 100644 --- a/toxcore/tox.h +++ b/toxcore/tox.h @@ -726,12 +726,6 @@ typedef enum TOX_ERR_OPTIONS_NEW { */ struct Tox_Options *tox_options_new(TOX_ERR_OPTIONS_NEW *error); -/** - * Allocates a new Tox_Options object and initialises it with the values from the - * passed object. - */ -void tox_options_copy(struct Tox_Options *options, const struct Tox_Options *rhs); - /** * Releases all resources associated with an options objects. * diff --git a/toxcore/tox_api.c b/toxcore/tox_api.c index af93bef40f..b6c8c38618 100644 --- a/toxcore/tox_api.c +++ b/toxcore/tox_api.c @@ -91,11 +91,6 @@ struct Tox_Options *tox_options_new(TOX_ERR_OPTIONS_NEW *error) return NULL; } -void tox_options_copy(struct Tox_Options *lhs, const struct Tox_Options *rhs) -{ - *lhs = *rhs; -} - void tox_options_free(struct Tox_Options *options) { free(options);