Mercurial > sm-archive
diff src/context.h @ 19:b24369330483 stable-1-0-7
Fedora 9 compile and const correctness.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Thu, 12 Jun 2008 18:17:33 -0700 |
parents | 75e1a9bcbc2e |
children |
line wrap: on
line diff
--- a/src/context.h Fri Mar 21 16:02:40 2008 -0700 +++ b/src/context.h Thu Jun 12 18:17:33 2008 -0700 @@ -8,11 +8,7 @@ #ifndef context_include #define context_include -#include "tokenizer.h" -#include <map> - - -typedef map<char *, char *, ltstr> string_map; +typedef map<const char *, const char *, ltstr> string_map; struct CONFIG { // the only mutable stuff once it has been loaded from the config file @@ -27,33 +23,33 @@ CONFIG(); ~CONFIG(); - void add_from(char *from, char *target) {env_from[from] = target; }; - void add_to(char *to, char *target) {rcpt_to[to] = target; }; - void add_remove(char *to) {rcpt_remove.insert(to); }; - char * find_from(char *from) {return find(from, env_from); }; - char * find_to(char *to) {return find(to, rcpt_to); }; - bool find_remove(char *to) {return find(to, rcpt_remove); }; - bool find(char *needle, string_set &haystack); - char * find(char *needle, string_map &haystack); + void add_from(const char *from, const char *target) {env_from[from] = target; }; + void add_to(const char *to, const char *target) {rcpt_to[to] = target; }; + void add_remove(const char *to) {rcpt_remove.insert(to); }; + const char *find_from(const char *from) {return find(from, env_from); }; + const char *find_to(const char *to) {return find(to, rcpt_to); }; + bool find_remove(const char *to) {return find(to, rcpt_remove); }; + bool find(const char *needle, string_set &haystack); + const char *find(const char *needle, string_map &haystack); void dump(); }; -extern char *token_envfrom; -extern char *token_include; -extern char *token_lbrace; -extern char *token_rbrace; -extern char *token_rcptto; -extern char *token_remove; -extern char *token_semi; +extern const char *token_envfrom; +extern const char *token_include; +extern const char *token_lbrace; +extern const char *token_rbrace; +extern const char *token_rcptto; +extern const char *token_remove; +extern const char *token_semi; extern string_set all_strings; // owns all the strings, only modified by the config loader thread void discard(string_set &s); -char* register_string(string_set &s, char *name); -char* register_string(char *name); +const char* register_string(string_set &s, const char *name); +const char* register_string(const char *name); void clear_strings(); -CONFIG *parse_config(char *fn); -bool load_conf(CONFIG &dc, char *fn); +CONFIG *parse_config(const char *fn); +bool load_conf(CONFIG &dc, const char *fn); void token_init(); #endif