@@ -50,7 +50,7 @@ void hashflush(struct hashfile *f)
5050
5151 if (offset ) {
5252 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 );
5454 flush (f , f -> buffer , offset );
5555 f -> offset = 0 ;
5656 }
@@ -73,7 +73,7 @@ int finalize_hashfile(struct hashfile *f, unsigned char *result,
7373 if (f -> skip_hash )
7474 hashclr (f -> buffer , f -> algop );
7575 else
76- f -> algop -> unsafe_final_fn (f -> buffer , & f -> ctx );
76+ f -> algop -> final_fn (f -> buffer , & f -> ctx );
7777
7878 if (result )
7979 hashcpy (result , f -> buffer , f -> algop );
@@ -128,7 +128,7 @@ void hashwrite(struct hashfile *f, const void *buf, unsigned int count)
128128 * f->offset is necessarily zero.
129129 */
130130 if (!f -> skip_hash )
131- f -> algop -> unsafe_update_fn (& f -> ctx , buf , nr );
131+ f -> algop -> update_fn (& f -> ctx , buf , nr );
132132 flush (f , buf , nr );
133133 } else {
134134 /*
@@ -175,8 +175,8 @@ static struct hashfile *hashfd_internal(int fd, const char *name,
175175 f -> do_crc = 0 ;
176176 f -> skip_hash = 0 ;
177177
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 );
180180
181181 f -> buffer_len = buffer_len ;
182182 f -> buffer = xmalloc (buffer_len );
@@ -210,7 +210,7 @@ void hashfile_checkpoint(struct hashfile *f, struct hashfile_checkpoint *checkpo
210210{
211211 hashflush (f );
212212 checkpoint -> offset = f -> total ;
213- f -> algop -> unsafe_clone_fn (& checkpoint -> ctx , & f -> ctx );
213+ f -> algop -> clone_fn (& checkpoint -> ctx , & f -> ctx );
214214}
215215
216216int hashfile_truncate (struct hashfile * f , struct hashfile_checkpoint * checkpoint )
@@ -221,7 +221,7 @@ int hashfile_truncate(struct hashfile *f, struct hashfile_checkpoint *checkpoint
221221 lseek (f -> fd , offset , SEEK_SET ) != offset )
222222 return -1 ;
223223 f -> total = offset ;
224- f -> algop -> unsafe_clone_fn (& f -> ctx , & checkpoint -> ctx );
224+ f -> algop -> clone_fn (& f -> ctx , & checkpoint -> ctx );
225225 f -> offset = 0 ; /* hashflush() was called in checkpoint */
226226 return 0 ;
227227}
@@ -242,15 +242,15 @@ int hashfile_checksum_valid(const unsigned char *data, size_t total_len)
242242{
243243 unsigned char got [GIT_MAX_RAWSZ ];
244244 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 ) ;
246246 size_t data_len = total_len - algop -> rawsz ;
247247
248248 if (total_len < algop -> rawsz )
249249 return 0 ; /* say "too short"? */
250250
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 );
254254
255255 return hasheq (got , data + data_len , algop );
256256}
0 commit comments