1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Add routines to help with single-byte (internal) character type support.

This commit is contained in:
Thomas G. Lockhart
1998-12-13 23:36:48 +00:00
parent f9f4004b7c
commit 239564e9ef
3 changed files with 42 additions and 14 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.19 1998/09/01 03:25:50 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.20 1998/12/13 23:35:48 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@ -29,7 +29,7 @@ int32
charin(char *ch)
{
if (ch == NULL)
return (int32) NULL;
return (int32) '\0';
return (int32) *ch;
}
@ -153,3 +153,21 @@ cideq(int8 arg1, int8 arg2)
{
return arg1 == arg2;
}
int8
text_char(text *arg1)
{
return ((int8) *(VARDATA(arg1)));
}
text *
char_text(int8 arg1)
{
text *result;
result = palloc(VARHDRSZ+1);
VARSIZE(result) = VARHDRSZ+1;
*(VARDATA(result)) = arg1;
return result;
}