MySQL 8.4.2
Source Code Documentation
ctype-simple.cc File Reference
#include <algorithm>
#include <cassert>
#include <cerrno>
#include <climits>
#include <cstdarg>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <limits>
#include "m_string.h"
#include "my_compiler.h"
#include "my_sys.h"
#include "mysql/strings/dtoa.h"
#include "mysql/strings/m_ctype.h"
#include "mysql/strings/my_strtoll10.h"
#include "strings/m_ctype_internals.h"
#include "template_utils.h"

Classes

struct  uni_idx
 

Macros

#define likeconv(s, A)   (uint8_t)(s)->sort_order[(uint8_t)(A)]
 
#define INC_PTR(cs, A, B)   (A)++
 
#define PLANE_SIZE   0x100
 
#define PLANE_NUM   0x100
 
#define PLANE_NUMBER(x)   (((x) >> 8) % PLANE_NUM)
 

Functions

static longlong ulonglong_with_sign (bool negative, ulonglong ll)
 
size_t my_strnxfrmlen_simple (const CHARSET_INFO *cs, size_t len)
 
size_t my_strnxfrm_simple (const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, unsigned nweights, const uint8_t *src, size_t srclen, unsigned flags)
 
int my_strnncoll_simple (const CHARSET_INFO *cs, const uint8_t *s, size_t slen, const uint8_t *t, size_t tlen, bool t_is_prefix)
 
int my_strnncollsp_simple (const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length)
 
size_t my_caseup_str_8bit (const CHARSET_INFO *cs, char *str)
 
size_t my_casedn_str_8bit (const CHARSET_INFO *cs, char *str)
 
size_t my_caseup_8bit (const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
 
size_t my_casedn_8bit (const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
 
int my_strcasecmp_8bit (const CHARSET_INFO *cs, const char *s, const char *t)
 
int my_mb_wc_8bit (const CHARSET_INFO *cs, my_wc_t *wc, const uint8_t *str, const uint8_t *end)
 
int my_wc_mb_8bit (const CHARSET_INFO *cs, my_wc_t wc, uint8_t *str, uint8_t *end)
 
size_t my_snprintf_8bit (const CHARSET_INFO *cs, char *to, size_t n, const char *fmt,...)
 
void my_hash_sort_simple (const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
 
long my_strntol_8bit (const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
 
unsigned long my_strntoul_8bit (const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
 
long long my_strntoll_8bit (const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
 
unsigned long long my_strntoull_8bit (const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
 
double my_strntod_8bit (const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
 
size_t my_long10_to_str_8bit (const CHARSET_INFO *cs, char *dst, size_t len, int radix, long int val)
 
size_t my_longlong10_to_str_8bit (const CHARSET_INFO *cs, char *dst, size_t len, int radix, long long val)
 
static int my_wildcmp_8bit_impl (const CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr_arg, const char *wildend_arg, int escape, int w_one, int w_many, int recurse_level)
 
int my_wildcmp_8bit (const CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many)
 
bool my_like_range_simple (const CHARSET_INFO *cs, const char *ptr, size_t ptr_length, char escape, char w_one, char w_many, size_t res_length, char *min_str, char *max_str, size_t *min_length, size_t *max_length)
 
size_t my_scan_8bit (const CHARSET_INFO *cs, const char *str, const char *end, int sq)
 
void my_fill_8bit (const CHARSET_INFO *cs, char *s, size_t l, int fill)
 
size_t my_numchars_8bit (const CHARSET_INFO *cs, const char *b, const char *e)
 
size_t my_numcells_8bit (const CHARSET_INFO *cs, const char *b, const char *e)
 
size_t my_charpos_8bit (const CHARSET_INFO *cs, const char *b, const char *e, size_t pos)
 
size_t my_well_formed_len_8bit (const CHARSET_INFO *cs, const char *start, const char *end, size_t nchars, int *error)
 
size_t my_lengthsp_8bit (const CHARSET_INFO *cs, const char *ptr, size_t length)
 
unsigned my_instr_simple (const CHARSET_INFO *cs, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, unsigned nmatch)
 
static size_t my_well_formed_len_ascii (const CHARSET_INFO *cs, const char *start, const char *end, size_t nchars, int *error)
 
static int pcmp (const void *f, const void *s)
 
static bool create_fromuni (CHARSET_INFO *cs, MY_CHARSET_LOADER *loader)
 
static bool my_cset_init_8bit (CHARSET_INFO *cs, MY_CHARSET_LOADER *loader, MY_CHARSET_ERRMSG *)
 
static void set_max_sort_char (CHARSET_INFO *cs)
 
static bool my_coll_init_simple (CHARSET_INFO *cs, MY_CHARSET_LOADER *, MY_CHARSET_ERRMSG *)
 
long long my_strtoll10_8bit (const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
 
int my_mb_ctype_8bit (const CHARSET_INFO *cs, int *ctype, const uint8_t *s, const uint8_t *e)
 
unsigned long long my_strntoull10rnd_8bit (const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_flag, const char **endptr, int *error)
 
bool my_propagate_simple (const CHARSET_INFO *cs, const uint8_t *str, size_t length)
 
bool my_propagate_complex (const CHARSET_INFO *cs, const uint8_t *str, size_t length)
 
unsigned my_strxfrm_flag_normalize (unsigned flags)
 
size_t my_strxfrm_pad (const CHARSET_INFO *cs, uint8_t *str, uint8_t *frmend, uint8_t *strend, unsigned nweights, unsigned flags)
 

Variables

constexpr const uint64_t CUTOFF {ULLONG_MAX / 10}
 
constexpr const uint64_t CUTLIM {ULLONG_MAX % 10}
 
constexpr const int DIGITS_IN_ULONGLONG {20}
 
static unsigned long long d10 [DIGITS_IN_ULONGLONG]
 
MY_CHARSET_HANDLER my_charset_8bit_handler
 
MY_CHARSET_HANDLER my_charset_ascii_handler
 
MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler
 

Macro Definition Documentation

◆ INC_PTR

#define INC_PTR (   cs,
  A,
 
)    (A)++

◆ likeconv

#define likeconv (   s,
 
)    (uint8_t)(s)->sort_order[(uint8_t)(A)]

◆ PLANE_NUM

#define PLANE_NUM   0x100

◆ PLANE_NUMBER

#define PLANE_NUMBER (   x)    (((x) >> 8) % PLANE_NUM)

◆ PLANE_SIZE

#define PLANE_SIZE   0x100

Function Documentation

◆ create_fromuni()

static bool create_fromuni ( CHARSET_INFO cs,
MY_CHARSET_LOADER loader 
)
static

◆ my_casedn_8bit()

size_t my_casedn_8bit ( const CHARSET_INFO cs,
char *  src,
size_t  srclen,
char *  dst,
size_t  dstlen 
)

◆ my_casedn_str_8bit()

size_t my_casedn_str_8bit ( const CHARSET_INFO cs,
char *  str 
)

◆ my_caseup_8bit()

size_t my_caseup_8bit ( const CHARSET_INFO cs,
char *  src,
size_t  srclen,
char *  dst,
size_t  dstlen 
)

◆ my_caseup_str_8bit()

size_t my_caseup_str_8bit ( const CHARSET_INFO cs,
char *  str 
)

◆ my_charpos_8bit()

size_t my_charpos_8bit ( const CHARSET_INFO cs,
const char *  b,
const char *  e,
size_t  pos 
)

◆ my_coll_init_simple()

static bool my_coll_init_simple ( CHARSET_INFO cs,
MY_CHARSET_LOADER ,
MY_CHARSET_ERRMSG  
)
static

◆ my_cset_init_8bit()

static bool my_cset_init_8bit ( CHARSET_INFO cs,
MY_CHARSET_LOADER loader,
MY_CHARSET_ERRMSG  
)
static

◆ my_fill_8bit()

void my_fill_8bit ( const CHARSET_INFO cs,
char *  s,
size_t  l,
int  fill 
)

◆ my_hash_sort_simple()

void my_hash_sort_simple ( const CHARSET_INFO cs,
const uint8_t *  key,
size_t  len,
uint64_t *  nr1,
uint64_t *  nr2 
)

◆ my_instr_simple()

unsigned my_instr_simple ( const CHARSET_INFO cs,
const char *  b,
size_t  b_length,
const char *  s,
size_t  s_length,
my_match_t match,
unsigned  nmatch 
)

◆ my_lengthsp_8bit()

size_t my_lengthsp_8bit ( const CHARSET_INFO cs,
const char *  ptr,
size_t  length 
)

◆ my_like_range_simple()

bool my_like_range_simple ( const CHARSET_INFO cs,
const char *  ptr,
size_t  ptr_length,
char  escape,
char  w_one,
char  w_many,
size_t  res_length,
char *  min_str,
char *  max_str,
size_t *  min_length,
size_t *  max_length 
)

◆ my_long10_to_str_8bit()

size_t my_long10_to_str_8bit ( const CHARSET_INFO cs,
char *  dst,
size_t  len,
int  radix,
long int  val 
)

◆ my_longlong10_to_str_8bit()

size_t my_longlong10_to_str_8bit ( const CHARSET_INFO cs,
char *  dst,
size_t  len,
int  radix,
long long  val 
)

◆ my_mb_ctype_8bit()

int my_mb_ctype_8bit ( const CHARSET_INFO cs,
int *  ctype,
const uint8_t *  s,
const uint8_t *  e 
)

◆ my_mb_wc_8bit()

int my_mb_wc_8bit ( const CHARSET_INFO cs,
my_wc_t wc,
const uint8_t *  str,
const uint8_t *  end 
)

◆ my_numcells_8bit()

size_t my_numcells_8bit ( const CHARSET_INFO cs,
const char *  b,
const char *  e 
)

◆ my_numchars_8bit()

size_t my_numchars_8bit ( const CHARSET_INFO cs,
const char *  b,
const char *  e 
)

◆ my_propagate_complex()

bool my_propagate_complex ( const CHARSET_INFO cs,
const uint8_t *  str,
size_t  length 
)

◆ my_propagate_simple()

bool my_propagate_simple ( const CHARSET_INFO cs,
const uint8_t *  str,
size_t  length 
)

◆ my_scan_8bit()

size_t my_scan_8bit ( const CHARSET_INFO cs,
const char *  str,
const char *  end,
int  sq 
)

◆ my_snprintf_8bit()

size_t my_snprintf_8bit ( const CHARSET_INFO cs,
char *  to,
size_t  n,
const char *  fmt,
  ... 
)

◆ my_strcasecmp_8bit()

int my_strcasecmp_8bit ( const CHARSET_INFO cs,
const char *  s,
const char *  t 
)

◆ my_strnncoll_simple()

int my_strnncoll_simple ( const CHARSET_INFO cs,
const uint8_t *  s,
size_t  slen,
const uint8_t *  t,
size_t  tlen,
bool  t_is_prefix 
)

◆ my_strnncollsp_simple()

int my_strnncollsp_simple ( const CHARSET_INFO cs,
const uint8_t *  a,
size_t  a_length,
const uint8_t *  b,
size_t  b_length 
)

◆ my_strntod_8bit()

double my_strntod_8bit ( const CHARSET_INFO cs,
const char *  str,
size_t  length,
const char **  end,
int *  err 
)

◆ my_strntol_8bit()

long my_strntol_8bit ( const CHARSET_INFO cs,
const char *  nptr,
size_t  l,
int  base,
const char **  endptr,
int *  err 
)

◆ my_strntoll_8bit()

long long my_strntoll_8bit ( const CHARSET_INFO cs,
const char *  nptr,
size_t  l,
int  base,
const char **  endptr,
int *  err 
)

◆ my_strntoul_8bit()

unsigned long my_strntoul_8bit ( const CHARSET_INFO cs,
const char *  nptr,
size_t  l,
int  base,
const char **  endptr,
int *  err 
)

◆ my_strntoull10rnd_8bit()

unsigned long long my_strntoull10rnd_8bit ( const CHARSET_INFO cs,
const char *  str,
size_t  length,
int  unsigned_flag,
const char **  endptr,
int *  error 
)

◆ my_strntoull_8bit()

unsigned long long my_strntoull_8bit ( const CHARSET_INFO cs,
const char *  nptr,
size_t  l,
int  base,
const char **  endptr,
int *  err 
)

◆ my_strnxfrm_simple()

size_t my_strnxfrm_simple ( const CHARSET_INFO cs,
uint8_t *  dst,
size_t  dstlen,
unsigned  nweights,
const uint8_t *  src,
size_t  srclen,
unsigned  flags 
)

◆ my_strnxfrmlen_simple()

size_t my_strnxfrmlen_simple ( const CHARSET_INFO cs,
size_t  len 
)

◆ my_strtoll10_8bit()

long long my_strtoll10_8bit ( const CHARSET_INFO cs,
const char *  nptr,
const char **  endptr,
int *  error 
)

◆ my_strxfrm_flag_normalize()

unsigned my_strxfrm_flag_normalize ( unsigned  flags)

◆ my_strxfrm_pad()

size_t my_strxfrm_pad ( const CHARSET_INFO cs,
uint8_t *  str,
uint8_t *  frmend,
uint8_t *  strend,
unsigned  nweights,
unsigned  flags 
)

◆ my_wc_mb_8bit()

int my_wc_mb_8bit ( const CHARSET_INFO cs,
my_wc_t  wc,
uint8_t *  str,
uint8_t *  end 
)

◆ my_well_formed_len_8bit()

size_t my_well_formed_len_8bit ( const CHARSET_INFO cs,
const char *  start,
const char *  end,
size_t  nchars,
int *  error 
)

◆ my_well_formed_len_ascii()

static size_t my_well_formed_len_ascii ( const CHARSET_INFO cs,
const char *  start,
const char *  end,
size_t  nchars,
int *  error 
)
static

◆ my_wildcmp_8bit()

int my_wildcmp_8bit ( const CHARSET_INFO cs,
const char *  str,
const char *  str_end,
const char *  wildstr,
const char *  wildend,
int  escape,
int  w_one,
int  w_many 
)

◆ my_wildcmp_8bit_impl()

static int my_wildcmp_8bit_impl ( const CHARSET_INFO cs,
const char *  str,
const char *  str_end,
const char *  wildstr_arg,
const char *  wildend_arg,
int  escape,
int  w_one,
int  w_many,
int  recurse_level 
)
static

◆ pcmp()

static int pcmp ( const void *  f,
const void *  s 
)
static

◆ set_max_sort_char()

static void set_max_sort_char ( CHARSET_INFO cs)
static

◆ ulonglong_with_sign()

static longlong ulonglong_with_sign ( bool  negative,
ulonglong  ll 
)
inlinestatic

Variable Documentation

◆ CUTLIM

constexpr const uint64_t CUTLIM {ULLONG_MAX % 10}
constexpr

◆ CUTOFF

constexpr const uint64_t CUTOFF {ULLONG_MAX / 10}
constexpr

◆ d10

unsigned long long d10[DIGITS_IN_ULONGLONG]
static
Initial value:
= {1,
10,
100,
1000,
10000,
100000,
1000000,
10000000,
100000000,
1000000000,
10000000000ULL,
100000000000ULL,
1000000000000ULL,
10000000000000ULL,
100000000000000ULL,
1000000000000000ULL,
10000000000000000ULL,
100000000000000000ULL,
1000000000000000000ULL,
10000000000000000000ULL}

◆ DIGITS_IN_ULONGLONG

constexpr const int DIGITS_IN_ULONGLONG {20}
constexpr

◆ my_charset_8bit_handler

MY_CHARSET_HANDLER my_charset_8bit_handler
Initial value:
nullptr,
unsigned my_mbcharlen_8bit(const CHARSET_INFO *cs, unsigned c)
Definition: ctype-bin.cc:224
size_t my_numcells_8bit(const CHARSET_INFO *cs, const char *b, const char *e)
Definition: ctype-simple.cc:908
long long my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
Definition: ctype-simple.cc:1125
unsigned long long my_strntoull10rnd_8bit(const CHARSET_INFO *cs, const char *str, size_t length, int unsigned_flag, const char **endptr, int *error)
Definition: ctype-simple.cc:1221
size_t my_caseup_8bit(const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-simple.cc:221
double my_strntod_8bit(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: ctype-simple.cc:636
int my_mb_wc_8bit(const CHARSET_INFO *cs, my_wc_t *wc, const uint8_t *str, const uint8_t *end)
Definition: ctype-simple.cc:248
static bool my_cset_init_8bit(CHARSET_INFO *cs, MY_CHARSET_LOADER *loader, MY_CHARSET_ERRMSG *)
Definition: ctype-simple.cc:1096
size_t my_numchars_8bit(const CHARSET_INFO *cs, const char *b, const char *e)
Definition: ctype-simple.cc:903
long long my_strntoll_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:461
size_t my_longlong10_to_str_8bit(const CHARSET_INFO *cs, char *dst, size_t len, int radix, long long val)
Definition: ctype-simple.cc:686
int my_wc_mb_8bit(const CHARSET_INFO *cs, my_wc_t wc, uint8_t *str, uint8_t *end)
Definition: ctype-simple.cc:256
size_t my_caseup_str_8bit(const CHARSET_INFO *cs, char *str)
Definition: ctype-simple.cc:207
size_t my_long10_to_str_8bit(const CHARSET_INFO *cs, char *dst, size_t len, int radix, long int val)
Definition: ctype-simple.cc:650
size_t my_lengthsp_8bit(const CHARSET_INFO *cs, const char *ptr, size_t length)
Definition: ctype-simple.cc:927
size_t my_casedn_str_8bit(const CHARSET_INFO *cs, char *str)
Definition: ctype-simple.cc:214
unsigned long long my_strntoull_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:539
size_t my_snprintf_8bit(const CHARSET_INFO *cs, char *to, size_t n, const char *fmt,...)
Definition: ctype-simple.cc:278
void my_fill_8bit(const CHARSET_INFO *cs, char *s, size_t l, int fill)
Definition: ctype-simple.cc:898
unsigned long my_strntoul_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:389
size_t my_casedn_8bit(const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-simple.cc:231
size_t my_charpos_8bit(const CHARSET_INFO *cs, const char *b, const char *e, size_t pos)
Definition: ctype-simple.cc:913
int my_mb_ctype_8bit(const CHARSET_INFO *cs, int *ctype, const uint8_t *s, const uint8_t *e)
Definition: ctype-simple.cc:1130
size_t my_well_formed_len_8bit(const CHARSET_INFO *cs, const char *start, const char *end, size_t nchars, int *error)
Definition: ctype-simple.cc:919
long my_strntol_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:311
size_t my_scan_8bit(const CHARSET_INFO *cs, const char *str, const char *end, int sq)
Definition: ctype-simple.cc:876

◆ my_charset_ascii_handler

◆ my_collation_8bit_simple_ci_handler

MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler
Initial value:
= {
nullptr,
int my_strnncoll_simple(const CHARSET_INFO *cs, const uint8_t *s, size_t slen, const uint8_t *t, size_t tlen, bool t_is_prefix)
Definition: ctype-simple.cc:133
bool my_like_range_simple(const CHARSET_INFO *cs, const char *ptr, size_t ptr_length, char escape, char w_one, char w_many, size_t res_length, char *min_str, char *max_str, size_t *min_length, size_t *max_length)
Definition: ctype-simple.cc:833
size_t my_strnxfrm_simple(const CHARSET_INFO *cs, uint8_t *dst, size_t dstlen, unsigned nweights, const uint8_t *src, size_t srclen, unsigned flags)
Definition: ctype-simple.cc:105
bool my_propagate_simple(const CHARSET_INFO *cs, const uint8_t *str, size_t length)
Definition: ctype-simple.cc:1474
unsigned my_instr_simple(const CHARSET_INFO *cs, const char *b, size_t b_length, const char *s, size_t s_length, my_match_t *match, unsigned nmatch)
Definition: ctype-simple.cc:934
static bool my_coll_init_simple(CHARSET_INFO *cs, MY_CHARSET_LOADER *, MY_CHARSET_ERRMSG *)
Definition: ctype-simple.cc:1118
int my_strcasecmp_8bit(const CHARSET_INFO *cs, const char *s, const char *t)
Definition: ctype-simple.cc:241
size_t my_strnxfrmlen_simple(const CHARSET_INFO *cs, size_t len)
Definition: ctype-simple.cc:62
void my_hash_sort_simple(const CHARSET_INFO *cs, const uint8_t *key, size_t len, uint64_t *nr1, uint64_t *nr2)
Definition: ctype-simple.cc:288
int my_wildcmp_8bit(const CHARSET_INFO *cs, const char *str, const char *str_end, const char *wildstr, const char *wildend, int escape, int w_one, int w_many)
Definition: ctype-simple.cc:809
int my_strnncollsp_simple(const CHARSET_INFO *cs, const uint8_t *a, size_t a_length, const uint8_t *b, size_t b_length)
Definition: ctype-simple.cc:175