Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1561684

Browse files
committed
Compare 'char' and 'text' lexicographically.
1 parent 0346ab7 commit 1561684

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/backend/access/nbtree/nbtcompare.c

+5-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.9 1997/05/22 00:07:15 scrappy Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.10 1997/06/11 05:20:05 vadim Exp $
1111
*
1212
* NOTES
1313
* These functions are stored in pg_amproc. For each operator class
@@ -98,7 +98,7 @@ btabstimecmp(AbsoluteTime a, AbsoluteTime b)
9898
int32
9999
btcharcmp(char a, char b)
100100
{
101-
return ((int32) (a - b));
101+
return ((int32) ((uint8)a - (uint8)b));
102102
}
103103

104104
int32
@@ -135,9 +135,9 @@ int32
135135
bttextcmp(struct varlena *a, struct varlena *b)
136136
{
137137
int res;
138+
unsigned char *ap, *bp;
138139

139140
#ifdef USE_LOCALE
140-
unsigned char *ap, *bp;
141141
int la = VARSIZE(a) - VARHDRSZ;
142142
int lb = VARSIZE(b) - VARHDRSZ;
143143

@@ -155,7 +155,6 @@ bttextcmp(struct varlena *a, struct varlena *b)
155155
pfree (bp);
156156

157157
#else
158-
char *ap, *bp;
159158
int len = VARSIZE(a);
160159

161160
/* len is the length of the shorter of the two strings */
@@ -164,8 +163,8 @@ bttextcmp(struct varlena *a, struct varlena *b)
164163

165164
len -= VARHDRSZ;
166165

167-
ap = VARDATA(a);
168-
bp = VARDATA(b);
166+
ap = (unsigned char *) VARDATA(a);
167+
bp = (unsigned char *) VARDATA(b);
169168

170169
/*
171170
* If the two strings differ in the first len bytes, or if they're

0 commit comments

Comments
 (0)