summaryrefslogtreecommitdiff
path: root/url.c
diff options
context:
space:
mode:
authorVincent Douillet <vincent@vdouillet.fr>2023-08-19 18:15:55 +0200
committerVincent Douillet <vincent@vdouillet.fr>2023-08-19 18:16:38 +0200
commit26a77087027327d72d7229866a1ce12ad11a4d63 (patch)
treebfbf6b6704c8f853a1063b7ff3c7164d4b085ae1 /url.c
parent7caf4597bcfb64dac04b7190dab1022f1bc4e141 (diff)
rework url_build function to end varargs with NULL
Diffstat (limited to 'url.c')
-rw-r--r--url.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/url.c b/url.c
index 3e71289..6ed2c19 100644
--- a/url.c
+++ b/url.c
@@ -51,7 +51,7 @@ check_request_path(char *path)
}
size_t
-url_build(char *dst, size_t dst_size, int count,...)
+url_build(char *dst, size_t dst_size,...)
{
va_list path_list;
const char *path;
@@ -60,15 +60,12 @@ url_build(char *dst, size_t dst_size, int count,...)
dst[0] = '\0';
w_size = 0;
- va_start(path_list, count);
- for (path_index = 0; path_index < count; path_index++) {
+ va_start(path_list, dst_size);
+ while ((path = va_arg(path_list, char *)) != NULL) {
/* no more space in dst buffer */
if (w_size >= dst_size)
break;
- path = va_arg(path_list, char *);
-
- assert(path != NULL);
if (path[0] == '\0')
continue;