Git fork

promisor-remote: use string_list_split() in mark_remotes_as_accepted()

Previous commits replaced some strbuf_split*() calls with calls to
string_list_split*() in "promisor-remote.c".

For consistency, let's also replace the strbuf_split_str() call in
mark_remotes_as_accepted() with a call to string_list_split(), as we
don't need the splitted strings to be managed by a `struct strbuf`.
Using the lighter-weight `string_list` API is enough for our needs.

While at it let's remove a useless call to `strbuf_strip_suffix()`.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Christian Couder and committed by
Junio C Hamano
68a746e9 c213820c

+7 -8
+7 -8
promisor-remote.c
··· 769 769 770 770 void mark_promisor_remotes_as_accepted(struct repository *r, const char *remotes) 771 771 { 772 - struct strbuf **accepted_remotes = strbuf_split_str(remotes, ';', 0); 772 + struct string_list accepted_remotes = STRING_LIST_INIT_DUP; 773 + struct string_list_item *item; 773 774 774 - for (size_t i = 0; accepted_remotes[i]; i++) { 775 - struct promisor_remote *p; 776 - char *decoded_remote; 775 + string_list_split(&accepted_remotes, remotes, ";", -1); 777 776 778 - strbuf_strip_suffix(accepted_remotes[i], ";"); 779 - decoded_remote = url_percent_decode(accepted_remotes[i]->buf); 777 + for_each_string_list_item(item, &accepted_remotes) { 778 + char *decoded_remote = url_percent_decode(item->string); 779 + struct promisor_remote *p = repo_promisor_remote_find(r, decoded_remote); 780 780 781 - p = repo_promisor_remote_find(r, decoded_remote); 782 781 if (p) 783 782 p->accepted = 1; 784 783 else ··· 788 787 free(decoded_remote); 789 788 } 790 789 791 - strbuf_list_free(accepted_remotes); 790 + string_list_clear(&accepted_remotes, 0); 792 791 }