aboutsummaryrefslogtreecommitdiff
path: root/ui-shared.c
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'ui-shared.c')
-rw-r--r--ui-shared.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/ui-shared.c b/ui-shared.c
index 1a84afc..d8cc4d7 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -751,19 +751,31 @@ void cgit_print_docend()
static void add_clone_urls(void (*fn)(const char *), char *txt, char *suffix)
{
- struct strbuf **url_list = strbuf_split_str(txt, ' ', 0);
- int i;
+ struct strbuf buf = STRBUF_INIT;
+ char *h = txt, *t, c;
- for (i = 0; url_list[i]; i++) {
- strbuf_rtrim(url_list[i]);
- if (url_list[i]->len == 0)
- continue;
- if (suffix && *suffix)
- strbuf_addf(url_list[i], "/%s", suffix);
- fn(url_list[i]->buf);
+ while (h && *h) {
+ while (h && *h == ' ')
+ h++;
+ if (!*h)
+ break;
+ t = h;
+ while (t && *t && *t != ' ')
+ t++;
+ c = *t;
+ *t = 0;
+
+ if (suffix && *suffix) {
+ strbuf_reset(&buf);
+ strbuf_addf(&buf, "%s/%s", h, suffix);
+ h = buf.buf;
+ }
+ fn(h);
+ *t = c;
+ h = t;
}
- strbuf_list_free(url_list);
+ strbuf_release(&buf);
}
void cgit_add_clone_urls(void (*fn)(const char *))