Skip to content
Snippets Groups Projects
Commit 6316f4d3 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart
Browse files

Define text, varchar, and bpchar string length functions.

parent 6873af55
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.12 1997/12/06 22:57:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.13 1997/12/16 15:59:09 thomas Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -121,7 +121,7 @@ bpcharout(char *s)
* len is the length specified in () plus VARHDRSZ bytes. (XXX dummy is here
* because we pass typelem as the second argument for array_in.)
*/
char *
char *
varcharin(char *s, int dummy, int typlen)
{
char *result;
......@@ -191,6 +191,15 @@ bcTruelen(char *arg)
return (i + 1);
}
int32
bpcharlen(char *arg)
{
if (!PointerIsValid(arg))
elog(WARN, "Bad (null) char() external representation", NULL);
return(bcTruelen(arg));
} /* bpcharlen() */
bool
bpchareq(char *arg1, char *arg2)
{
......@@ -338,6 +347,15 @@ vcTruelen(char *arg)
return i;
}
int32
varcharlen(char *arg)
{
if (!PointerIsValid(arg))
elog(WARN, "Bad (null) varchar() external representation", NULL);
return(vcTruelen(arg));
} /* vclen() */
bool
varchareq(char *arg1, char *arg2)
{
......
......@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.24 1997/12/08 04:42:48 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varlena.c,v 1.25 1997/12/16 15:59:11 thomas Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -210,20 +210,14 @@ textout(struct varlena * vlena)
* returns the actual length of a text* (which may be less than
* the VARSIZE of the text*)
*/
#ifdef NOT_USED
int
textlen(text *t)
{
int i = 0;
int max = VARSIZE(t) - VARHDRSZ;
char *ptr = VARDATA(t);
while (i < max && *ptr++)
i++;
return i;
}
if (!PointerIsValid(t))
elog(WARN,"Null input to textlen");
#endif
return (VARSIZE(t) - VARHDRSZ);
} /* textlen() */
/*
* textcat -
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment