diff --git a/Makefile.am b/Makefile.am index 84685fc..f44568f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,8 +5,6 @@ ACLOCAL_AMFLAGS=-I m4 r3_includedir = $(includedir)/r3 r3_include_HEADERS = \ include/r3.h \ - include/r3_define.h \ - include/r3_list.h \ include/r3_str.h \ include/str_array.h \ $(NULL) diff --git a/include/r3.h b/include/r3.h index 7c1d6bd..8f1250b 100644 --- a/include/r3.h +++ b/include/r3.h @@ -14,8 +14,36 @@ #include #include + +#ifndef bool +typedef unsigned char bool; +#endif +#ifndef FALSE +# define FALSE 0 +#endif +#ifndef TRUE +# define TRUE 1 +#endif + +// #define DEBUG 1 +#ifdef DEBUG + +#define info(fmt, ...) \ + do { fprintf(stderr, fmt, __VA_ARGS__); } while (0) + +#define debug(fmt, ...) \ + do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ + __LINE__, __func__, __VA_ARGS__); } while (0) + +#else +#define info(...); +#define debug(...); +#endif + #include "str_array.h" + + #define node_edge_pattern(node,i) node->edges[i]->pattern #define node_edge_pattern_len(node,i) node->edges[i]->pattern_len diff --git a/include/r3_define.h b/include/r3_define.h deleted file mode 100644 index bee91da..0000000 --- a/include/r3_define.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * r3_define.h - * Copyright (C) 2014 c9s - * - * Distributed under terms of the MIT license. - */ - -#ifndef DEFINE_H -#define DEFINE_H - -#ifndef bool -typedef unsigned char bool; -#endif -#ifndef FALSE -# define FALSE 0 -#endif -#ifndef TRUE -# define TRUE 1 -#endif - -// #define DEBUG 1 -#ifdef DEBUG - -#define info(fmt, ...) \ - do { fprintf(stderr, fmt, __VA_ARGS__); } while (0) - -#define debug(fmt, ...) \ - do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ - __LINE__, __func__, __VA_ARGS__); } while (0) - -#else -#define info(...); -#define debug(...); -#endif - -#endif /* !DEFINE_H */ diff --git a/src/Makefile.am b/src/Makefile.am index 6cbf4a3..782cf5e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,7 @@ lib_LTLIBRARIES = libr3.la # lib_LIBRARIES = libr3.a libr3_la_SOURCES = node.c edge.c str.c token.c + # libr3_la_LDFLAGS = -export-symbols-regex '^r3_|^match_' libr3_la_LIBADD=$(DEPS_LIBS) diff --git a/src/edge.c b/src/edge.c index b979fc9..34e11f4 100644 --- a/src/edge.c +++ b/src/edge.c @@ -19,9 +19,8 @@ // #include #include -#include "r3_define.h" -#include "r3_str.h" #include "r3.h" +#include "r3_str.h" #include "str_array.h" edge * r3_edge_create(char * pattern, int pattern_len, node * child) { diff --git a/src/node.c b/src/node.c index 3e0d485..20a701c 100644 --- a/src/node.c +++ b/src/node.c @@ -13,9 +13,8 @@ // Judy array // #include -#include "r3_define.h" -#include "r3_str.h" #include "r3.h" +#include "r3_str.h" #include "str_array.h" // String value as the index http://judy.sourceforge.net/doc/JudySL_3x.htm diff --git a/tests/bench_str.csv b/tests/bench_str.csv index 06803c9..86bff77 100644 --- a/tests/bench_str.csv +++ b/tests/bench_str.csv @@ -387,3 +387,4 @@ 1400599508,13991454.07 1400599553,13826120.84 1400599756,12099437.82 +1400599972,13982492.37 diff --git a/tests/check_tree.c b/tests/check_tree.c index 6caf565..da5d4df 100644 --- a/tests/check_tree.c +++ b/tests/check_tree.c @@ -4,7 +4,6 @@ #include #include "r3.h" #include "r3_str.h" -#include "r3_define.h" #include "str_array.h" #include "bench.h"