Skip to content

Commit

Permalink
Remove tox_options_copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Dec 22, 2016
1 parent db71602 commit 1c20e9f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 24 deletions.
16 changes: 9 additions & 7 deletions auto_tests/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "../toxcore/tox.h"

#include <assert.h>
#include <check.h>
#include <stdio.h>

Expand Down Expand Up @@ -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
6 changes: 0 additions & 6 deletions toxcore/tox.api.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 0 additions & 6 deletions toxcore/tox.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
5 changes: 0 additions & 5 deletions toxcore/tox_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1c20e9f

Please sign in to comment.