7 typedef struct XNode XNode;
17 hnode(XNode *ht[], uchar hash[])
21 for(h = ht[hash[0]]; h; h = h->next)
22 if(memcmp(h->hash, hash, HASHSZ) == 0)
25 h = malloc(sizeof(*h));
26 memmove(h->hash, hash, HASHSZ);
29 h->next = ht[hash[0]];
35 * find common ancestor revision ahash for xhash and yhash
36 * in the give hgfs mount point. sets ahash to nullid if
40 ancestor(char *mtpt, uchar xhash[], uchar yhash[], uchar ahash[])
42 XNode *ht[256], *h, *q, *q1, *q2;
43 char buf[MAXPATH], rev[6];
46 if(memcmp(xhash, yhash, HASHSZ) == 0){
47 memmove(ahash, xhash, HASHSZ);
50 if(memcmp(xhash, nullid, HASHSZ) == 0){
51 memmove(ahash, nullid, HASHSZ);
54 if(memcmp(yhash, nullid, HASHSZ) == 0){
55 memmove(ahash, nullid, HASHSZ);
59 memset(ht, 0, sizeof(ht));
77 snprint(buf, sizeof(buf), "%s/%H", mtpt, q->hash);
79 sprint(rev, "rev%d", i);
80 if(readhash(buf, rev, ahash) != 0)
82 if(memcmp(ahash, nullid, HASHSZ) == 0)
86 if(h->mark != q->mark)
96 memmove(ahash, nullid, HASHSZ);
103 for(i=0; i<nelem(ht); i++)