summaryrefslogtreecommitdiffhomepage
path: root/src/html-error.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2017-01-04 13:59:14 +0100
committerGitHub <noreply@github.com>2017-01-04 13:59:14 +0100
commit302738dee5dd247881a4a5eba173f4333dc2a7d4 (patch)
tree16973c4b6b975cd6849845afb5133102c78cd690 /src/html-error.c
parente4ae0d10d28dece1fe6d06c0f479b3968478fed8 (diff)
parentfdb1aae3a98d94da90b2ee36bd5ae4423e3b213b (diff)
Merge pull request #71 from gmp216/lookup
Move lookup_variable from html-error.c to hashmap.c
Diffstat (limited to 'src/html-error.c')
-rw-r--r--src/html-error.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/html-error.c b/src/html-error.c
index 972d265..38adf85 100644
--- a/src/html-error.c
+++ b/src/html-error.c
@@ -84,27 +84,6 @@ static char *get_html_file (unsigned int errornum)
}
/*
- * Look up the value for a variable.
- */
-static char *lookup_variable (struct conn_s *connptr, const char *varname)
-{
- hashmap_iter result_iter;
- char *key;
- char *data;
-
- result_iter = hashmap_find (connptr->error_variables, varname);
-
- if (hashmap_is_end (connptr->error_variables, result_iter))
- return (NULL);
-
- if (hashmap_return_entry (connptr->error_variables, result_iter,
- &key, (void **) &data) < 0)
- return (NULL);
-
- return (data);
-}
-
-/*
* Send an already-opened file to the client with variable substitution.
*/
int
@@ -126,7 +105,7 @@ send_html_file (FILE *infile, struct conn_s *connptr)
if (in_variable) {
*p = '\0';
varval = (const char *)
- lookup_variable (connptr,
+ lookup_variable (connptr->error_variables,
varstart);
if (!varval)
varval = "(unknown)";
@@ -212,7 +191,7 @@ int send_http_error_message (struct conn_s *connptr)
error_file = get_html_file (connptr->error_number);
if (!(infile = fopen (error_file, "r"))) {
- char *detail = lookup_variable (connptr, "detail");
+ char *detail = lookup_variable (connptr->error_variables, "detail");
return (write_message (connptr->client_fd, fallback_error,
connptr->error_number,
connptr->error_string,