for uri use a simple pointer: no copy is needed - gopherproxy-c - Gopher HTTP p… | |
git clone git://git.codemadness.org/gopherproxy-c | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit c203aa551a7deb54746100ba0532d5e6d234ad85 | |
parent 68d669677f9f159d33c5b8f369f716edd2dd91e0 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Sun, 12 Aug 2018 19:28:28 +0200 | |
for uri use a simple pointer: no copy is needed | |
Diffstat: | |
M gopherproxy.c | 8 ++++---- | |
1 file changed, 4 insertions(+), 4 deletions(-) | |
--- | |
diff --git a/gopherproxy.c b/gopherproxy.c | |
@@ -450,8 +450,8 @@ int | |
main(void) | |
{ | |
struct uri u; | |
- const char *p, *qs, *path; | |
- char query[1024] = "", param[1024] = "", uri[1024] = ""; | |
+ const char *p, *qs, *path, *uri; | |
+ char query[1024] = "", param[1024] = ""; | |
int _type = '1'; | |
if (pledge("stdio inet dns", NULL) == -1) | |
@@ -473,9 +473,9 @@ main(void) | |
path = "/"; | |
if (query[0]) { | |
if (!strncmp(query, "gopher://", sizeof("gopher://") - 1)) | |
- snprintf(uri, sizeof(uri), "%s", query + sizeof("gophe… | |
+ uri = query + sizeof("gopher://") - 1; | |
else | |
- snprintf(uri, sizeof(uri), "%s", query); | |
+ uri = query; | |
if (!parseuri(uri, &u)) | |
die(400, "Invalid uri: %s\n", uri); |