Move lookup_variable into hashmap.c / hashmap.h
This commit is contained in:
		
							parent
							
								
									540069551d
								
							
						
					
					
						commit
						fdb1aae3a9
					
				@ -493,3 +493,24 @@ ssize_t hashmap_remove (hashmap_t map, const char *key)
 | 
				
			|||||||
        /* The key was not found, so return 0 */
 | 
					        /* The key was not found, so return 0 */
 | 
				
			||||||
        return deleted;
 | 
					        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);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -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);
 | 
					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 */
 | 
					#endif /* _HASHMAP_H */
 | 
				
			||||||
 | 
				
			|||||||
@ -83,27 +83,6 @@ static char *get_html_file (unsigned int errornum)
 | 
				
			|||||||
        return (val);
 | 
					        return (val);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * 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.
 | 
					 * Send an already-opened file to the client with variable substitution.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user