summaryrefslogtreecommitdiff
path: root/index.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-06-13 14:57:25 +0000
committerSimon Tatham <anakin@pobox.com>2004-06-13 14:57:25 +0000
commita7963e261b59522cf57696b07058da760fb22e2e (patch)
tree7c53fc0df36973aa9142e0370774cbf3121fb5ff /index.c
parent0c4ba28a316e3c9c48bf52db3d2081634a8e61f7 (diff)
downloadhalibut-a7963e261b59522cf57696b07058da760fb22e2e.zip
halibut-a7963e261b59522cf57696b07058da760fb22e2e.tar.gz
halibut-a7963e261b59522cf57696b07058da760fb22e2e.tar.bz2
halibut-a7963e261b59522cf57696b07058da760fb22e2e.tar.xz
The Halibut manual contained at least one instance of two index
terms (intentionally) differing only in case, which were being silently folded into one by the case-insensitive index tag comparison. Halibut now warns in this situation (but then folds them anyway, which I think is better than silently generating an index containing many case-distinct forms of the same word - I imagine it's very easy to do that by mistake). The manual has been fixed to explicitly define distinct keywords (in the case I spotted and in five other cases picked up by the new warning!), and also documents this issue and how to work with it. [originally from svn r4279]
Diffstat (limited to 'index.c')
-rw-r--r--index.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/index.c b/index.c
index 5dde59f..628934e 100644
--- a/index.c
+++ b/index.c
@@ -109,8 +109,6 @@ void index_merge(indexdata *idx, int is_explicit, wchar_t *tags, word *text,
t->implicit_text = text;
t->implicit_fpos = *fpos;
} else {
- sfree(t);
- t = existing;
if (!is_explicit) {
/*
* An implicit \IM for a tag that's had an implicit
@@ -119,12 +117,25 @@ void index_merge(indexdata *idx, int is_explicit, wchar_t *tags, word *text,
* differences. And check the tag for case match
* against the existing tag, likewise.
*/
+
+ /*
+ * Check the tag against its previous occurrence to
+ * see if the cases match.
+ */
+ if (ustrcmp(t->name, existing->name)) {
+ error(err_indexcase, fpos, t->name,
+ &existing->implicit_fpos, existing->name);
+ }
+
+ sfree(t);
} else {
/*
* An explicit \IM added to a valid tag. In
* particular, this removes the implicit \IM if
* present.
*/
+ sfree(t);
+ t = existing;
if (t->implicit_text) {
free_word_list(t->implicit_text);
t->implicit_text = NULL;