Commit f2b25261cf3db8324bee7550675fe5ee1336a983

Carlos Martín Nieto 2015-09-13T19:43:55

Merge pull request #3423 from libgit2/cmn/push-tests-inline-oid push: put the git_oid inline in the test structure

diff --git a/tests/online/push.c b/tests/online/push.c
index 0b0892c..efb763c 100644
--- a/tests/online/push.c
+++ b/tests/online/push.c
@@ -299,7 +299,7 @@ static void verify_update_tips_callback(git_remote *remote, expected_ref expecte
 			goto failed;
 		}
 
-		if (git_oid_cmp(expected_refs[i].oid, tip->new_oid) != 0) {
+		if (git_oid_cmp(expected_refs[i].oid, &tip->new_oid) != 0) {
 			git_buf_printf(&msg, "Updated tip ID does not match expected ID");
 			failed = 1;
 			goto failed;
diff --git a/tests/online/push_util.c b/tests/online/push_util.c
index cd483c7..eafec2f 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);
 
diff --git a/tests/online/push_util.h b/tests/online/push_util.h
index 822341b..570873c 100644
--- a/tests/online/push_util.h
+++ b/tests/online/push_util.h
@@ -16,8 +16,8 @@ extern const git_oid OID_ZERO;
 
 typedef struct {
 	char *name;
-	git_oid *old_oid;
-	git_oid *new_oid;
+	git_oid old_oid;
+	git_oid new_oid;
 } updated_tip;
 
 typedef struct {