@@ -67,7 +67,6 @@ static void free_cache_object(void *o)
6767 git_pack_cache_entry * e = (git_pack_cache_entry * )o ;
6868
6969 if (e != NULL ) {
70- assert (e -> refcount .val == 0 );
7170 git__free (e -> raw .data );
7271 git__free (e );
7372 }
@@ -311,8 +310,9 @@ static int pack_index_open(struct git_pack_file *p)
311310 if (p -> index_version > -1 )
312311 return 0 ;
313312
313+ /* checked by git_pack_file alloc */
314314 name_len = strlen (p -> pack_name );
315- assert (name_len > strlen (".pack" )); /* checked by git_pack_file alloc */
315+ GIT_ASSERT (name_len > strlen (".pack" ));
316316
317317 if (git_buf_init (& idx_name , name_len ) < 0 )
318318 return -1 ;
@@ -372,12 +372,12 @@ static unsigned char *pack_window_open(
372372 * - each byte afterwards: low seven bits are size continuation,
373373 * with the high bit being "size continues"
374374 */
375- size_t git_packfile__object_header (unsigned char * hdr , size_t size , git_object_t type )
375+ int git_packfile__object_header (size_t * out , unsigned char * hdr , size_t size , git_object_t type )
376376{
377377 unsigned char * hdr_base ;
378378 unsigned char c ;
379379
380- assert (type >= GIT_OBJECT_COMMIT && type <= GIT_OBJECT_REF_DELTA );
380+ GIT_ASSERT_ARG (type >= GIT_OBJECT_COMMIT && type <= GIT_OBJECT_REF_DELTA );
381381
382382 /* TODO: add support for chunked objects; see git.git 6c0d19b1 */
383383
@@ -392,7 +392,8 @@ size_t git_packfile__object_header(unsigned char *hdr, size_t size, git_object_t
392392 }
393393 * hdr ++ = c ;
394394
395- return (hdr - hdr_base );
395+ * out = (hdr - hdr_base );
396+ return 0 ;
396397}
397398
398399
@@ -899,7 +900,7 @@ int get_delta_base(
899900 off64_t base_offset ;
900901 git_oid unused ;
901902
902- assert (delta_base_out );
903+ GIT_ASSERT_ARG (delta_base_out );
903904
904905 base_info = pack_window_open (p , w_curs , * curpos , & left );
905906 /* Assumption: the only reason this would fail is because the file is too small */
@@ -1211,8 +1212,7 @@ int git_pack_foreach_entry(
12111212 if ((error = pack_index_open (p )) < 0 )
12121213 return error ;
12131214
1214- assert (p -> index_map .data );
1215-
1215+ GIT_ASSERT (p -> index_map .data );
12161216 index = p -> index_map .data ;
12171217 }
12181218
@@ -1299,7 +1299,8 @@ static int pack_entry_find_offset(
12991299
13001300 if ((error = pack_index_open (p )) < 0 )
13011301 return error ;
1302- assert (p -> index_map .data );
1302+
1303+ GIT_ASSERT (p -> index_map .data );
13031304 }
13041305
13051306 index = p -> index_map .data ;
@@ -1388,7 +1389,7 @@ int git_pack_entry_find(
13881389 git_oid found_oid ;
13891390 int error ;
13901391
1391- assert (p );
1392+ GIT_ASSERT_ARG (p );
13921393
13931394 if (len == GIT_OID_HEXSZ && p -> num_bad_objects ) {
13941395 unsigned i ;
0 commit comments