[PATCH 09/35] remote: convert check_push_refs to use struct refspec

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Convert 'check_push_refs()' to use 'struct refspec'.

Signed-off-by: Brandon Williams <bmwill@xxxxxxxxxx>
---
 remote.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/remote.c b/remote.c
index 89820c476..191855118 100644
--- a/remote.c
+++ b/remote.c
@@ -1282,12 +1282,14 @@ static void prepare_ref_index(struct string_list *ref_index, struct ref *ref)
  */
 int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names)
 {
-	struct refspec_item *refspec = parse_push_refspec(nr_refspec, refspec_names);
+	struct refspec refspec = REFSPEC_INIT_PUSH;
 	int ret = 0;
 	int i;
 
-	for (i = 0; i < nr_refspec; i++) {
-		struct refspec_item *rs = refspec + i;
+	refspec_appendn(&refspec, refspec_names, nr_refspec);
+
+	for (i = 0; i < refspec.nr; i++) {
+		struct refspec_item *rs = &refspec.items[i];
 
 		if (rs->pattern || rs->matching)
 			continue;
@@ -1295,7 +1297,7 @@ int check_push_refs(struct ref *src, int nr_refspec, const char **refspec_names)
 		ret |= match_explicit_lhs(src, rs, NULL, NULL);
 	}
 
-	free_refspec(nr_refspec, refspec);
+	refspec_clear(&refspec);
 	return ret;
 }
 
-- 
2.17.0.441.gb46fe60e1d-goog




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux