@@ -228,7 +228,7 @@ int git_tree_entry_dup(git_tree_entry **dest, const git_tree_entry *source)
228228{
229229 git_tree_entry * cpy ;
230230
231- assert (source );
231+ GIT_ASSERT_ARG (source );
232232
233233 cpy = alloc_entry (source -> filename , source -> filename_len , source -> oid );
234234 if (cpy == NULL )
@@ -261,19 +261,19 @@ git_filemode_t git_tree_entry_filemode_raw(const git_tree_entry *entry)
261261
262262const char * git_tree_entry_name (const git_tree_entry * entry )
263263{
264- assert (entry );
264+ GIT_ASSERT_ARG_WITH_RETVAL (entry , NULL );
265265 return entry -> filename ;
266266}
267267
268268const git_oid * git_tree_entry_id (const git_tree_entry * entry )
269269{
270- assert (entry );
270+ GIT_ASSERT_ARG_WITH_RETVAL (entry , NULL );
271271 return entry -> oid ;
272272}
273273
274274git_object_t git_tree_entry_type (const git_tree_entry * entry )
275275{
276- assert (entry );
276+ GIT_ASSERT_ARG_WITH_RETVAL (entry , GIT_OBJECT_INVALID );
277277
278278 if (S_ISGITLINK (entry -> attr ))
279279 return GIT_OBJECT_COMMIT ;
@@ -288,7 +288,9 @@ int git_tree_entry_to_object(
288288 git_repository * repo ,
289289 const git_tree_entry * entry )
290290{
291- assert (entry && object_out );
291+ GIT_ASSERT_ARG (entry );
292+ GIT_ASSERT_ARG (object_out );
293+
292294 return git_object_lookup (object_out , repo , entry -> oid , GIT_OBJECT_ANY );
293295}
294296
@@ -306,15 +308,16 @@ static const git_tree_entry *entry_fromname(
306308const git_tree_entry * git_tree_entry_byname (
307309 const git_tree * tree , const char * filename )
308310{
309- assert (tree && filename );
311+ GIT_ASSERT_ARG_WITH_RETVAL (tree , NULL );
312+ GIT_ASSERT_ARG_WITH_RETVAL (filename , NULL );
310313
311314 return entry_fromname (tree , filename , strlen (filename ));
312315}
313316
314317const git_tree_entry * git_tree_entry_byindex (
315318 const git_tree * tree , size_t idx )
316319{
317- assert (tree );
320+ GIT_ASSERT_ARG_WITH_RETVAL (tree , NULL );
318321 return git_array_get (tree -> entries , idx );
319322}
320323
@@ -324,7 +327,7 @@ const git_tree_entry *git_tree_entry_byid(
324327 size_t i ;
325328 const git_tree_entry * e ;
326329
327- assert (tree );
330+ GIT_ASSERT_ARG_WITH_RETVAL (tree , NULL );
328331
329332 git_array_foreach (tree -> entries , i , e ) {
330333 if (memcmp (& e -> oid -> id , & id -> id , sizeof (id -> id )) == 0 )
@@ -336,13 +339,13 @@ const git_tree_entry *git_tree_entry_byid(
336339
337340size_t git_tree_entrycount (const git_tree * tree )
338341{
339- assert (tree );
342+ GIT_ASSERT_ARG_WITH_RETVAL (tree , 0 );
340343 return tree -> entries .size ;
341344}
342345
343346size_t git_treebuilder_entrycount (git_treebuilder * bld )
344347{
345- assert (bld );
348+ GIT_ASSERT_ARG_WITH_RETVAL (bld , 0 );
346349
347350 return git_strmap_size (bld -> map );
348351}
@@ -626,7 +629,9 @@ int git_tree__write_index(
626629 git_buf shared_buf = GIT_BUF_INIT ;
627630 bool old_ignore_case = false;
628631
629- assert (oid && index && repo );
632+ GIT_ASSERT_ARG (oid );
633+ GIT_ASSERT_ARG (index );
634+ GIT_ASSERT_ARG (repo );
630635
631636 if (git_index_has_conflicts (index )) {
632637 git_error_set (GIT_ERROR_INDEX ,
@@ -680,7 +685,8 @@ int git_treebuilder_new(
680685 git_treebuilder * bld ;
681686 size_t i ;
682687
683- assert (builder_p && repo );
688+ GIT_ASSERT_ARG (builder_p );
689+ GIT_ASSERT_ARG (repo );
684690
685691 bld = git__calloc (1 , sizeof (git_treebuilder ));
686692 GIT_ERROR_CHECK_ALLOC (bld );
@@ -723,7 +729,9 @@ int git_treebuilder_insert(
723729 git_tree_entry * entry ;
724730 int error ;
725731
726- assert (bld && id && filename );
732+ GIT_ASSERT_ARG (bld );
733+ GIT_ASSERT_ARG (id );
734+ GIT_ASSERT_ARG (filename );
727735
728736 if ((error = check_entry (bld -> repo , filename , id , filemode )) < 0 )
729737 return error ;
@@ -751,7 +759,9 @@ int git_treebuilder_insert(
751759
752760static git_tree_entry * treebuilder_get (git_treebuilder * bld , const char * filename )
753761{
754- assert (bld && filename );
762+ GIT_ASSERT_ARG_WITH_RETVAL (bld , NULL );
763+ GIT_ASSERT_ARG_WITH_RETVAL (filename , NULL );
764+
755765 return git_strmap_get (bld -> map , filename );
756766}
757767
@@ -792,8 +802,8 @@ int git_treebuilder_write_with_buffer(git_oid *oid, git_treebuilder *bld, git_bu
792802 git_tree_entry * entry ;
793803 git_vector entries = GIT_VECTOR_INIT ;
794804
795- assert (bld );
796- assert (tree );
805+ GIT_ASSERT_ARG (bld );
806+ GIT_ASSERT_ARG (tree );
797807
798808 git_buf_clear (tree );
799809
@@ -842,7 +852,8 @@ int git_treebuilder_filter(
842852 const char * filename ;
843853 git_tree_entry * entry ;
844854
845- assert (bld && filter );
855+ GIT_ASSERT_ARG (bld );
856+ GIT_ASSERT_ARG (filter );
846857
847858 git_strmap_foreach (bld -> map , filename , entry , {
848859 if (filter (entry , payload )) {
@@ -858,7 +869,7 @@ int git_treebuilder_clear(git_treebuilder *bld)
858869{
859870 git_tree_entry * e ;
860871
861- assert (bld );
872+ GIT_ASSERT_ARG (bld );
862873
863874 git_strmap_foreach_value (bld -> map , e , git_tree_entry_free (e ));
864875 git_strmap_clear (bld -> map );
@@ -1174,10 +1185,10 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
11741185
11751186 for (j = 0 ; j < steps_up ; j ++ ) {
11761187 tree_stack_entry * current , * popped = git_array_pop (stack );
1177- assert (popped );
1188+ GIT_ASSERT (popped );
11781189
11791190 current = git_array_last (stack );
1180- assert (current );
1191+ GIT_ASSERT (current );
11811192
11821193 if ((error = create_popped_tree (current , popped , & component )) < 0 )
11831194 goto cleanup ;
0 commit comments