for uri use a simple pointer: no copy is needed - gopherproxy-c - Gopher HTTP proxy in C (CGI)
(HTM) git clone git://git.codemadness.org/gopherproxy-c
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit c203aa551a7deb54746100ba0532d5e6d234ad85
(DIR) parent 68d669677f9f159d33c5b8f369f716edd2dd91e0
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
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(-)
---
(DIR) 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("gopher://") - 1);
+ 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);