Mercurial > dnsbl
diff src/tokenizer.h @ 214:82886d4dd71f stable-6-0-19
Fixes to compile on Fedora 9 and for const correctness.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 10 Jun 2008 08:58:42 -0700 |
parents | 44ffef730bc4 |
children | 5209e92b4885 |
line wrap: on
line diff
--- a/src/tokenizer.h Wed Apr 30 13:11:32 2008 -0700 +++ b/src/tokenizer.h Tue Jun 10 08:58:42 2008 -0700 @@ -6,27 +6,17 @@ */ -#ifndef tokenizer_include -#define tokenizer_include - -#include <fstream> -#include <list> -#include <set> -#include <stdio.h> -#include <ctype.h> - - using namespace std; struct ltstr { - bool operator()(char* s1, char* s2) const { + bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) < 0; } }; typedef list<ifstream *> stream_list; -typedef list<char *> string_list; -typedef set<char *, ltstr> string_set; +typedef list<const char *> string_list; +typedef set<const char *, ltstr> string_set; typedef list<int> line_list; class TOKEN { @@ -44,13 +34,13 @@ void push_char(u_char c); public: - TOKEN(char *fn, string_set *includes); + TOKEN(const char *fn, string_set *includes); ~TOKEN(); - bool include(char *fn); - char *next(); // return next token + bool include(const char *fn); + const char *next(); // return next token int nextint(); void skipeol(); // skip to eol - void push(char *token) {pending_tokens.push_front(token);}; + void push(const char *token) {pending_tokens.push_front(token);}; const char *cur_fn() {return filenames.empty() ? "" : filenames.front();}; int cur_line() {return linenumbers.empty() ? 0 : linenumbers.front();}; void token_error(const char *err); @@ -60,4 +50,3 @@ void token_error(); }; -#endif