Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
sha1-file: convert constants to uses of the_hash_algo
author
brian m. carlson
<sandals@crustytoothpaste.net>
Mon, 16 Jul 2018 01:28:07 +0000
(
01:28
+0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 16 Jul 2018 21:27:40 +0000
(14:27 -0700)
Convert one use of 20 and several uses of GIT_SHA1_HEXSZ into references
to the_hash_algo.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1-file.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
2ed1960
)
diff --git
a/sha1-file.c
b/sha1-file.c
index de4839e634c02cb7497f05a3a4597b9fa5123e32..1f66b9594f6b8cc4672ea273a7f657b8e29f6905 100644
(file)
--- a/
sha1-file.c
+++ b/
sha1-file.c
@@
-336,7
+336,7
@@
int raceproof_create_file(const char *path, create_file_fn fn, void *cb)
static void fill_sha1_path(struct strbuf *buf, const unsigned char *sha1)
{
int i;
static void fill_sha1_path(struct strbuf *buf, const unsigned char *sha1)
{
int i;
- for (i = 0; i <
20
; i++) {
+ for (i = 0; i <
the_hash_algo->rawsz
; i++) {
static char hex[] = "0123456789abcdef";
unsigned int val = sha1[i];
strbuf_addch(buf, hex[val >> 4]);
static char hex[] = "0123456789abcdef";
unsigned int val = sha1[i];
strbuf_addch(buf, hex[val >> 4]);
@@
-1473,7
+1473,7
@@
void *read_object_with_reference(const struct object_id *oid,
}
ref_length = strlen(ref_type);
}
ref_length = strlen(ref_type);
- if (ref_length +
GIT_SHA1_HEXSZ
> isize ||
+ if (ref_length +
the_hash_algo->hexsz
> isize ||
memcmp(buffer, ref_type, ref_length) ||
get_oid_hex((char *) buffer + ref_length, &actual_oid)) {
free(buffer);
memcmp(buffer, ref_type, ref_length) ||
get_oid_hex((char *) buffer + ref_length, &actual_oid)) {
free(buffer);
@@
-2062,9
+2062,9
@@
int for_each_file_in_obj_subdir(unsigned int subdir_nr,
namelen = strlen(de->d_name);
strbuf_setlen(path, baselen);
strbuf_add(path, de->d_name, namelen);
namelen = strlen(de->d_name);
strbuf_setlen(path, baselen);
strbuf_add(path, de->d_name, namelen);
- if (namelen ==
GIT_SHA1_HEXSZ
- 2 &&
+ if (namelen ==
the_hash_algo->hexsz
- 2 &&
!hex_to_bytes(oid.hash + 1, de->d_name,
!hex_to_bytes(oid.hash + 1, de->d_name,
-
GIT_SHA1_RAWSZ
- 1)) {
+
the_hash_algo->rawsz
- 1)) {
if (obj_cb) {
r = obj_cb(&oid, path->buf, data);
if (r)
if (obj_cb) {
r = obj_cb(&oid, path->buf, data);
if (r)