@@ -50,7 +50,8 @@ git_reference *git_reference__alloc_symbolic(
5050{
5151 git_reference * ref ;
5252
53- assert (name && target );
53+ GIT_ASSERT_ARG_WITH_RETVAL (name , NULL );
54+ GIT_ASSERT_ARG_WITH_RETVAL (target , NULL );
5455
5556 ref = alloc_ref (name );
5657 if (!ref )
@@ -73,7 +74,8 @@ git_reference *git_reference__alloc(
7374{
7475 git_reference * ref ;
7576
76- assert (name && oid );
77+ GIT_ASSERT_ARG_WITH_RETVAL (name , NULL );
78+ GIT_ASSERT_ARG_WITH_RETVAL (oid , NULL );
7779
7880 ref = alloc_ref (name );
7981 if (!ref )
@@ -94,7 +96,8 @@ git_reference *git_reference__realloc(
9496 size_t namelen , reflen ;
9597 git_reference * rewrite = NULL ;
9698
97- assert (ptr_to_ref && name );
99+ GIT_ASSERT_ARG_WITH_RETVAL (ptr_to_ref , NULL );
100+ GIT_ASSERT_ARG_WITH_RETVAL (name , NULL );
98101
99102 namelen = strlen (name );
100103
@@ -215,7 +218,9 @@ int git_reference_lookup_resolved(
215218 git_refdb * refdb ;
216219 int error = 0 ;
217220
218- assert (ref_out && repo && name );
221+ GIT_ASSERT_ARG (ref_out );
222+ GIT_ASSERT_ARG (repo );
223+ GIT_ASSERT_ARG (name );
219224
220225 if ((error = reference_normalize_for_repo (normalized , repo , name , true)) < 0 ||
221226 (error = git_repository_refdb__weakptr (& refdb , repo )) < 0 ||
@@ -307,25 +312,25 @@ int git_reference_dwim(git_reference **out, git_repository *repo, const char *re
307312 */
308313git_reference_t git_reference_type (const git_reference * ref )
309314{
310- assert (ref );
315+ GIT_ASSERT_ARG (ref );
311316 return ref -> type ;
312317}
313318
314319const char * git_reference_name (const git_reference * ref )
315320{
316- assert (ref );
321+ GIT_ASSERT_ARG_WITH_RETVAL (ref , NULL );
317322 return ref -> name ;
318323}
319324
320325git_repository * git_reference_owner (const git_reference * ref )
321326{
322- assert (ref );
327+ GIT_ASSERT_ARG_WITH_RETVAL (ref , NULL );
323328 return ref -> db -> repo ;
324329}
325330
326331const git_oid * git_reference_target (const git_reference * ref )
327332{
328- assert (ref );
333+ GIT_ASSERT_ARG_WITH_RETVAL (ref , NULL );
329334
330335 if (ref -> type != GIT_REFERENCE_DIRECT )
331336 return NULL ;
@@ -335,7 +340,7 @@ const git_oid *git_reference_target(const git_reference *ref)
335340
336341const git_oid * git_reference_target_peel (const git_reference * ref )
337342{
338- assert (ref );
343+ GIT_ASSERT_ARG_WITH_RETVAL (ref , NULL );
339344
340345 if (ref -> type != GIT_REFERENCE_DIRECT || git_oid_is_zero (& ref -> peel ))
341346 return NULL ;
@@ -345,7 +350,7 @@ const git_oid *git_reference_target_peel(const git_reference *ref)
345350
346351const char * git_reference_symbolic_target (const git_reference * ref )
347352{
348- assert (ref );
353+ GIT_ASSERT_ARG_WITH_RETVAL (ref , NULL );
349354
350355 if (ref -> type != GIT_REFERENCE_SYMBOLIC )
351356 return NULL ;
@@ -370,8 +375,9 @@ static int reference__create(
370375 git_reference * ref = NULL ;
371376 int error = 0 ;
372377
373- assert (repo && name );
374- assert (symbolic || signature );
378+ GIT_ASSERT_ARG (repo );
379+ GIT_ASSERT_ARG (name );
380+ GIT_ASSERT_ARG (symbolic || signature );
375381
376382 if (ref_out )
377383 * ref_out = NULL ;
@@ -385,7 +391,7 @@ static int reference__create(
385391 return error ;
386392
387393 if (oid != NULL ) {
388- assert (symbolic == NULL );
394+ GIT_ASSERT (symbolic == NULL );
389395
390396 if (!git_object__is_valid (repo , oid , GIT_OBJECT_ANY )) {
391397 git_error_set (GIT_ERROR_REFERENCE ,
@@ -457,7 +463,7 @@ int git_reference_create_matching(
457463 int error ;
458464 git_signature * who = NULL ;
459465
460- assert (id );
466+ GIT_ASSERT_ARG (id );
461467
462468 if ((error = git_reference__log_signature (& who , repo )) < 0 )
463469 return error ;
@@ -492,7 +498,7 @@ int git_reference_symbolic_create_matching(
492498 int error ;
493499 git_signature * who = NULL ;
494500
495- assert (target );
501+ GIT_ASSERT_ARG (target );
496502
497503 if ((error = git_reference__log_signature (& who , repo )) < 0 )
498504 return error ;
@@ -533,7 +539,9 @@ int git_reference_set_target(
533539 int error ;
534540 git_repository * repo ;
535541
536- assert (out && ref && id );
542+ GIT_ASSERT_ARG (out );
543+ GIT_ASSERT_ARG (ref );
544+ GIT_ASSERT_ARG (id );
537545
538546 repo = ref -> db -> repo ;
539547
@@ -560,7 +568,9 @@ int git_reference_symbolic_set_target(
560568{
561569 int error ;
562570
563- assert (out && ref && target );
571+ GIT_ASSERT_ARG (out );
572+ GIT_ASSERT_ARG (ref );
573+ GIT_ASSERT_ARG (target );
564574
565575 if ((error = ensure_is_an_updatable_symbolic_reference (ref )) < 0 )
566576 return error ;
@@ -611,7 +621,8 @@ int git_reference_rename(
611621 git_repository * repo ;
612622 int error ;
613623
614- assert (out && ref );
624+ GIT_ASSERT_ARG (out );
625+ GIT_ASSERT_ARG (ref );
615626
616627 repo = git_reference_owner (ref );
617628
@@ -777,7 +788,8 @@ int git_reference_list(
777788{
778789 git_vector ref_list ;
779790
780- assert (array && repo );
791+ GIT_ASSERT_ARG (array );
792+ GIT_ASSERT_ARG (repo );
781793
782794 array -> strings = NULL ;
783795 array -> count = 0 ;
@@ -861,7 +873,8 @@ static bool is_all_caps_and_underscore(const char *name, size_t len)
861873 size_t i ;
862874 char c ;
863875
864- assert (name && len > 0 );
876+ GIT_ASSERT_ARG (name );
877+ GIT_ASSERT_ARG (len > 0 );
865878
866879 for (i = 0 ; i < len ; i ++ )
867880 {
@@ -892,7 +905,7 @@ int git_reference__normalize_name(
892905 git_path_iconv_t ic = GIT_PATH_ICONV_INIT ;
893906#endif
894907
895- assert (name );
908+ GIT_ASSERT_ARG (name );
896909
897910 process_flags = flags ;
898911 current = (char * )name ;
@@ -1041,7 +1054,9 @@ int git_reference_cmp(
10411054 const git_reference * ref2 )
10421055{
10431056 git_reference_t type1 , type2 ;
1044- assert (ref1 && ref2 );
1057+
1058+ GIT_ASSERT_ARG (ref1 );
1059+ GIT_ASSERT_ARG (ref2 );
10451060
10461061 type1 = git_reference_type (ref1 );
10471062 type2 = git_reference_type (ref2 );
@@ -1164,7 +1179,8 @@ int git_reference_has_log(git_repository *repo, const char *refname)
11641179 int error ;
11651180 git_refdb * refdb ;
11661181
1167- assert (repo && refname );
1182+ GIT_ASSERT_ARG (repo );
1183+ GIT_ASSERT_ARG (refname );
11681184
11691185 if ((error = git_repository_refdb__weakptr (& refdb , repo )) < 0 )
11701186 return error ;
@@ -1177,7 +1193,8 @@ int git_reference_ensure_log(git_repository *repo, const char *refname)
11771193 int error ;
11781194 git_refdb * refdb ;
11791195
1180- assert (repo && refname );
1196+ GIT_ASSERT_ARG (repo );
1197+ GIT_ASSERT_ARG (refname );
11811198
11821199 if ((error = git_repository_refdb__weakptr (& refdb , repo )) < 0 )
11831200 return error ;
@@ -1192,7 +1209,7 @@ int git_reference__is_branch(const char *ref_name)
11921209
11931210int git_reference_is_branch (const git_reference * ref )
11941211{
1195- assert (ref );
1212+ GIT_ASSERT_ARG (ref );
11961213 return git_reference__is_branch (ref -> name );
11971214}
11981215
@@ -1203,7 +1220,7 @@ int git_reference__is_remote(const char *ref_name)
12031220
12041221int git_reference_is_remote (const git_reference * ref )
12051222{
1206- assert (ref );
1223+ GIT_ASSERT_ARG (ref );
12071224 return git_reference__is_remote (ref -> name );
12081225}
12091226
@@ -1214,7 +1231,7 @@ int git_reference__is_tag(const char *ref_name)
12141231
12151232int git_reference_is_tag (const git_reference * ref )
12161233{
1217- assert (ref );
1234+ GIT_ASSERT_ARG (ref );
12181235 return git_reference__is_tag (ref -> name );
12191236}
12201237
@@ -1225,7 +1242,7 @@ int git_reference__is_note(const char *ref_name)
12251242
12261243int git_reference_is_note (const git_reference * ref )
12271244{
1228- assert (ref );
1245+ GIT_ASSERT_ARG (ref );
12291246 return git_reference__is_note (ref -> name );
12301247}
12311248
@@ -1247,7 +1264,7 @@ int git_reference_peel(
12471264 git_object * target = NULL ;
12481265 int error ;
12491266
1250- assert (ref );
1267+ GIT_ASSERT_ARG (ref );
12511268
12521269 if (ref -> type == GIT_REFERENCE_DIRECT ) {
12531270 resolved = ref ;
@@ -1339,7 +1356,10 @@ int git_reference__is_unborn_head(bool *unborn, const git_reference *ref, git_re
13391356{
13401357 int error ;
13411358 git_reference * tmp_ref ;
1342- assert (unborn && ref && repo );
1359+
1360+ GIT_ASSERT_ARG (unborn );
1361+ GIT_ASSERT_ARG (ref );
1362+ GIT_ASSERT_ARG (repo );
13431363
13441364 if (ref -> type == GIT_REFERENCE_DIRECT ) {
13451365 * unborn = 0 ;
0 commit comments