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

Commit87cfb8e

Browse files
committed
Fixed very stupid but important bug: mixing calls of some founctions from
contrib/tsearch and contrib/ltree :)Teodor Sigaev
1 parentbe2de3b commit87cfb8e

File tree

9 files changed

+21
-19
lines changed

9 files changed

+21
-19
lines changed

‎contrib/ltree/README.ltree

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,8 @@ appreciate your input. So far, below some (rather obvious) results:
426426

427427
CHANGES
428428

429+
Aug 9, 2002
430+
Fixed very stupid but important bug :-)
429431
July 31, 2002
430432
Now works on 64-bit platforms.
431433
Added function lca - lowest common ancestor
@@ -437,7 +439,7 @@ July 13, 2002
437439
TODO
438440

439441
* Testing on 64-bit platforms. There are several known problems with byte
440-
alignment;
442+
alignment; -- RESOLVED
441443
* Better documentation;
442444
* We plan (probably) to improve regular expressions processing using
443445
non-deterministic automata;

‎contrib/ltree/_ltree_gist.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ hashing(BITVECP sign, ltree *t) {
4545
inthash;
4646

4747
while(tlen>0) {
48-
hash=crc32_sz(cur->name,cur->len );
48+
hash=ltree_crc32_sz(cur->name,cur->len );
4949
AHASH(sign,hash );
5050
cur=LEVEL_NEXT(cur);
5151
tlen--;
@@ -455,7 +455,7 @@ gist_te(ltree_gist *key, ltree* query) {
455455
return true;
456456

457457
while(qlen>0 ) {
458-
hv=crc32_sz(curq->name,curq->len);
458+
hv=ltree_crc32_sz(curq->name,curq->len);
459459
if ( !GETBIT(sign,AHASHVAL(hv) ) )
460460
return false;
461461
curq=LEVEL_NEXT(curq);
@@ -475,7 +475,7 @@ gist_qtxt(ltree_gist *key, ltxtquery* query) {
475475
if (LTG_ISALLTRUE(key) )
476476
return true;
477477

478-
returnexecute(
478+
returnltree_execute(
479479
GETQUERY(query),
480480
(void*)LTG_SIGN(key), false,
481481
checkcondition_bit

‎contrib/ltree/crc32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static const unsigned int crc32tab[256] = {
9595
};
9696

9797
unsignedint
98-
crc32_sz(char*buf,intsize)
98+
ltree_crc32_sz(char*buf,intsize)
9999
{
100100
unsignedintcrc= ~0;
101101
char*p;

‎contrib/ltree/crc32.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
#define_CRC32_H
33

44
/* Returns crc32 of data block */
5-
externunsignedintcrc32_sz(char*buf,intsize);
5+
externunsignedintltree_crc32_sz(char*buf,intsize);
66

77
/* Returns crc32 of null-terminated string */
8-
#definecrc32(buf)crc32_sz((buf),strlen(buf))
8+
#definecrc32(buf)ltree_crc32_sz((buf),strlen(buf))
99

1010
#endif

‎contrib/ltree/ltree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Datum ltree_textadd(PG_FUNCTION_ARGS);
152152
/* Util function */
153153
Datumltree_in(PG_FUNCTION_ARGS);
154154

155-
boolexecute(ITEM*curitem,void*checkval,
155+
boolltree_execute(ITEM*curitem,void*checkval,
156156
boolcalcnot,bool (*chkcond) (void*checkval,ITEM*val));
157157

158158
intltree_compare(constltree*a,constltree*b);

‎contrib/ltree/ltree_gist.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ hashing(BITVECP sign, ltree *t) {
130130
inthash;
131131

132132
while(tlen>0) {
133-
hash=crc32_sz(cur->name,cur->len );
133+
hash=ltree_crc32_sz(cur->name,cur->len );
134134
HASH(sign,hash );
135135
cur=LEVEL_NEXT(cur);
136136
tlen--;
@@ -511,7 +511,7 @@ gist_qtxt(ltree_gist *key, ltxtquery* query) {
511511
if (LTG_ISALLTRUE(key) )
512512
return true;
513513

514-
returnexecute(
514+
returnltree_execute(
515515
GETQUERY(query),
516516
(void*)LTG_SIGN(key), false,
517517
checkcondition_bit

‎contrib/ltree/ltree_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ lquery_in(PG_FUNCTION_ARGS) {
333333
cur->totallen+=MAXALIGN(LVAR_HDRSIZE+lptr->len);
334334
lrptr->len=lptr->len;
335335
lrptr->flag=lptr->flag;
336-
lrptr->val=crc32_sz((uint8*)lptr->start,lptr->len);
336+
lrptr->val=ltree_crc32_sz((uint8*)lptr->start,lptr->len);
337337
memcpy(lrptr->name,lptr->start,lptr->len);
338338
lptr++;
339339
lrptr=LVAR_NEXT(lrptr );

‎contrib/ltree/ltxtquery_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ pushval_asis(QPRS_STATE * state, int type, char *strval, int lenval, uint16 flag
154154
if (lenval>0xffff)
155155
elog(ERROR,"Word is too long");
156156

157-
pushquery(state,type,crc32_sz((uint8*)strval,lenval),
157+
pushquery(state,type,ltree_crc32_sz((uint8*)strval,lenval),
158158
state->curop-state->op,lenval,flag);
159159

160160
while (state->curop-state->op+lenval+1 >=state->lenop)

‎contrib/ltree/ltxtquery_op.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ PG_FUNCTION_INFO_V1(ltxtq_rexec);
1313
* check for boolean condition
1414
*/
1515
bool
16-
execute(ITEM*curitem,void*checkval,boolcalcnot,bool (*chkcond) (void*checkval,ITEM*val)) {
16+
ltree_execute(ITEM*curitem,void*checkval,boolcalcnot,bool (*chkcond) (void*checkval,ITEM*val)) {
1717
if (curitem->type==VAL)
1818
return (*chkcond) (checkval,curitem);
1919
elseif (curitem->val== (int4)'!') {
2020
return (calcnot) ?
21-
((execute(curitem+1,checkval,calcnot,chkcond)) ? false : true)
21+
((ltree_execute(curitem+1,checkval,calcnot,chkcond)) ? false : true)
2222
: true;
2323
}elseif (curitem->val== (int4)'&') {
24-
if (execute(curitem+curitem->left,checkval,calcnot,chkcond))
25-
returnexecute(curitem+1,checkval,calcnot,chkcond);
24+
if (ltree_execute(curitem+curitem->left,checkval,calcnot,chkcond))
25+
returnltree_execute(curitem+1,checkval,calcnot,chkcond);
2626
else
2727
return false;
2828
}else {/* |-operator */
29-
if (execute(curitem+curitem->left,checkval,calcnot,chkcond))
29+
if (ltree_execute(curitem+curitem->left,checkval,calcnot,chkcond))
3030
return true;
3131
else
32-
returnexecute(curitem+1,checkval,calcnot,chkcond);
32+
returnltree_execute(curitem+1,checkval,calcnot,chkcond);
3333
}
3434
return false;
3535
}
@@ -76,7 +76,7 @@ ltxtq_exec(PG_FUNCTION_ARGS) {
7676
chkval.node=val;
7777
chkval.operand=GETOPERAND(query);
7878

79-
result=execute(
79+
result=ltree_execute(
8080
GETQUERY(query),
8181
&chkval,
8282
true,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp