summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hashmap.c21
-rw-r--r--src/hashmap.h5
-rw-r--r--src/html-error.c21
3 files changed, 26 insertions, 21 deletions
diff --git a/src/hashmap.c b/src/hashmap.c
index b99f838..7793d08 100644
--- a/src/hashmap.c
+++ b/src/hashmap.c
@@ -493,3 +493,24 @@ ssize_t hashmap_remove (hashmap_t map, const char *key)
/* The key was not found, so return 0 */
return deleted;
}
+
+/*
+ * Look up the value for a variable.
+ */
+char *lookup_variable (hashmap_t map, const char *varname)
+{
+ hashmap_iter result_iter;
+ char *key;
+ char *data;
+
+ result_iter = hashmap_find (map, varname);
+
+ if (hashmap_is_end (map, result_iter))
+ return (NULL);
+
+ if (hashmap_return_entry (map, result_iter,
+ &key, (void **) &data) < 0)
+ return (NULL);
+
+ return (data);
+}
diff --git a/src/hashmap.h b/src/hashmap.h
index e8fa819..9206737 100644
--- a/src/hashmap.h
+++ b/src/hashmap.h
@@ -117,4 +117,9 @@ extern ssize_t hashmap_search (hashmap_t map, const char *key);
*/
extern ssize_t hashmap_remove (hashmap_t map, const char *key);
+/*
+ * Look up the value for a variable.
+ */
+extern char *lookup_variable (hashmap_t map, const char *varname);
+
#endif /* _HASHMAP_H */
diff --git a/src/html-error.c b/src/html-error.c
index 640ac53..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 (hashmap_t map, const char *varname)
-{
- hashmap_iter result_iter;
- char *key;
- char *data;
-
- result_iter = hashmap_find (map, varname);
-
- if (hashmap_is_end (map, result_iter))
- return (NULL);
-
- if (hashmap_return_entry (map, result_iter,
- &key, (void **) &data) < 0)
- return (NULL);
-
- return (data);
-}
-
-/*
* Send an already-opened file to the client with variable substitution.
*/
int