diff options
| author | Simon Tatham <anakin@pobox.com> | 1999-10-25 16:24:41 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 1999-10-25 16:24:41 +0000 |
| commit | 58b8771ff9a9c397ea49605db216a5e5a777c057 (patch) | |
| tree | 4c27603e22c24e8383a59f6cc175fc9a71e1eea7 /index.c | |
| parent | e51e74249b8990672b1420c6edcf608ca292533a (diff) | |
| download | halibut-58b8771ff9a9c397ea49605db216a5e5a777c057.zip halibut-58b8771ff9a9c397ea49605db216a5e5a777c057.tar.gz halibut-58b8771ff9a9c397ea49605db216a5e5a777c057.tar.bz2 halibut-58b8771ff9a9c397ea49605db216a5e5a777c057.tar.xz | |
Fix a slight oddity in index generation, revealed by error testing
[originally from svn r256]
Diffstat (limited to 'index.c')
| -rw-r--r-- | index.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -142,13 +142,15 @@ void build_index(index *i) { t->nrefs = t->nexplicit; ta = t->explicit_texts; } - t->refs = mknewa(indexentry *, t->nrefs); - for (j = 0; j < t->nrefs; j++) { - indexentry *ent = mknew(indexentry); - ent->text = *ta++; - t->refs[j] = add23(i->entries, ent, compare_entries); - if (t->refs[j] != ent) /* duplicate */ - sfree(ent); + if (t->nrefs) { + t->refs = mknewa(indexentry *, t->nrefs); + for (j = 0; j < t->nrefs; j++) { + indexentry *ent = mknew(indexentry); + ent->text = *ta++; + t->refs[j] = add23(i->entries, ent, compare_entries); + if (t->refs[j] != ent) /* duplicate */ + sfree(ent); + } } } } |