shift end_url_with_slash() from http.[ch] to url.[ch]
This allows non-http/curl users to access it too (eg. http-backend.c). Update include headers in end_url_with_slash() users too. 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
1966d9f37b94fa506bfa43961fb111084aaa2c45
5 files changed
+12
-9
Makefile
+1
-1
@@ -1879,7 +1879,7 @@ builtin/tar-tree.o archive-tar.o: tar.h
1879
builtin/pack-objects.o: thread-utils.h
1880
connect.o transport.o http-backend.o: url.h
1881
http-fetch.o http-walker.o remote-curl.o transport.o walker.o: walker.h
1882
-http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h
1882
+http.o http-walker.o http-push.o http-fetch.o remote-curl.o: http.h url.h
1883
1884
xdiff-interface.o $(XDIFF_OBJS): \
1885
xdiff/xinclude.h xdiff/xmacros.h xdiff/xdiff.h xdiff/xtypes.h \
http.c
+1
-7
@@ -2,6 +2,7 @@
2
#include "pack.h"
3
#include "sideband.h"
4
#include "run-command.h"
5
+#include "url.h"
6
7
int data_received;
8
int active_requests;
@@ -728,13 +729,6 @@ static inline int hex(int v)
729
return 'A' + v - 10;
730
}
731
731
-void end_url_with_slash(struct strbuf *buf, const char *url)
732
-{
733
- strbuf_addstr(buf, url);
734
- if (buf->len && buf->buf[buf->len - 1] != '/')
735
- strbuf_addstr(buf, "/");
736
-}
737
-
732
static char *quote_ref_url(const char *base, const char *ref)
733
{
734
struct strbuf buf = STRBUF_INIT;
http.h
+1
-1
@@ -8,6 +8,7 @@
8
9
#include "strbuf.h"
10
#include "remote.h"
11
+#include "url.h"
12
13
/*
14
* We detect based on the cURL version if multi-transfer is
@@ -117,7 +118,6 @@ extern void append_remote_object_url(struct strbuf *buf, const char *url,
118
int only_two_digit_prefix);
119
extern char *get_remote_object_url(const char *url, const char *hex,
120
int only_two_digit_prefix);
120
-extern void end_url_with_slash(struct strbuf *buf, const char *url);
121
122
/* Options for http_request_*() */
123
#define HTTP_NO_CACHE 1
url.c
+7
@@ -125,3 +125,10 @@ char *url_decode_parameter_value(const char **query)
125
struct strbuf out = STRBUF_INIT;
126
return url_decode_internal(query, "&", &out, 1);
127
}
128
+
129
+void end_url_with_slash(struct strbuf *buf, const char *url)
130
+{
131
+ strbuf_addstr(buf, url);
132
+ if (buf->len && buf->buf[buf->len - 1] != '/')
133
+ strbuf_addstr(buf, "/");
134
+}
url.h
+2
@@ -7,4 +7,6 @@ extern char *url_decode(const char *url);
7
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
+
12
#endif /* URL_H */