103
!match_sha(len, match, next)) {
104
/* unique within this pack */
105
if (!found) {
106
- memcpy(found_sha1, now, 20);
106
+ hashcpy(found_sha1, now);
107
found++;
108
}
109
else if (hashcmp(found_sha1, now)) {
120
}
121
}
122
if (found == 1)
123
- memcpy(sha1, found_sha1, 20);
123
+ hashcpy(sha1, found_sha1);
124
return found;
125
}
126
140
if (1 < has_unpacked || 1 < has_packed)
141
return SHORT_NAME_AMBIGUOUS;
142
if (has_unpacked != has_packed) {
143
- memcpy(sha1, (has_packed ? packed_sha1 : unpacked_sha1), 20);
143
+ hashcpy(sha1, (has_packed ? packed_sha1 : unpacked_sha1));
144
return 0;
145
}
146
/* Both have unique ones -- do they match? */
147
if (hashcmp(packed_sha1, unpacked_sha1))
148
return SHORT_NAME_AMBIGUOUS;
149
- memcpy(sha1, packed_sha1, 20);
149
+ hashcpy(sha1, packed_sha1);
150
return 0;
151
}
152
320
if (parse_commit(commit))
321
return -1;
322
if (!idx) {
323
- memcpy(result, commit->object.sha1, 20);
323
+ hashcpy(result, commit->object.sha1);
324
return 0;
325
}
326
p = commit->parents;
327
while (p) {
328
if (!--idx) {
329
- memcpy(result, p->item->object.sha1, 20);
329
+ hashcpy(result, p->item->object.sha1);
330
return 0;
331
}
332
p = p->next;
347
348
if (!commit || parse_commit(commit) || !commit->parents)
349
return -1;
350
- memcpy(sha1, commit->parents->item->object.sha1, 20);
350
+ hashcpy(sha1, commit->parents->item->object.sha1);
351
}
352
- memcpy(result, sha1, 20);
352
+ hashcpy(result, sha1);
353
return 0;
354
}
355
401
o = deref_tag(o, name, sp - name - 2);
402
if (!o || (!o->parsed && !parse_object(o->sha1)))
403
return -1;
404
- memcpy(sha1, o->sha1, 20);
404
+ hashcpy(sha1, o->sha1);
405
}
406
else {
407
/* At this point, the syntax look correct, so
413
if (!o || (!o->parsed && !parse_object(o->sha1)))
414
return -1;
415
if (o->type == expected_type) {
416
- memcpy(sha1, o->sha1, 20);
416
+ hashcpy(sha1, o->sha1);
417
return 0;
418
}
419
if (o->type == OBJ_TAG)
520
memcmp(ce->name, cp, namelen))
521
break;
522
if (ce_stage(ce) == stage) {
523
- memcpy(sha1, ce->sha1, 20);
523
+ hashcpy(sha1, ce->sha1);
524
return 0;
525
}
526
pos++;