url: add str wrapper for end_url_with_slash()
Helped-by: Johnathan Nieder <jrnieder@gmail.com> Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tay Ray Chuan committed
Nov 25, 2010 at 16:21 UTC
3793a309018eac83de7e4a3d39440d236660665c
2 files changed
+8
url.c
+7
@@ -132,3 +132,10 @@ void end_url_with_slash(struct strbuf *buf, const char *url)
132
if (buf->len && buf->buf[buf->len - 1] != '/')
133
strbuf_addstr(buf, "/");
134
}
135
+
136
+void str_end_url_with_slash(const char *url, char **dest) {
137
+ struct strbuf buf = STRBUF_INIT;
138
+ end_url_with_slash(&buf, url);
139
+ free(*dest);
140
+ *dest = strbuf_detach(&buf, NULL);
141
+}
url.h
+1
@@ -8,5 +8,6 @@ extern char *url_decode_parameter_name(const char **query);
8
extern char *url_decode_parameter_value(const char **query);
9
10
extern void end_url_with_slash(struct strbuf *buf, const char *url);
11
+extern void str_end_url_with_slash(const char *url, char **dest);
12
13
#endif /* URL_H */