Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
9f42a56a
Commit
9f42a56a
authored
27 years ago
by
Vadim B. Mikheev
Browse files
Options
Downloads
Patches
Plain Diff
Fix for text_lt/text_le to avoid warnings if not def USE_LOCALE.
parent
42e72503
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/utils/adt/varlena.c
+31
-31
31 additions, 31 deletions
src/backend/utils/adt/varlena.c
with
31 additions
and
31 deletions
src/backend/utils/adt/varlena.c
+
31
−
31
View file @
9f42a56a
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.1
3
1997/04/
09 08:29:35 scrappy
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.1
4
1997/04/
21 04:31:53 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -288,21 +288,19 @@ textne(struct varlena *arg1, struct varlena *arg2)
/* text_lt()
* Comparison function for text strings.
* Includes locale support, but must copy strings to temporary memory
* to allow null-termination for inputs to strcoll().
* XXX HACK code for textlen() indicates that there can be embedded nulls
* but it appears that most routines (incl. this one) assume not! - tgl 97/04/07
* to allow null-termination for inputs to strcoll().
*/
bool
text_lt
(
struct
varlena
*
arg1
,
struct
varlena
*
arg2
)
{
bool
result
;
int
cval
;
int
len
;
#ifdef UNSIGNED_CHAR_TEXT
unsigned
#endif
char
*
a1p
,
*
a2p
;
#ifdef USE_LOCALE
int
cval
;
#endif
if
(
arg1
==
NULL
||
arg2
==
NULL
)
return
((
bool
)
FALSE
);
...
...
@@ -310,11 +308,9 @@ 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
=
palloc
(
len
+
1
);
a2p
=
palloc
(
len
+
1
);
memcpy
(
a1p
,
VARDATA
(
arg1
),
len
);
*
(
a1p
+
len
)
=
'\0'
;
...
...
@@ -322,13 +318,15 @@ text_lt(struct varlena *arg1, struct varlena *arg2)
*
(
a2p
+
len
)
=
'\0'
;
cval
=
strcoll
(
a1p
,
a2p
);
result
=
((
cval
<
0
)
||
((
cval
==
0
)
&&
(
VARSIZE
(
arg1
)
<
VARSIZE
(
arg2
))));
pfree
(
a1p
);
pfree
(
a2p
);
PFREE
(
a1p
);
PFREE
(
a2p
);
return
((
bool
)
(
(
cval
<
0
)
||
(
(
cval
==
0
)
&&
(
VARSIZE
(
arg1
)
<
VARSIZE
(
arg2
))
)
)
);
return
(
result
);
#else
a1p
=
(
unsigned
char
*
)
VARDATA
(
arg1
);
a2p
=
(
unsigned
char
*
)
VARDATA
(
arg2
);
...
...
@@ -338,27 +336,27 @@ text_lt(struct varlena *arg1, struct varlena *arg2)
len
--
;
};
return
((
bool
)
(
len
?
(
*
a1p
<
*
a2p
)
:
(
VARSIZE
(
arg1
)
<
VARSIZE
(
arg2
))));
#endif
}
/* text_lt() */
/* text_le()
* Comparison function for text strings.
* Includes locale support, but must copy strings to temporary memory
* to allow null-termination for inputs to strcoll().
* XXX HACK code for textlen() indicates that there can be embedded nulls
* but it appears that most routines (incl. this one) assume not! - tgl 97/04/07
* to allow null-termination for inputs to strcoll().
*/
bool
text_le
(
struct
varlena
*
arg1
,
struct
varlena
*
arg2
)
{
bool
result
;
int
cval
;
int
len
;
#ifdef UNSIGNED_CHAR_TEXT
unsigned
#endif
char
*
a1p
,
*
a2p
;
#ifdef USE_LOCALE
int
cval
;
#endif
if
(
arg1
==
NULL
||
arg2
==
NULL
)
return
((
bool
)
0
);
...
...
@@ -366,11 +364,9 @@ 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
=
palloc
(
len
+
1
);
a2p
=
palloc
(
len
+
1
);
memcpy
(
a1p
,
VARDATA
(
arg1
),
len
);
*
(
a1p
+
len
)
=
'\0'
;
...
...
@@ -378,13 +374,15 @@ text_le(struct varlena *arg1, struct varlena *arg2)
*
(
a2p
+
len
)
=
'\0'
;
cval
=
strcoll
(
a1p
,
a2p
);
result
=
((
cval
<
0
)
||
((
cval
==
0
)
&&
(
VARSIZE
(
arg1
)
<=
VARSIZE
(
arg2
))));
pfree
(
a1p
);
pfree
(
a2p
);
PFREE
(
a1p
);
PFREE
(
a2p
);
return
((
bool
)
(
(
cval
<
0
)
||
(
(
cval
==
0
)
&&
(
VARSIZE
(
arg1
)
<=
VARSIZE
(
arg2
))
)
)
);
return
(
result
);
#else
a1p
=
(
unsigned
char
*
)
VARDATA
(
arg1
);
a2p
=
(
unsigned
char
*
)
VARDATA
(
arg2
);
...
...
@@ -395,7 +393,9 @@ text_le(struct varlena *arg1, struct varlena *arg2)
};
return
((
bool
)
(
len
?
(
*
a1p
<=
*
a2p
)
:
(
VARSIZE
(
arg1
)
<=
VARSIZE
(
arg2
))));
#endif
}
/* text_le() */
bool
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment