MySQL 8.0.40
Source Code Documentation
ctype-simple.cc File Reference
#include <assert.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <algorithm>
#include <limits>
#include "m_ctype.h"
#include "m_string.h"
#include "my_compiler.h"
#include "my_inttypes.h"
#include "my_macros.h"
#include "my_sys.h"
#include "template_utils.h"

Classes

struct  uni_idx
 

Macros

#define likeconv(s, A)   (uchar)(s)->sort_order[(uchar)(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, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
 
int my_strnncoll_simple (const CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, bool t_is_prefix)
 
int my_strnncollsp_simple (const CHARSET_INFO *cs, const uchar *a, size_t a_length, const uchar *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 uchar *str, const uchar *end)
 
int my_wc_mb_8bit (const CHARSET_INFO *cs, my_wc_t wc, uchar *str, uchar *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 uchar *key, size_t len, uint64 *nr1, uint64 *nr2)
 
long my_strntol_8bit (const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
 
ulong my_strntoul_8bit (const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
 
longlong my_strntoll_8bit (const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
 
ulonglong 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, longlong 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)
 
uint 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, uint 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)
 
static void set_max_sort_char (CHARSET_INFO *cs)
 
static bool my_coll_init_simple (CHARSET_INFO *cs, MY_CHARSET_LOADER *loader)
 
longlong 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 uchar *s, const uchar *e)
 
ulonglong 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 uchar *str, size_t length)
 
bool my_propagate_complex (const CHARSET_INFO *cs, const uchar *str, size_t length)
 
uint my_strxfrm_flag_normalize (uint flags)
 
size_t my_strxfrm_pad (const CHARSET_INFO *cs, uchar *str, uchar *frmend, uchar *strend, uint nweights, uint 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 ulonglong 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,
 
)    (uchar)(s)->sort_order[(uchar)(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 loader 
)
static

◆ my_cset_init_8bit()

static bool my_cset_init_8bit ( CHARSET_INFO cs,
MY_CHARSET_LOADER loader 
)
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 uchar key,
size_t  len,
uint64 nr1,
uint64 nr2 
)

◆ my_instr_simple()

uint 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,
uint  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,
longlong  val 
)

◆ my_mb_ctype_8bit()

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

◆ my_mb_wc_8bit()

int my_mb_wc_8bit ( const CHARSET_INFO cs,
my_wc_t wc,
const uchar str,
const uchar 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 uchar str,
size_t  length 
)

◆ my_propagate_simple()

bool my_propagate_simple ( const CHARSET_INFO cs,
const uchar 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 uchar s,
size_t  slen,
const uchar t,
size_t  tlen,
bool  t_is_prefix 
)

◆ my_strnncollsp_simple()

int my_strnncollsp_simple ( const CHARSET_INFO cs,
const uchar a,
size_t  a_length,
const uchar 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()

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

◆ my_strntoul_8bit()

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

◆ my_strntoull10rnd_8bit()

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

◆ my_strntoull_8bit()

ulonglong 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,
uchar dst,
size_t  dstlen,
uint  nweights,
const uchar src,
size_t  srclen,
uint  flags 
)

◆ my_strnxfrmlen_simple()

size_t my_strnxfrmlen_simple ( const CHARSET_INFO cs,
size_t  len 
)

◆ my_strtoll10_8bit()

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

◆ my_strxfrm_flag_normalize()

uint my_strxfrm_flag_normalize ( uint  flags)

◆ my_strxfrm_pad()

size_t my_strxfrm_pad ( const CHARSET_INFO cs,
uchar str,
uchar frmend,
uchar strend,
uint  nweights,
uint  flags 
)

◆ my_wc_mb_8bit()

int my_wc_mb_8bit ( const CHARSET_INFO cs,
my_wc_t  wc,
uchar str,
uchar 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

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,
ulong my_strntoul_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:397
size_t my_numcells_8bit(const CHARSET_INFO *cs, const char *b, const char *e)
Definition: ctype-simple.cc:917
int my_mb_ctype_8bit(const CHARSET_INFO *cs, int *ctype, const uchar *s, const uchar *e)
Definition: ctype-simple.cc:1144
ulonglong my_strntoull_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:549
size_t my_longlong10_to_str_8bit(const CHARSET_INFO *cs, char *dst, size_t len, int radix, longlong val)
Definition: ctype-simple.cc:695
longlong my_strntoll_8bit(const CHARSET_INFO *cs, const char *nptr, size_t l, int base, const char **endptr, int *err)
Definition: ctype-simple.cc:470
size_t my_caseup_8bit(const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-simple.cc:225
double my_strntod_8bit(const CHARSET_INFO *cs, const char *str, size_t length, const char **end, int *err)
Definition: ctype-simple.cc:646
size_t my_numchars_8bit(const CHARSET_INFO *cs, const char *b, const char *e)
Definition: ctype-simple.cc:912
size_t my_caseup_str_8bit(const CHARSET_INFO *cs, char *str)
Definition: ctype-simple.cc:211
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:659
size_t my_lengthsp_8bit(const CHARSET_INFO *cs, const char *ptr, size_t length)
Definition: ctype-simple.cc:936
size_t my_casedn_str_8bit(const CHARSET_INFO *cs, char *str)
Definition: ctype-simple.cc:218
size_t my_snprintf_8bit(const CHARSET_INFO *cs, char *to, size_t n, const char *fmt,...)
Definition: ctype-simple.cc:281
int my_mb_wc_8bit(const CHARSET_INFO *cs, my_wc_t *wc, const uchar *str, const uchar *end)
Definition: ctype-simple.cc:252
longlong my_strtoll10_8bit(const CHARSET_INFO *cs, const char *nptr, const char **endptr, int *error)
Definition: ctype-simple.cc:1139
int my_wc_mb_8bit(const CHARSET_INFO *cs, my_wc_t wc, uchar *str, uchar *end)
Definition: ctype-simple.cc:260
void my_fill_8bit(const CHARSET_INFO *cs, char *s, size_t l, int fill)
Definition: ctype-simple.cc:907
static bool my_cset_init_8bit(CHARSET_INFO *cs, MY_CHARSET_LOADER *loader)
Definition: ctype-simple.cc:1108
size_t my_casedn_8bit(const CHARSET_INFO *cs, char *src, size_t srclen, char *dst, size_t dstlen)
Definition: ctype-simple.cc:235
size_t my_charpos_8bit(const CHARSET_INFO *cs, const char *b, const char *e, size_t pos)
Definition: ctype-simple.cc:922
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:928
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:318
ulonglong 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:1235
size_t my_scan_8bit(const CHARSET_INFO *cs, const char *str, const char *end, int sq)
Definition: ctype-simple.cc:885
uint my_mbcharlen_8bit(const CHARSET_INFO *, uint c)
Definition: ctype-bin.cc:227

◆ my_charset_ascii_handler

◆ my_collation_8bit_simple_ci_handler

MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler
Initial value:
= {
nullptr,
size_t my_strnxfrm_simple(const CHARSET_INFO *cs, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags)
Definition: ctype-simple.cc:107
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:842
uint 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, uint nmatch)
Definition: ctype-simple.cc:943
static bool my_coll_init_simple(CHARSET_INFO *cs, MY_CHARSET_LOADER *loader)
Definition: ctype-simple.cc:1132
int my_strnncollsp_simple(const CHARSET_INFO *cs, const uchar *a, size_t a_length, const uchar *b, size_t b_length)
Definition: ctype-simple.cc:179
int my_strcasecmp_8bit(const CHARSET_INFO *cs, const char *s, const char *t)
Definition: ctype-simple.cc:245
size_t my_strnxfrmlen_simple(const CHARSET_INFO *cs, size_t len)
Definition: ctype-simple.cc:64
void my_hash_sort_simple(const CHARSET_INFO *cs, const uchar *key, size_t len, uint64 *nr1, uint64 *nr2)
Definition: ctype-simple.cc:291
bool my_propagate_simple(const CHARSET_INFO *cs, const uchar *str, size_t length)
Definition: ctype-simple.cc:1484
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:818
int my_strnncoll_simple(const CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *t, size_t tlen, bool t_is_prefix)
Definition: ctype-simple.cc:137