@@ -50,7 +50,7 @@ void hashflush(struct hashfile *f)
50
50
51
51
if (offset ) {
52
52
if (!f -> skip_hash )
53
- f -> algop -> unsafe_update_fn (& f -> ctx , f -> buffer , offset );
53
+ f -> algop -> update_fn (& f -> ctx , f -> buffer , offset );
54
54
flush (f , f -> buffer , offset );
55
55
f -> offset = 0 ;
56
56
}
@@ -73,7 +73,7 @@ int finalize_hashfile(struct hashfile *f, unsigned char *result,
73
73
if (f -> skip_hash )
74
74
hashclr (f -> buffer , f -> algop );
75
75
else
76
- f -> algop -> unsafe_final_fn (f -> buffer , & f -> ctx );
76
+ f -> algop -> final_fn (f -> buffer , & f -> ctx );
77
77
78
78
if (result )
79
79
hashcpy (result , f -> buffer , f -> algop );
@@ -128,7 +128,7 @@ void hashwrite(struct hashfile *f, const void *buf, unsigned int count)
128
128
* f->offset is necessarily zero.
129
129
*/
130
130
if (!f -> skip_hash )
131
- f -> algop -> unsafe_update_fn (& f -> ctx , buf , nr );
131
+ f -> algop -> update_fn (& f -> ctx , buf , nr );
132
132
flush (f , buf , nr );
133
133
} else {
134
134
/*
@@ -175,8 +175,8 @@ static struct hashfile *hashfd_internal(int fd, const char *name,
175
175
f -> do_crc = 0 ;
176
176
f -> skip_hash = 0 ;
177
177
178
- f -> algop = the_hash_algo ;
179
- f -> algop -> unsafe_init_fn (& f -> ctx );
178
+ f -> algop = unsafe_hash_algo ( the_hash_algo ) ;
179
+ f -> algop -> init_fn (& f -> ctx );
180
180
181
181
f -> buffer_len = buffer_len ;
182
182
f -> buffer = xmalloc (buffer_len );
@@ -210,7 +210,7 @@ void hashfile_checkpoint(struct hashfile *f, struct hashfile_checkpoint *checkpo
210
210
{
211
211
hashflush (f );
212
212
checkpoint -> offset = f -> total ;
213
- f -> algop -> unsafe_clone_fn (& checkpoint -> ctx , & f -> ctx );
213
+ f -> algop -> clone_fn (& checkpoint -> ctx , & f -> ctx );
214
214
}
215
215
216
216
int hashfile_truncate (struct hashfile * f , struct hashfile_checkpoint * checkpoint )
@@ -221,7 +221,7 @@ int hashfile_truncate(struct hashfile *f, struct hashfile_checkpoint *checkpoint
221
221
lseek (f -> fd , offset , SEEK_SET ) != offset )
222
222
return -1 ;
223
223
f -> total = offset ;
224
- f -> algop -> unsafe_clone_fn (& f -> ctx , & checkpoint -> ctx );
224
+ f -> algop -> clone_fn (& f -> ctx , & checkpoint -> ctx );
225
225
f -> offset = 0 ; /* hashflush() was called in checkpoint */
226
226
return 0 ;
227
227
}
@@ -242,15 +242,15 @@ int hashfile_checksum_valid(const unsigned char *data, size_t total_len)
242
242
{
243
243
unsigned char got [GIT_MAX_RAWSZ ];
244
244
git_hash_ctx ctx ;
245
- const struct git_hash_algo * algop = the_hash_algo ;
245
+ const struct git_hash_algo * algop = unsafe_hash_algo ( the_hash_algo ) ;
246
246
size_t data_len = total_len - algop -> rawsz ;
247
247
248
248
if (total_len < algop -> rawsz )
249
249
return 0 ; /* say "too short"? */
250
250
251
- algop -> unsafe_init_fn (& ctx );
252
- algop -> unsafe_update_fn (& ctx , data , data_len );
253
- algop -> unsafe_final_fn (got , & ctx );
251
+ algop -> init_fn (& ctx );
252
+ algop -> update_fn (& ctx , data , data_len );
253
+ algop -> final_fn (got , & ctx );
254
254
255
255
return hasheq (got , data + data_len , algop );
256
256
}
0 commit comments