|
7 | 7 | * |
8 | 8 | * |
9 | 9 | * IDENTIFICATION |
10 | | - * $PostgreSQL: pgsql/src/backend/tsearch/dict_thesaurus.c,v 1.14 2009/07/16 06:33:44 petere Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/backend/tsearch/dict_thesaurus.c,v 1.15 2009/11/30 16:38:31 tgl Exp $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
@@ -57,8 +57,8 @@ typedef struct |
57 | 57 |
|
58 | 58 | /* Array to search lexeme by exact match */ |
59 | 59 | TheLexeme*wrds; |
60 | | -intnwrds; |
61 | | -intntwrds; |
| 60 | +intnwrds;/* current number of words */ |
| 61 | +intntwrds;/* allocated array length */ |
62 | 62 |
|
63 | 63 | /* |
64 | 64 | * Storage of substituted result, n-th element is for n-th expression |
@@ -298,7 +298,6 @@ thesaurusRead(char *filename, DictThesaurus *d) |
298 | 298 | staticTheLexeme* |
299 | 299 | addCompiledLexeme(TheLexeme*newwrds,int*nnw,int*tnm,TSLexeme*lexeme,LexemeInfo*src,uint16tnvariant) |
300 | 300 | { |
301 | | - |
302 | 301 | if (*nnw >=*tnm) |
303 | 302 | { |
304 | 303 | *tnm *=2; |
@@ -453,7 +452,8 @@ compileTheLexeme(DictThesaurus *d) |
453 | 452 | pfree(d->wrds[i].entries); |
454 | 453 | } |
455 | 454 |
|
456 | | -pfree(d->wrds); |
| 455 | +if (d->wrds) |
| 456 | +pfree(d->wrds); |
457 | 457 | d->wrds=newwrds; |
458 | 458 | d->nwrds=nnw; |
459 | 459 | d->ntwrds=tnm; |
|