Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita13cefa

Browse files
committed
Fix synonym-dict breakage introduced in last patch :-(.
Minor other cleanups.
1 parent93eab93 commita13cefa

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

‎src/backend/tsearch/dict_synonym.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/dict_synonym.c,v 1.3 2007/08/2500:03:59 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/dict_synonym.c,v 1.4 2007/08/2502:29:45 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -120,30 +120,31 @@ dsynonym_init(PG_FUNCTION_ARGS)
120120
/* Empty line */
121121
gotoskipline;
122122
}
123-
*end='\0';
124-
if (end >=line+strlen(line))
123+
if (*end=='\0')
125124
{
126125
/* A line with only one word. Ignore silently. */
127126
gotoskipline;
128127
}
128+
*end='\0';
129129

130130
starto=findwrd(end+1,&end);
131131
if (!starto)
132132
{
133-
/* A line with only one word. Ignore silently. */
133+
/* A line with only one word (+whitespace). Ignore silently. */
134134
gotoskipline;
135135
}
136136
*end='\0';
137137

138-
/* starti now points to the first word, and starto to the second
138+
/*
139+
* starti now points to the first word, and starto to the second
139140
* word on the line, with a \0 terminator at the end of both words.
140141
*/
141142

142-
if (cur==d->len)
143+
if (cur>=d->len)
143144
{
144145
if (d->len==0)
145146
{
146-
d->len=16;
147+
d->len=64;
147148
d->syn= (Syn*)palloc(sizeof(Syn)*d->len);
148149
}
149150
else
@@ -180,7 +181,8 @@ dsynonym_lexize(PG_FUNCTION_ARGS)
180181
*found;
181182
TSLexeme*res;
182183

183-
if (len <=0)
184+
/* note: d->len test protects against Solaris bsearch-of-no-items bug */
185+
if (len <=0||d->len <=0)
184186
PG_RETURN_POINTER(NULL);
185187

186188
key.in=lowerstr_with_len(in,len);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp