telize

High performance JSON IP and GeoIP REST API (IP Geolocation)
Log | Files | Refs | README | LICENSE

commit 790381eba21f17962f2a44f22038f22396297c1c
parent fd65992c26d5c831961739ac7b0e05f07bbbabde
Author: Frederic Cambus <fred@statdns.com>
Date:   Fri,  5 Oct 2018 21:18:46 +0200

Remove redundant calls to kore_strdup()

Diffstat:
Msrc/ip.c | 6+++---
Msrc/jsonip.c | 6+++---
Msrc/location.c | 6+++---
3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/ip.c b/src/ip.c @@ -22,8 +22,8 @@ int ip(struct http_request *); int ip(struct http_request *req) { - const char *visitor_ip; - char *ip, *addr; + const char *visitor_ip, *ip; + char *addr; addr = kore_malloc(INET6_ADDRSTRLEN); @@ -34,7 +34,7 @@ ip(struct http_request *req) } if (http_request_header(req, "X-Forwarded-For", &visitor_ip)) { - ip = kore_strdup(visitor_ip); + ip = visitor_ip; } else { ip = addr; } diff --git a/src/jsonip.c b/src/jsonip.c @@ -25,8 +25,8 @@ int jsonip(struct http_request *); int jsonip(struct http_request *req) { - const char *visitor_ip; - char *answer, *callback, *json, *ip, *addr; + const char *visitor_ip, *ip; + char *answer, *callback, *json, *addr; json_t *output = json_object(); http_populate_get(req); @@ -40,7 +40,7 @@ jsonip(struct http_request *req) } if (http_request_header(req, "X-Forwarded-For", &visitor_ip)) { - ip = kore_strdup(visitor_ip); + ip = visitor_ip; } else { ip = addr; } diff --git a/src/location.c b/src/location.c @@ -49,8 +49,8 @@ init(int state) int location(struct http_request *req) { - const char *visitor_ip; - char *answer, *callback, *json, *ip, *addr; + const char *visitor_ip, *ip; + char *answer, *callback, *json, *addr; json_t *output = json_object(); int gai_error, mmdb_error; @@ -71,7 +71,7 @@ location(struct http_request *req) } if (http_request_header(req, "X-Forwarded-For", &visitor_ip)) { - ip = kore_strdup(visitor_ip); + ip = visitor_ip; } else { ip = addr; }