shithub: git9

Download patch

ref: e5235c87cf09ae0e12a0cadad2bb7305d6f5c47a
parent: 3f582617e0d9d4f6f4e9f1e2cdf6ed218c5afb60
author: Ori Bernstein <ori@eigenstate.org>
date: Tue Nov 26 14:13:51 EST 2019

cleanup: hasheq instead of memcmp.

--- a/fetch.c
+++ b/fetch.c
@@ -177,7 +177,7 @@
 
 	req = 0;
 	for(i = 0; i < nref; i++){
-		if(memcmp(have[i].h, want[i].h, sizeof(have[i].h)) == 0)
+		if(hasheq(&have[i], &want[i]) == 0)
 			continue;
 		if((o = readobject(want[i])) != nil){
 			unref(o);
@@ -190,7 +190,7 @@
 	}
 	flushpkt(fd);
 	for(i = 0; i < nref; i++){
-		if(memcmp(have[i].h, Zhash.h, sizeof(Zhash.h)) == 0)
+		if(hasheq(&have[i], &Zhash) == 0)
 			continue;
 		n = snprint(buf, sizeof(buf), "have %H\n", have[i]);
 		if(writepkt(fd, buf, n + 1) == -1)