PostgreSQL Source Code: src/backend/utils/adt/char.c File Reference (original) (raw)
#include "[postgres.h](postgres%5F8h%5Fsource.html)"#include <limits.h>#include "[libpq/pqformat.h](pqformat%5F8h%5Fsource.html)"#include "utils/fmgrprotos.h"#include "[varatt.h](varatt%5F8h%5Fsource.html)"
Include dependency graph for char.c:

Go to the source code of this file.
| Macros | |
|---|---|
| #define | ISOCTAL(c) (((c) >= '0') && ((c) <= '7')) |
| #define | TOOCTAL(c) ((c) + '0') |
| #define | FROMOCTAL(c) ((unsigned char) (c) - '0') |
Macro Definition Documentation
◆ FROMOCTAL
◆ ISOCTAL
| #define ISOCTAL | ( | | c | ) | (((c) >= '0') && ((c) <= '7')) | | --------------------------------------------------------------------------- | - | | --------------------------------------------------------------- | - | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
Definition at line 24 of file char.c.
◆ TOOCTAL
Function Documentation
◆ char_text()
Definition at line 228 of file char.c.
229{
232
233 /*
234 * Conversion rules are the same as in charout(), but here we need to be
235 * honest about converting 0x00 to an empty string.
236 */
238 {
240 (VARDATA(result))[0] = '\\';
244 }
245 else if (arg1 != '\0')
246 {
249 }
250 else
252
254}
#define IS_HIGHBIT_SET(ch)
#define PG_GETARG_CHAR(n)
#define PG_RETURN_TEXT_P(x)
static char * VARDATA(const void *PTR)
static void SET_VARSIZE(void *PTR, Size len)
References fb(), IS_HIGHBIT_SET, palloc(), PG_GETARG_CHAR, PG_RETURN_TEXT_P, SET_VARSIZE(), TOOCTAL, VARDATA(), and VARHDRSZ.
◆ chareq()
◆ charge()
◆ chargt()
◆ charin()
◆ charle()
◆ charlt()
◆ charne()
◆ charout()
Definition at line 64 of file char.c.
65{
67 char *result = (char *) palloc(5);
68
70 {
71 result[0] = '\\';
72 result[1] = TOOCTAL(((unsigned char) ch) >> 6);
73 result[2] = TOOCTAL((((unsigned char) ch) >> 3) & 07);
74 result[3] = TOOCTAL(((unsigned char) ch) & 07);
75 result[4] = '\0';
76 }
77 else
78 {
79 /* This produces acceptable results for 0x00 as well */
80 result[0] = ch;
81 result[1] = '\0';
82 }
84}
#define PG_RETURN_CSTRING(x)
References fb(), IS_HIGHBIT_SET, palloc(), PG_GETARG_CHAR, PG_RETURN_CSTRING, and TOOCTAL.
◆ charrecv()
◆ charsend()
◆ chartoi4()
◆ i4tochar()
◆ text_char()
Definition at line 204 of file char.c.
205{
208 char result;
209
210 /*
211 * Conversion rules are the same as in charin(), but here we need to
212 * handle the empty-string case honestly.
213 */
220 result = ch[0];
221 else
222 result = '\0';
223
225}
#define PG_GETARG_TEXT_PP(n)
static Size VARSIZE_ANY_EXHDR(const void *PTR)
static char * VARDATA_ANY(const void *PTR)
References fb(), FROMOCTAL, ISOCTAL, PG_GETARG_TEXT_PP, PG_RETURN_CHAR, VARDATA_ANY(), and VARSIZE_ANY_EXHDR().