summaryrefslogtreecommitdiffstatshomepage
path: root/man_hash.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2009-06-18 10:32:00 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2009-06-18 10:32:00 +0000
commite100896ec287b69a49978cc7502276f0759544b0 (patch)
tree42153c653b231d86d04266fc491c6fd101db5f4c /man_hash.c
parent78e476a84b5b848e06913e55ae4c965faffa0358 (diff)
downloadmandoc-e100896ec287b69a49978cc7502276f0759544b0.tar.gz
mandoc-e100896ec287b69a49978cc7502276f0759544b0.tar.zst
mandoc-e100896ec287b69a49978cc7502276f0759544b0.zip
Added -fno-ign-chars support to libman.
man_validate.c checks for non-tab/isprint words. libman hashtable fixed (was ignoring .br). Added ncount field to man_node, deprecating count() functions. Documented use of tabs in man.7.
Diffstat (limited to 'man_hash.c')
-rw-r--r--man_hash.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/man_hash.c b/man_hash.c
index e89244a9..11913891 100644
--- a/man_hash.c
+++ b/man_hash.c
@@ -1,4 +1,4 @@
-/* $Id: man_hash.c,v 1.9 2009/06/16 19:55:28 kristaps Exp $ */
+/* $Id: man_hash.c,v 1.10 2009/06/18 10:32:00 kristaps Exp $ */
/*
* Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se>
*
@@ -37,9 +37,13 @@ man_hash_alloc(void)
int *htab;
int i, j, x;
- htab = calloc(26 * 5, sizeof(int));
+ /* Initialised to -1. */
+
+ htab = malloc(26 * 5 * sizeof(int));
if (NULL == htab)
return(NULL);
+ for (i = 0; i < 26 * 5; i++)
+ htab[i] = -1;
for (i = 0; i < MAN_MAX; i++) {
x = man_macronames[i][0];
@@ -51,7 +55,7 @@ man_hash_alloc(void)
x *= 5;
for (j = 0; j < 5; j++)
- if (0 == htab[x + j]) {
+ if (-1 == htab[x + j]) {
htab[x + j] = i;
break;
}
@@ -80,7 +84,7 @@ man_hash_find(const void *arg, const char *tmp)
x *= 5;
for (i = 0; i < 5; i++) {
- if (0 == (tok = htab[x + i]))
+ if (-1 == (tok = htab[x + i]))
return(MAN_MAX);
if (0 == strcmp(tmp, man_macronames[tok]))
return(tok);