~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mystrings/m_string.h

  • Committer: Monty Taylor
  • Date: 2008-07-31 19:56:51 UTC
  • mto: (202.3.5 gettextize)
  • mto: This revision was merged to the branch mainline in revision 243.
  • Revision ID: monty@inaugust.com-20080731195651-8rolsypajn99uc2p
Some cleanups/decoupling in mystring.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
/*  This is needed for the definitions of strchr... on solaris */
20
20
 
21
 
#include <drizzled/global.h>
22
21
 
23
22
#ifndef _m_string_h
24
23
#define _m_string_h
 
24
 
 
25
#include <drizzled/global.h>
 
26
 
25
27
#ifndef __USE_GNU
26
28
#define __USE_GNU                               /* We want to use stpcpy */
27
29
#endif
32
34
#include <string.h>
33
35
#endif
34
36
 
35
 
#ifdef _AIX
36
 
#undef HAVE_BCMP
37
 
#endif
 
37
#include <stdlib.h>
 
38
#include <stddef.h>
 
39
#include <stdint.h>
 
40
#include <stdbool.h>
 
41
#include <assert.h>
 
42
#include <limits.h>
38
43
 
39
44
/*  This is needed for the definitions of memcpy... on solaris */
40
45
#if defined(HAVE_MEMORY_H) && !defined(__cplusplus)
72
77
#endif
73
78
 
74
79
        /* Prototypes for string functions */
75
 
 
76
80
#ifndef bmove512
77
 
extern  void bmove512(uchar *dst,const uchar *src,size_t len);
 
81
extern void bmove512(unsigned char *dst,const unsigned char *src,size_t len);
78
82
#endif
79
83
 
80
 
extern  void bmove_upp(uchar *dst,const uchar *src,size_t len);
81
 
extern  void bchange(uchar *dst,size_t old_len,const uchar *src,
 
84
extern void bmove_upp(unsigned char *dst,const unsigned char *src,size_t len);
 
85
 
 
86
extern  void bchange(unsigned char *dst,size_t old_len,const unsigned char *src,
82
87
                     size_t new_len,size_t tot_len);
83
88
extern  void strappend(char *s,size_t len,char fill);
84
89
extern  char *strend(const char *s);
98
103
extern  char *strnmov(char *dst,const char *src,size_t n);
99
104
extern  char *strsuff(const char *src,const char *suffix);
100
105
extern  char *strcont(const char *src,const char *set);
101
 
extern  char *strxcat _VARARGS((char *dst,const char *src, ...));
102
 
extern  char *strxmov _VARARGS((char *dst,const char *src, ...));
103
 
extern  char *strxcpy _VARARGS((char *dst,const char *src, ...));
104
 
extern  char *strxncat _VARARGS((char *dst,size_t len, const char *src, ...));
105
 
extern  char *strxnmov _VARARGS((char *dst,size_t len, const char *src, ...));
106
 
extern  char *strxncpy _VARARGS((char *dst,size_t len, const char *src, ...));
 
106
extern  char *strxcat(char *dst,const char *src, ...);
 
107
extern  char *strxmov(char *dst,const char *src, ...);
 
108
extern  char *strxcpy(char *dst,const char *src, ...);
 
109
extern  char *strxncat(char *dst,size_t len, const char *src, ...);
 
110
extern  char *strxnmov(char *dst,size_t len, const char *src, ...);
 
111
extern  char *strxncpy(char *dst,size_t len, const char *src, ...);
107
112
 
108
113
/* Prototypes of normal stringfunctions (with may ours) */
109
114
 
139
144
 
140
145
double my_strtod(const char *str, char **end, int *error);
141
146
double my_atof(const char *nptr);
142
 
size_t my_fcvt(double x, int precision, char *to, my_bool *error);
 
147
size_t my_fcvt(double x, int precision, char *to, bool *error);
143
148
size_t my_gcvt(double x, my_gcvt_arg_type type, int width, char *to,
144
 
               my_bool *error);
 
149
               bool *error);
145
150
 
146
151
#define NOT_FIXED_DEC 31
147
152
 
174
179
extern char *ullstr(int64_t value,char *buff);
175
180
#ifndef HAVE_STRTOUL
176
181
extern long strtol(const char *str, char **ptr, int base);
177
 
extern ulong strtoul(const char *str, char **ptr, int base);
 
182
extern unsigned long strtoul(const char *str, char **ptr, int base);
178
183
#endif
179
184
 
180
185
extern char *int2str(long val, char *dst, int radix, int upcase);
223
228
typedef struct st_mysql_lex_string LEX_STRING;
224
229
 
225
230
#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
226
 
#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
 
231
#define USTRING_WITH_LEN(X) ((unsigned char*) X), ((size_t) (sizeof(X) - 1))
227
232
#define C_STRING_WITH_LEN(X) ((char *) (X)), ((size_t) (sizeof(X) - 1))
228
233
 
229
234
/* SPACE_INT is a word that contains only spaces */
269
274
   @return          the last non-space character
270
275
*/
271
276
 
272
 
static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
 
277
static inline const unsigned char *skip_trailing_space(const unsigned char *ptr,size_t len)
273
278
{
274
 
  const uchar *end= ptr + len;
 
279
  const unsigned char *end= ptr + len;
275
280
 
276
281
  if (len > 20)
277
282
  {
278
 
    const uchar *end_words= (const uchar *)(intptr_t)
 
283
    const unsigned char *end_words= (const unsigned char *)(intptr_t)
279
284
      (((uint64_t)(intptr_t)end) / SIZEOF_INT * SIZEOF_INT);
280
 
    const uchar *start_words= (const uchar *)(intptr_t)
 
285
    const unsigned char *start_words= (const unsigned char *)(intptr_t)
281
286
       ((((uint64_t)(intptr_t)ptr) + SIZEOF_INT - 1) / SIZEOF_INT * SIZEOF_INT);
282
287
 
283
288
    assert(((uint64_t)(intptr_t)ptr) >= SIZEOF_INT);