=================================================================== RCS file: /cvs/mandoc/Attic/man_hash.c,v retrieving revision 1.12 retrieving revision 1.15 diff -u -p -r1.12 -r1.15 --- mandoc/Attic/man_hash.c 2009/09/16 14:40:56 1.12 +++ mandoc/Attic/man_hash.c 2009/09/23 11:53:45 1.15 @@ -1,4 +1,4 @@ -/* $Id: man_hash.c,v 1.12 2009/09/16 14:40:56 kristaps Exp $ */ +/* $Id: man_hash.c,v 1.15 2009/09/23 11:53:45 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -14,6 +14,8 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include + #include #include #include @@ -21,10 +23,12 @@ #include "libman.h" +static u_char table[26 * 6]; -static unsigned char table[26 * 6]; - - +/* + * XXX - this hash has global scope, so if intended for use as a library + * with multiple callers, it will need re-invocation protection. + */ void man_hash_init(void) { @@ -42,13 +46,12 @@ man_hash_init(void) for (j = 0; j < 6; j++) if (UCHAR_MAX == table[x + j]) { - table[x + j] = i; + table[x + j] = (u_char)i; break; } assert(j < 6); } } - int man_hash_find(const char *tmp)