From: simon Date: Sun, 2 Nov 2008 10:35:18 +0000 (+0000) Subject: Probably about time I had a central header file containing misc stuff. X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/agedu/commitdiff_plain/353bc75ddcc747e241296418a985ad2b265a86cf Probably about time I had a central header file containing misc stuff. git-svn-id: svn://svn.tartarus.org/sgt/agedu@8251 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/agedu.c b/agedu.c index d015824..83f8ead 100644 --- a/agedu.c +++ b/agedu.c @@ -20,6 +20,7 @@ #include #include +#include "agedu.h" #include "du.h" #include "trie.h" #include "index.h" @@ -28,10 +29,6 @@ #include "httpd.h" #include "fgetline.h" -#define PNAME "agedu" - -#define lenof(x) (sizeof((x))/sizeof(*(x))) - /* * Path separator. This global variable affects the behaviour of * various parts of the code when they need to deal with path diff --git a/agedu.h b/agedu.h new file mode 100644 index 0000000..21c015a --- /dev/null +++ b/agedu.h @@ -0,0 +1,9 @@ +/* + * Central header file for agedu, defining various useful things. + */ + +#define PNAME "agedu" + +#define lenof(x) (sizeof((x))/sizeof(*(x))) + +extern char pathsep; diff --git a/html.c b/html.c index 0d80eae..f7f8c3e 100644 --- a/html.c +++ b/html.c @@ -11,17 +11,14 @@ #include #include +#include "agedu.h" #include "html.h" #include "malloc.h" #include "trie.h" #include "index.h" -#define lenof(x) ( sizeof((x)) / sizeof(*(x)) ) - #define MAXCOLOUR 511 -extern char pathsep; - struct html { char *buf; size_t buflen, bufsize; diff --git a/malloc.c b/malloc.c index f326e6d..7de2e13 100644 --- a/malloc.c +++ b/malloc.c @@ -9,10 +9,9 @@ #include #include +#include "agedu.h" #include "malloc.h" -#define lenof(x) (sizeof((x))/sizeof(*(x))) - extern void fatal(const char *, ...); void *smalloc(size_t size) { diff --git a/trie.c b/trie.c index 0466a34..b044df4 100644 --- a/trie.c +++ b/trie.c @@ -11,13 +11,12 @@ #include #include +#include "agedu.h" #include "malloc.h" #include "trie.h" #define alignof(typ) ( offsetof(struct { char c; typ t; }, t) ) -extern char pathsep; - /* * Compare functions for pathnames. Returns the relative order of * the names, like strcmp; also passes back the offset of the