diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-09-13 05:38:29 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-09-13 05:38:29 +0200 |
commit | 1af5aecb965817901fa9134222bad4e0579de7a4 (patch) | |
tree | 1fc5ca4d9ae7504034aaf54abeb90c25cb68f21b /tests/online/push_util.c | |
parent | dc5b678fda918386f01630d2bc928edb546ac4f2 (diff) | |
download | libgit2-cmn/push-tests-inline-oid.tar.gz |
push: put the git_oid inline in the test structurecmn/push-tests-inline-oid
These are small pieces of data, so there is no advantage to allocating
them separately. Include the two ids inline in the struct we use to
check that the expected and actual ids match.
Diffstat (limited to 'tests/online/push_util.c')
-rw-r--r-- | tests/online/push_util.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/online/push_util.c b/tests/online/push_util.c index cd483c7c0..eafec2f05 100644 --- a/tests/online/push_util.c +++ b/tests/online/push_util.c @@ -9,8 +9,6 @@ const git_oid OID_ZERO = {{ 0 }}; void updated_tip_free(updated_tip *t) { git__free(t->name); - git__free(t->old_oid); - git__free(t->new_oid); git__free(t); } @@ -46,14 +44,11 @@ int record_update_tips_cb(const char *refname, const git_oid *a, const git_oid * updated_tip *t; record_callbacks_data *record_data = (record_callbacks_data *)data; - cl_assert(t = git__malloc(sizeof(*t))); + cl_assert(t = git__calloc(1, sizeof(*t))); cl_assert(t->name = git__strdup(refname)); - cl_assert(t->old_oid = git__malloc(sizeof(*t->old_oid))); - git_oid_cpy(t->old_oid, a); - - cl_assert(t->new_oid = git__malloc(sizeof(*t->new_oid))); - git_oid_cpy(t->new_oid, b); + git_oid_cpy(&t->old_oid, a); + git_oid_cpy(&t->new_oid, b); git_vector_insert(&record_data->updated_tips, t); |