changeset 1047:29e1a502b571

static: remove unnecessary local variable & put str ref sooner This is just a cleanup. There should be no change in behavior. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Thu, 13 Aug 2020 10:57:21 -0400
parents 36c1bd8ea8db
children 675cf954392f
files static.c
diffstat 1 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/static.c	Thu Aug 13 10:55:04 2020 -0400
+++ b/static.c	Thu Aug 13 10:57:21 2020 -0400
@@ -83,21 +83,18 @@
 	char path[FILENAME_MAX];
 	const struct uri_info *info;
 	struct str *uri_str;
-	const char *uri;
 
 	uri_str = nvl_lookup_str(req->scgi->request.headers, SCGI_DOCUMENT_URI);
 	ASSERT(!IS_ERR(uri_str));
 
-	uri = str_cstr(uri_str);
+	info = get_uri_info(str_cstr(uri_str));
+	ASSERT(info);
 
-	info = get_uri_info(uri);
-	ASSERT(info);
+	str_putref(uri_str);
 
 	snprintf(path, sizeof(path), "%s/static/%s", str_cstr(config.theme_dir),
 		 info->uri);
 
-	str_putref(uri_str);
-
 	/*
 	 * We assume that the URI (minus the URI prefix) is relative to the
 	 * theme's static subdir.  Since we have a whitelist of allowed