PostgreSQL Source Code  git master
crc32.c File Reference
#include "postgres.h"
#include "ltree.h"
#include <ctype.h>
#include "crc32.h"
#include "utils/pg_crc.h"
Include dependency graph for crc32.c:

Go to the source code of this file.

Macros

#define TOLOWER(x)   tolower((unsigned char) (x))
 

Functions

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

Macro Definition Documentation

◆ TOLOWER

#define TOLOWER (   x)    tolower((unsigned char) (x))

Definition at line 15 of file crc32.c.

Referenced by ltree_crc32_sz().

Function Documentation

◆ ltree_crc32_sz()

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

Definition at line 24 of file crc32.c.

References buf, COMP_TRADITIONAL_CRC32, FIN_TRADITIONAL_CRC32, INIT_TRADITIONAL_CRC32, and TOLOWER.

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

25 {
26  pg_crc32 crc;
27  const char *p = buf;
28 
30  while (size > 0)
31  {
32  char c = (char) TOLOWER(*p);
33 
34  COMP_TRADITIONAL_CRC32(crc, &c, 1);
35  size--;
36  p++;
37  }
39  return (unsigned int) crc;
40 }
#define COMP_TRADITIONAL_CRC32(crc, data, len)
Definition: pg_crc.h:48
#define TOLOWER(x)
Definition: crc32.c:15
#define INIT_TRADITIONAL_CRC32(crc)
Definition: pg_crc.h:46
char * c
static char * buf
Definition: pg_test_fsync.c:68
#define FIN_TRADITIONAL_CRC32(crc)
Definition: pg_crc.h:47
uint32 pg_crc32
Definition: pg_crc.h:37