PostgreSQL Source Code git master
crc32.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define crc32(buf)   ltree_crc32_sz((buf),strlen(buf))
 

Functions

unsigned int ltree_crc32_sz (const char *buf, int size)
 

Macro Definition Documentation

◆ crc32

#define crc32 (   buf)    ltree_crc32_sz((buf),strlen(buf))

Definition at line 10 of file crc32.h.

Function Documentation

◆ ltree_crc32_sz()

unsigned int ltree_crc32_sz ( const char *  buf,
int  size 
)

Definition at line 22 of file crc32.c.

23{
25 const char *p = buf;
26 static pg_locale_t locale = NULL;
27
28 if (!locale)
30
32 while (size > 0)
33 {
34 char foldstr[UNICODE_CASEMAP_BUFSZ];
35 int srclen = pg_mblen(p);
36 size_t foldlen;
37
38 /* fold one codepoint at a time */
39 foldlen = pg_strfold(foldstr, UNICODE_CASEMAP_BUFSZ, p, srclen,
40 locale);
41
42 COMP_TRADITIONAL_CRC32(crc, foldstr, foldlen);
43
44 size -= srclen;
45 p += srclen;
46 }
48 return (unsigned int) crc;
49}
static char * locale
Definition: initdb.c:140
int pg_mblen(const char *mbstr)
Definition: mbutils.c:1026
return crc
uint32 pg_crc32
Definition: pg_crc.h:37
#define FIN_TRADITIONAL_CRC32(crc)
Definition: pg_crc.h:47
#define INIT_TRADITIONAL_CRC32(crc)
Definition: pg_crc.h:46
#define COMP_TRADITIONAL_CRC32(crc, data, len)
Definition: pg_crc.h:48
size_t pg_strfold(char *dst, size_t dstsize, const char *src, ssize_t srclen, pg_locale_t locale)
Definition: pg_locale.c:1348
pg_locale_t pg_database_locale(void)
Definition: pg_locale.c:1175
#define UNICODE_CASEMAP_BUFSZ
Definition: pg_locale.h:32
static char buf[DEFAULT_XLOG_SEG_SIZE]
Definition: pg_test_fsync.c:71

References buf, COMP_TRADITIONAL_CRC32, crc, FIN_TRADITIONAL_CRC32, INIT_TRADITIONAL_CRC32, locale, pg_database_locale(), pg_mblen(), pg_strfold(), and UNICODE_CASEMAP_BUFSZ.

Referenced by gist_te(), hashing(), parse_lquery(), and pushval_asis().