Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
0346ab71
Commit
0346ab71
authored
Jun 11, 1997
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lexicographically compare 'char' and 'text'.
parent
dee872de
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
31 deletions
+12
-31
src/backend/utils/adt/char.c
src/backend/utils/adt/char.c
+1
-8
src/backend/utils/adt/varlena.c
src/backend/utils/adt/varlena.c
+11
-23
No files found.
src/backend/utils/adt/char.c
View file @
0346ab71
...
...
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.
4 1997/05/17 06:20:34 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.
5 1997/06/11 05:17:58 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -129,17 +129,10 @@ char *char16out(char *s)
bool
chareq
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
==
arg2
);
}
bool
charne
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
!=
arg2
);
}
#ifdef UNSIGNED_CHAR_TEXT
bool
charlt
(
int8
arg1
,
int8
arg2
)
{
return
((
uint8
)
arg1
<
(
uint8
)
arg2
);
}
bool
charle
(
int8
arg1
,
int8
arg2
)
{
return
((
uint8
)
arg1
<=
(
uint8
)
arg2
);
}
bool
chargt
(
int8
arg1
,
int8
arg2
)
{
return
((
uint8
)
arg1
>
(
uint8
)
arg2
);
}
bool
charge
(
int8
arg1
,
int8
arg2
)
{
return
((
uint8
)
arg1
>=
(
uint8
)
arg2
);
}
#else
bool
charlt
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
<
arg2
);
}
bool
charle
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
<=
arg2
);
}
bool
chargt
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
>
arg2
);
}
bool
charge
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
>=
arg2
);
}
#endif
int8
charpl
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
+
arg2
);
}
int8
charmi
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
-
arg2
);
}
int8
charmul
(
int8
arg1
,
int8
arg2
)
{
return
(
arg1
*
arg2
);
}
...
...
src/backend/utils/adt/varlena.c
View file @
0346ab71
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.1
5 1997/04/25 18:40:39 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.1
6 1997/06/11 05:18:02 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -301,10 +301,7 @@ text_lt(struct varlena *arg1, struct varlena *arg2)
int
cval
;
#endif
int
len
;
#ifdef UNSIGNED_CHAR_TEXT
unsigned
#endif
char
*
a1p
,
*
a2p
;
unsigned
char
*
a1p
,
*
a2p
;
if
(
arg1
==
NULL
||
arg2
==
NULL
)
return
((
bool
)
FALSE
);
...
...
@@ -312,11 +309,8 @@ text_lt(struct varlena *arg1, struct varlena *arg2)
len
=
(((
VARSIZE
(
arg1
)
<=
VARSIZE
(
arg2
))
?
VARSIZE
(
arg1
)
:
VARSIZE
(
arg2
))
-
VARHDRSZ
);
#ifdef USE_LOCALE
if
(
!
PointerIsValid
(
a1p
=
PALLOC
(
len
+
1
))
||
!
PointerIsValid
(
a2p
=
PALLOC
(
len
+
1
)))
{
elog
(
WARN
,
"Unable to allocate memory for text comparison"
,
NULL
);
return
(
FALSE
);
};
a1p
=
(
unsigned
char
*
)
palloc
(
len
+
1
);
a2p
=
(
unsigned
char
*
)
palloc
(
len
+
1
);
memcpy
(
a1p
,
VARDATA
(
arg1
),
len
);
*
(
a1p
+
len
)
=
'\0'
;
...
...
@@ -326,8 +320,8 @@ text_lt(struct varlena *arg1, struct varlena *arg2)
cval
=
strcoll
(
a1p
,
a2p
);
result
=
((
cval
<
0
)
||
((
cval
==
0
)
&&
(
VARSIZE
(
arg1
)
<
VARSIZE
(
arg2
))));
PFREE
(
a1p
);
PFREE
(
a2p
);
pfree
(
a1p
);
pfree
(
a2p
);
#else
a1p
=
(
unsigned
char
*
)
VARDATA
(
arg1
);
a2p
=
(
unsigned
char
*
)
VARDATA
(
arg2
);
...
...
@@ -360,10 +354,7 @@ text_le(struct varlena *arg1, struct varlena *arg2)
int
cval
;
#endif
int
len
;
#ifdef UNSIGNED_CHAR_TEXT
unsigned
#endif
char
*
a1p
,
*
a2p
;
unsigned
char
*
a1p
,
*
a2p
;
if
(
arg1
==
NULL
||
arg2
==
NULL
)
return
((
bool
)
0
);
...
...
@@ -371,11 +362,8 @@ text_le(struct varlena *arg1, struct varlena *arg2)
len
=
(((
VARSIZE
(
arg1
)
<=
VARSIZE
(
arg2
))
?
VARSIZE
(
arg1
)
:
VARSIZE
(
arg2
))
-
VARHDRSZ
);
#ifdef USE_LOCALE
if
(
!
PointerIsValid
(
a1p
=
PALLOC
(
len
+
1
))
||
!
PointerIsValid
(
a2p
=
PALLOC
(
len
+
1
)))
{
elog
(
WARN
,
"Unable to allocate memory for text comparison"
,
NULL
);
return
(
FALSE
);
};
a1p
=
(
unsigned
char
*
)
palloc
(
len
+
1
);
a2p
=
(
unsigned
char
*
)
palloc
(
len
+
1
);
memcpy
(
a1p
,
VARDATA
(
arg1
),
len
);
*
(
a1p
+
len
)
=
'\0'
;
...
...
@@ -385,8 +373,8 @@ text_le(struct varlena *arg1, struct varlena *arg2)
cval
=
strcoll
(
a1p
,
a2p
);
result
=
((
cval
<
0
)
||
((
cval
==
0
)
&&
(
VARSIZE
(
arg1
)
<=
VARSIZE
(
arg2
))));
PFREE
(
a1p
);
PFREE
(
a2p
);
pfree
(
a1p
);
pfree
(
a2p
);
#else
a1p
=
(
unsigned
char
*
)
VARDATA
(
arg1
);
a2p
=
(
unsigned
char
*
)
VARDATA
(
arg2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment