mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 22:11:21 +02:00
Change logic slightly to avoid one unnecessary calculation. No big deal.
This commit is contained in:
parent
c06331a47d
commit
ed14f88512
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.13 1997/12/16 15:59:09 thomas Exp $
|
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.14 1997/12/23 19:24:43 thomas Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -49,12 +49,12 @@
|
|||||||
* len is the length specified in () plus VARHDRSZ bytes. (XXX dummy is here
|
* len is the length specified in () plus VARHDRSZ bytes. (XXX dummy is here
|
||||||
* because we pass typelem as the second argument for array_in.)
|
* because we pass typelem as the second argument for array_in.)
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
bpcharin(char *s, int dummy, int typlen)
|
bpcharin(char *s, int dummy, int typlen)
|
||||||
{
|
{
|
||||||
char *result,
|
char *result,
|
||||||
*r;
|
*r;
|
||||||
int len = typlen - VARHDRSZ;
|
int len;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
@ -69,6 +69,10 @@ bpcharin(char *s, int dummy, int typlen)
|
|||||||
len = strlen(s);
|
len = strlen(s);
|
||||||
typlen = len + VARHDRSZ;
|
typlen = len + VARHDRSZ;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len = typlen - VARHDRSZ;
|
||||||
|
}
|
||||||
|
|
||||||
if (len > 4096)
|
if (len > 4096)
|
||||||
elog(WARN, "bpcharin: length of char() must be less than 4096");
|
elog(WARN, "bpcharin: length of char() must be less than 4096");
|
||||||
@ -90,7 +94,7 @@ bpcharin(char *s, int dummy, int typlen)
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
bpcharout(char *s)
|
bpcharout(char *s)
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
@ -150,7 +154,7 @@ varcharin(char *s, int dummy, int typlen)
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
varcharout(char *s)
|
varcharout(char *s)
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
|
Loading…
Reference in New Issue
Block a user