~mdw
/
sgt
/
halibut
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
OS X Lion's compiler spotted two missing casts, where we use %hu and
[sgt/halibut]
/
index.c
diff --git
a/index.c
b/index.c
index
9850750
..
628934e
100644
(file)
--- a/
index.c
+++ b/
index.c
@@
-10,14
+10,14
@@
static int compare_tags(void *av, void *bv);
static int compare_entries(void *av, void *bv);
indexdata *make_index(void) {
static int compare_entries(void *av, void *bv);
indexdata *make_index(void) {
- indexdata *ret =
mk
new(indexdata);
+ indexdata *ret =
s
new(indexdata);
ret->tags = newtree234(compare_tags);
ret->entries = newtree234(compare_entries);
return ret;
}
static indextag *make_indextag(void) {
ret->tags = newtree234(compare_tags);
ret->entries = newtree234(compare_entries);
return ret;
}
static indextag *make_indextag(void) {
- indextag *ret =
mk
new(indextag);
+ indextag *ret =
s
new(indextag);
ret->name = NULL;
ret->implicit_text = NULL;
ret->explicit_texts = NULL;
ret->name = NULL;
ret->implicit_text = NULL;
ret->explicit_texts = NULL;
@@
-99,7
+99,7
@@
void index_merge(indexdata *idx, int is_explicit, wchar_t *tags, word *text,
* warn (and drop it, since it won't be referenced).
*/
if (is_explicit) {
* warn (and drop it, since it won't be referenced).
*/
if (is_explicit) {
- error(err_nosuchidxtag, tags);
+ error(err_nosuchidxtag,
fpos,
tags);
continue;
}
continue;
}
@@
-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 {
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
if (!is_explicit) {
/*
* An implicit \IM for a tag that's had an implicit
@@
-119,22
+117,35
@@
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.
*/
* 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.
*/
} 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;
}
if (t->nexplicit >= t->explicit_size) {
t->explicit_size = t->nexplicit + 8;
if (t->implicit_text) {
free_word_list(t->implicit_text);
t->implicit_text = NULL;
}
if (t->nexplicit >= t->explicit_size) {
t->explicit_size = t->nexplicit + 8;
- t->explicit_texts = resize(t->explicit_texts,
-
t->explicit_size
);
- t->explicit_fpos = resize(t->explicit_fpos,
-
t->explicit_size
);
+ t->explicit_texts =
s
resize(t->explicit_texts,
+
t->explicit_size, word *
);
+ t->explicit_fpos =
s
resize(t->explicit_fpos,
+
t->explicit_size, filepos
);
}
t->explicit_texts[t->nexplicit] = text;
t->explicit_fpos[t->nexplicit] = *fpos;
}
t->explicit_texts[t->nexplicit] = text;
t->explicit_fpos[t->nexplicit] = *fpos;
@@
-169,9
+180,9
@@
void build_index(indexdata *i) {
fa = t->explicit_fpos;
}
if (t->nrefs) {
fa = t->explicit_fpos;
}
if (t->nrefs) {
- t->refs =
mknewa(indexentry *, t->nrefs
);
+ t->refs =
snewn(t->nrefs, indexentry *
);
for (j = 0; j < t->nrefs; j++) {
for (j = 0; j < t->nrefs; j++) {
- indexentry *ent =
mk
new(indexentry);
+ indexentry *ent =
s
new(indexentry);
ent->text = *ta++;
ent->fpos = *fa++;
t->refs[j] = add234(i->entries, ent);
ent->text = *ta++;
ent->fpos = *fa++;
t->refs[j] = add234(i->entries, ent);