25 #include "my_global.h"                           
   30 #if defined(HAVE_STRINGS_H) 
   33 #if defined(HAVE_STRING_H) 
   41 #if defined(HAVE_MEMORY_H) && !defined(__cplusplus) 
   45 #define bfill please_use_memset_rather_than_bfill() 
   46 #define bzero please_use_memset_rather_than_bzero() 
   48 #if !defined(HAVE_MEMCPY) && !defined(HAVE_MEMMOVE) 
   49 # define memcpy(d, s, n)        bcopy ((s), (d), (n)) 
   50 # define memmove(d, s, n)       bmove ((d), (s), (n)) 
   51 #elif defined(HAVE_MEMMOVE) 
   52 # define bmove(d, s, n)         memmove((d), (s), (n)) 
   55 #if defined(__cplusplus) 
   64 extern void *(*my_str_malloc)(size_t);
 
   65 extern void *(*my_str_realloc)(
void *, size_t);
 
   66 extern void (*my_str_free)(
void *);
 
   68 #if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER) 
   69 #define strmov(A,B) __builtin_stpcpy((A),(B)) 
   70 #elif defined(HAVE_STPCPY) 
   71 #define strmov(A,B) stpcpy((A),(B)) 
   73 extern char *stpcpy(
char *, 
const char *);      
 
   78 extern char _dig_vec_upper[];
 
   79 extern char _dig_vec_lower[];
 
   82 #define strmov_overlapp(A,B) strmov(A,B) 
   83 #define strmake_overlapp(A,B,C) strmake(A,B,C) 
   88 extern  void bmove_upp(uchar *dst,
const uchar *src,
size_t len);
 
   89 extern  void bchange(uchar *dst,
size_t old_len,
const uchar *src,
 
   90                      size_t new_len,
size_t tot_len);
 
   91 extern  void strappend(
char *s,
size_t len,pchar fill);
 
   92 extern  char *strend(
const char *s);
 
   93 extern  char *strcend(
const char *, pchar);
 
   94 extern  char *strfill(
char * s,
size_t len,pchar fill);
 
   95 extern  char *strmake(
char *dst,
const char *src,
size_t length);
 
   98 extern  char *strmov(
char *dst,
const char *src);
 
  100 extern  char *strmov_overlapp(
char *dst,
const char *src);
 
  102 extern  char *strnmov(
char *dst, 
const char *src, 
size_t n);
 
  103 extern  char *strcont(
const char *src, 
const char *
set);
 
  104 extern  char *strxmov(
char *dst, 
const char *src, ...);
 
  105 extern  char *strxnmov(
char *dst, 
size_t len, 
const char *src, ...);
 
  109 extern size_t strnlen(
const char *s, 
size_t n);
 
  112 extern int is_prefix(
const char *, 
const char *);
 
  120 double my_strtod(
const char *str, 
char **end, 
int *error);
 
  121 double my_atof(
const char *nptr);
 
  122 size_t my_fcvt(
double x, 
int precision, 
char *
to, my_bool *error);
 
  123 size_t my_gcvt(
double x, my_gcvt_arg_type 
type, 
int width, 
char *
to,
 
  126 #define NOT_FIXED_DEC 31 
  133 #define FLOATING_POINT_BUFFER (311 + NOT_FIXED_DEC) 
  143 #define MAX_DECPT_FOR_F_FORMAT DBL_DIG 
  150 #define MY_GCVT_MAX_FIELD_WIDTH (DBL_DIG + 4 + MY_MAX(5, MAX_DECPT_FOR_F_FORMAT)) \ 
  152 extern char *llstr(longlong value,
char *buff);
 
  153 extern char *ullstr(longlong value,
char *buff);
 
  155 extern long strtol(
const char *str, 
char **ptr, 
int base);
 
  156 extern ulong strtoul(
const char *str, 
char **ptr, 
int base);
 
  159 extern char *int2str(
long val, 
char *dst, 
int radix, 
int upcase);
 
  160 extern char *int10_to_str(
long val,
char *dst,
int radix);
 
  161 extern char *str2int(
const char *src,
int radix,
long lower,
long upper,
 
  163 longlong my_strtoll10(
const char *nptr, 
char **endptr, 
int *error);
 
  164 #if SIZEOF_LONG == SIZEOF_LONG_LONG 
  165 #define ll2str(A,B,C,D) int2str((A),(B),(C),(D)) 
  166 #define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) 
  168 #define strtoll(A,B,C) strtol((A),(B),(C)) 
  169 #define strtoull(A,B,C) strtoul((A),(B),(C)) 
  170 #ifndef HAVE_STRTOULL 
  171 #define HAVE_STRTOULL 
  177 #ifdef HAVE_LONG_LONG 
  178 extern char *ll2str(longlong val,
char *dst,
int radix, 
int upcase);
 
  179 extern char *longlong10_to_str(longlong val,
char *dst,
int radix);
 
  180 #if (!defined(HAVE_STRTOULL) || defined(NO_STRTOLL_PROTO)) 
  181 extern longlong strtoll(
const char *str, 
char **ptr, 
int base);
 
  182 extern ulonglong strtoull(
const char *str, 
char **ptr, 
int base);
 
  186 #define longlong2str(A,B,C) ll2str((A),(B),(C),1) 
  188 #if defined(__cplusplus) 
  197 #include <mysql/plugin.h> 
  200 #define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1)) 
  201 #define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1)) 
  202 #define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1)) 
  213 #define SPACE_INT 0x20202020 
  214 #elif SIZEOF_INT == 8 
  215 #define SPACE_INT 0x2020202020202020 
  217 #error define the appropriate constant for a word full of spaces 
  254 static inline const uchar *skip_trailing_space(
const uchar *ptr,
size_t len)
 
  256   const uchar *end= ptr + len;
 
  260     const uchar *end_words= (
const uchar *)(intptr)
 
  261       (((ulonglong)(intptr)end) / SIZEOF_INT * SIZEOF_INT);
 
  262     const uchar *start_words= (
const uchar *)(intptr)
 
  263        ((((ulonglong)(intptr)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT);
 
  265     DBUG_ASSERT(((ulonglong)(intptr)ptr) >= SIZEOF_INT);
 
  268       while (end > end_words && end[-1] == 0x20)
 
  270       if (end[-1] == 0x20 && start_words < end_words)
 
  271         while (end > start_words && ((
unsigned *)end)[-1] == SPACE_INT)
 
  275   while (end > ptr && end[-1] == 0x20)
 
  280 static inline void lex_string_set(
LEX_STRING *lex_str, 
const char *c_str)
 
  282   lex_str->str= (
char *) c_str;
 
  283   lex_str->length= strlen(c_str);