Coverage Report

Created: 2024-06-18 07:03

/src/server/include/my_sys.h
Line
Count
Source (jump to first uncovered line)
1
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
2
   Copyright (c) 2010, 2022, MariaDB Corporation.
3
4
   This program is free software; you can redistribute it and/or modify
5
   it under the terms of the GNU General Public License as published by
6
   the Free Software Foundation; version 2 of the License.
7
8
   This program is distributed in the hope that it will be useful,
9
   but WITHOUT ANY WARRANTY; without even the implied warranty of
10
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
   GNU General Public License for more details.
12
13
   You should have received a copy of the GNU General Public License
14
   along with this program; if not, write to the Free Software
15
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1335  USA */
16
17
#ifndef _my_sys_h
18
#define _my_sys_h
19
20
#include <m_string.h>
21
#include <mysql/psi/mysql_memory.h>
22
23
C_MODE_START
24
25
26
#include <my_valgrind.h>
27
#include <my_pthread.h>
28
#include <m_ctype.h>                    /* for CHARSET_INFO */
29
#include <stdarg.h>
30
#include <typelib.h>
31
#include <my_alloca.h>
32
#include <mysql/plugin.h>
33
#include <mysql/service_my_print_error.h>
34
35
#define MY_INIT(name)   { my_progname= name; my_init(); }
36
37
/**
38
  Max length of an error message generated by mysys utilities.
39
  Some mysys functions produce error messages. These mostly go
40
  to stderr.
41
  This constant defines the size of the buffer used to format
42
  the message. It should be kept in sync with MYSQL_ERRMSG_SIZE,
43
  since sometimes mysys errors are stored in the server diagnostics
44
  area, and we would like to avoid unexpected truncation.
45
*/
46
#define MYSYS_ERRMSG_SIZE   (512)
47
#define MYSYS_STRERROR_SIZE (256)
48
49
0
#define MY_FILE_ERROR ((size_t) -1)
50
51
  /* General bitmaps for my_func's */
52
0
#define MY_FFNF   1U  /* Fatal if file not found */
53
0
#define MY_FNABP  2U  /* Fatal if not all bytes read/written */
54
0
#define MY_NABP   4U  /* Error if not all bytes read/written */
55
0
#define MY_FAE    8U  /* Fatal if any error */
56
0
#define MY_WME    16U  /* Write message on error */
57
#define MY_WAIT_IF_FULL 32U /* Wait and try again if disk full error */
58
0
#define MY_IGNORE_BADFD 32U     /* my_sync(): ignore 'bad descriptor' errors */
59
#define MY_IGNORE_ENOENT 32U    /* my_delete() ignores ENOENT (no such file) */
60
#define MY_ENCRYPT      64U     /* Encrypt IO_CACHE temporary files */
61
#define MY_TEMPORARY    64U     /* create_temp_file(): delete file at once */
62
0
#define MY_NOSYMLINKS  512U     /* my_open(): don't follow symlinks */
63
0
#define MY_FULL_IO     512U     /* my_read(): loop until I/O is complete */
64
#define MY_DONT_CHECK_FILESIZE 128U /* Option to init_io_cache() */
65
#define MY_LINK_WARNING 32U /* my_redel() gives warning if links */
66
#define MY_COPYTIME 64U /* my_redel() copies time */
67
#define MY_DELETE_OLD 256U  /* my_create_with_symlink() */
68
#define MY_RESOLVE_LINK 128U  /* my_realpath(); Only resolve links */
69
#define MY_HOLD_ORIGINAL_MODES 128U  /* my_copy() holds to file modes */
70
#define MY_REDEL_MAKE_BACKUP 256U
71
#define MY_SEEK_NOT_DONE 32U  /* my_lock may have to do a seek */
72
#define MY_SHORT_WAIT 64U /* my_lock() don't wait if can't lock */
73
#define MY_FORCE_LOCK   128U    /* use my_lock() even if disable_locking */
74
#define MY_NO_WAIT      256U  /* my_lock() don't wait at all */
75
0
#define MY_NO_REGISTER  8196U   /* my_open(), no malloc for file name */
76
/*
77
  If old_mode is UTF8_IS_UTF8MB3, then pass this flag. It mean utf8 is
78
  alias for utf8mb3. Otherwise utf8 is alias for utf8mb4.
79
*/
80
0
#define MY_UTF8_IS_UTF8MB3 1024U
81
/*
82
  init_dynamic_array() has init buffer; Internal flag, not to be used by
83
  caller.
84
*/
85
0
#define MY_INIT_BUFFER_USED 256U
86
0
#define MY_ZEROFILL 32U  /* my_malloc(), fill array with zero */
87
0
#define MY_ALLOW_ZERO_PTR 64U  /* my_realloc() ; zero ptr -> malloc */
88
0
#define MY_FREE_ON_ERROR 128U  /* my_realloc() ; Free old ptr on error */
89
#define MY_DONT_OVERWRITE_FILE 2048U /* my_copy: Don't overwrite file */
90
#define MY_THREADSAFE 2048U     /* my_seek(): lock fd mutex */
91
#define MY_SYNC       4096U     /* my_copy(): sync dst file */
92
0
#define MY_SYNC_DIR   32768U    /* my_create/delete/rename: sync directory */
93
0
#define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */
94
0
#define MY_ROOT_USE_MPROTECT 0x20000U /* init_alloc_root: read only segments */
95
/* Tree that should delete things automatically */
96
#define MY_TREE_WITH_DELETE 0x40000U
97
#define MY_TRACK 0x80000U             /* Track tmp usage */
98
#define MY_TRACK_WITH_LIMIT 0x100000U /* Give error if over tmp_file_usage */
99
100
0
#define MY_CHECK_ERROR  1U  /* Params to my_end; Check open-close */
101
0
#define MY_GIVE_INFO  2U  /* Give time info about process*/
102
0
#define MY_DONT_FREE_DBUG 4U    /* Do not call DBUG_END() in my_end() */
103
104
0
#define ME_BELL           4U    /* Ring bell then printing message */
105
#define ME_ERROR_LOG      64    /**< write the error message to error log */
106
0
#define ME_ERROR_LOG_ONLY 128   /**< write the error message to error log only */
107
0
#define ME_NOTE           1024  /**< not error but just info */
108
#define ME_WARNING        2048  /**< not error but just warning */
109
#define ME_FATAL          4096  /**< fatal statement error */
110
111
  /* Bits in last argument to fn_format */
112
#define MY_REPLACE_DIR    1U  /* replace dir in name with 'dir' */
113
#define MY_REPLACE_EXT    2U  /* replace extension with 'ext' */
114
#define MY_UNPACK_FILENAME  4U  /* Unpack name (~ -> home) */
115
#define MY_PACK_FILENAME  8U  /* Pack name (home -> ~) */
116
#define MY_RESOLVE_SYMLINKS 16U /* Resolve all symbolic links */
117
#define MY_RETURN_REAL_PATH 32U /* return full path for file */
118
#define MY_SAFE_PATH    64U /* Return NULL if too long path */
119
#define MY_RELATIVE_PATH  128U  /* name is relative to 'dir' */
120
#define MY_APPEND_EXT           256U    /* add 'ext' as additional extension*/
121
122
123
  /* My seek flags */
124
#define MY_SEEK_SET 0
125
#define MY_SEEK_CUR 1
126
#define MY_SEEK_END 2
127
128
  /* Some constants */
129
0
#define MY_WAIT_FOR_USER_TO_FIX_PANIC 60  /* in seconds */
130
0
#define MY_WAIT_GIVE_USER_A_MESSAGE 10  /* Every 10 times of prev */
131
#define MIN_COMPRESS_LENGTH   50  /* Don't compress small bl. */
132
#define DFLT_INIT_HITS  3
133
134
  /* root_alloc flags */
135
0
#define MY_KEEP_PREALLOC  1U
136
0
#define MY_MARK_BLOCKS_FREE     2U /* move used to free list and reuse them */
137
138
  /* Internal error numbers (for assembler functions) */
139
0
#define MY_ERRNO_EDOM   33
140
0
#define MY_ERRNO_ERANGE   34
141
142
  /* Bits for get_date timeflag */
143
#define GETDATE_DATE_TIME 1U
144
#define GETDATE_SHORT_DATE  2U
145
#define GETDATE_HHMMSSTIME  4U
146
#define GETDATE_GMT   8U
147
#define GETDATE_FIXEDLENGTH 16U
148
149
/* Extra length needed for filename if one calls my_create_backup_name */
150
#define MY_BACKUP_NAME_EXTRA_LENGTH 17
151
152
char *guess_malloc_library();
153
154
/* If we have our own safemalloc (for debugging) */
155
#if defined(SAFEMALLOC)
156
void sf_report_leaked_memory(my_thread_id id);
157
int sf_sanity();
158
extern my_thread_id (*sf_malloc_dbug_id)(void);
159
#define SAFEMALLOC_REPORT_MEMORY(X) if (!sf_leaking_memory) sf_report_leaked_memory(X)
160
#else
161
#define SAFEMALLOC_REPORT_MEMORY(X) do {} while(0)
162
#endif
163
164
typedef void (*MALLOC_SIZE_CB) (long long size, my_bool is_thread_specific); 
165
extern void set_malloc_size_cb(MALLOC_SIZE_CB func);
166
extern MALLOC_SIZE_CB update_malloc_size;
167
168
  /* defines when allocating data */
169
extern void *my_malloc(PSI_memory_key key, size_t size, myf MyFlags);
170
extern void *my_multi_malloc(PSI_memory_key key, myf MyFlags, ...);
171
extern void *my_multi_malloc_large(PSI_memory_key key, myf MyFlags, ...);
172
extern void *my_realloc(PSI_memory_key key, void *ptr, size_t size, myf MyFlags);
173
extern void my_free(void *ptr);
174
extern void *my_memdup(PSI_memory_key key, const void *from,size_t length,myf MyFlags);
175
extern char *my_strdup(PSI_memory_key key, const char *from,myf MyFlags);
176
extern char *my_strndup(PSI_memory_key key, const char *from, size_t length, myf MyFlags);
177
178
int my_init_large_pages(my_bool super_large_pages);
179
uchar *my_large_malloc(size_t *size, myf my_flags);
180
void my_large_free(void *ptr, size_t size);
181
void my_large_page_truncate(size_t *size);
182
183
/* Tracking tmp file usage */
184
185
struct tmp_file_tracking
186
{
187
  ulonglong previous_file_size;
188
  ulonglong file_size;
189
};
190
191
typedef int (*TMPFILE_SIZE_CB)(struct tmp_file_tracking *track, int no_error);
192
extern TMPFILE_SIZE_CB update_tmp_file_size;
193
194
#ifdef _WIN32
195
extern BOOL my_obtain_privilege(LPCSTR lpPrivilege);
196
#endif
197
198
void my_init_atomic_write(void);
199
#ifdef __linux__
200
my_bool my_test_if_atomic_write(File handle, int pagesize);
201
my_bool my_test_if_thinly_provisioned(File handle);
202
#else
203
# define my_test_if_atomic_write(A, B)      0
204
# define my_test_if_thinly_provisioned(A)   0
205
#endif /* __linux__ */
206
extern my_bool my_may_have_atomic_write;
207
208
#if defined(HAVE_ALLOCA) && !defined(HAVE_valgrind)
209
0
#define my_alloca(SZ) alloca((size_t) (SZ))
210
0
#define my_afree(PTR) ((void)0)
211
#define MAX_ALLOCA_SZ 4096
212
#define my_safe_alloca(size) (((size) <= MAX_ALLOCA_SZ) ? \
213
                               my_alloca(size) : \
214
                               my_malloc(PSI_NOT_INSTRUMENTED, (size), MYF(MY_THREAD_SPECIFIC|MY_WME)))
215
#define my_safe_afree(ptr, size) \
216
                  do { if ((size) > MAX_ALLOCA_SZ) my_free(ptr); } while(0)
217
#else
218
#define my_alloca(SZ) my_malloc(PSI_NOT_INSTRUMENTED, SZ,MYF(MY_FAE))
219
#define my_afree(PTR) my_free(PTR)
220
#define my_safe_alloca(size) my_alloca(size)
221
#define my_safe_afree(ptr, size) my_afree(ptr)
222
#endif /* HAVE_ALLOCA */
223
224
#ifndef errno       /* did we already get it? */
225
#ifdef HAVE_ERRNO_AS_DEFINE
226
#include <errno.h>      /* errno is a define */
227
#else
228
extern int errno;     /* declare errno */
229
#endif
230
#endif          /* #ifndef errno */
231
extern char *home_dir;      /* Home directory for user */
232
extern MYSQL_PLUGIN_IMPORT char  *mysql_data_home;
233
extern const char *my_progname;   /* program-name (printed in errors) */
234
extern const char *my_progname_short; /* like above but without directory */
235
extern char curr_dir[];   /* Current directory for user */
236
extern void (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
237
extern void (*fatal_error_handler_hook)(uint my_err, const char *str,
238
               myf MyFlags);
239
extern uint my_file_limit;
240
extern ulonglong my_thread_stack_size;
241
extern int sf_leaking_memory; /* set to 1 to disable memleak detection */
242
243
extern void (*proc_info_hook)(void *, const PSI_stage_info *, PSI_stage_info *,
244
                              const char *, const char *, const unsigned int);
245
246
/* charsets */
247
#define MY_ALL_CHARSETS_SIZE 4096
248
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *default_charset_info;
249
extern MYSQL_PLUGIN_IMPORT CHARSET_INFO *all_charsets[MY_ALL_CHARSETS_SIZE];
250
extern struct charset_info_st compiled_charsets[];
251
252
/* Collation properties and use statistics */
253
extern my_bool my_collation_is_known_id(uint id);
254
extern ulonglong my_collation_statistics_get_use_count(uint id);
255
extern const char *my_collation_get_tailoring(uint id);
256
257
/* statistics */
258
extern ulong    my_stream_opened, my_tmp_file_created;
259
extern ulong    my_file_total_opened;
260
extern ulong    my_sync_count;
261
extern uint mysys_usage_id;
262
extern int32    my_file_opened;
263
extern my_bool  my_init_done, my_thr_key_mysys_exists;
264
extern my_bool my_assert;
265
extern my_bool  my_assert_on_error;
266
extern myf      my_global_flags;        /* Set to MY_WME for more error messages */
267
          /* Point to current my_message() */
268
extern void (*my_sigtstp_cleanup)(void),
269
          /* Executed before jump to shell */
270
      (*my_sigtstp_restart)(void);
271
          /* Executed when coming from shell */
272
extern MYSQL_PLUGIN_IMPORT int my_umask;    /* Default creation mask  */
273
extern int my_umask_dir,
274
     my_recived_signals,  /* Signals we have got */
275
     my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
276
     my_dont_interrupt; /* call remember_intr when set */
277
#ifdef _WIN32
278
extern SECURITY_ATTRIBUTES my_dir_security_attributes;
279
LPSECURITY_ATTRIBUTES my_win_file_secattr();
280
#endif
281
extern MYSQL_PLUGIN_IMPORT my_bool my_use_symdir;
282
283
extern ulong  my_default_record_cache_size;
284
extern MYSQL_PLUGIN_IMPORT my_bool my_disable_locking;
285
extern my_bool  my_disable_async_io,
286
                my_disable_flush_key_blocks, my_disable_symlinks;
287
extern my_bool my_disable_sync, my_disable_copystat_in_redel;
288
extern char wild_many,wild_one,wild_prefix;
289
extern const char *charsets_dir;
290
extern size_t my_system_page_size;
291
292
enum cache_type
293
{
294
  TYPE_NOT_SET= 0, READ_CACHE, WRITE_CACHE,
295
  SEQ_READ_APPEND   /* sequential read or append */,
296
  READ_FIFO, READ_NET};
297
298
enum flush_type
299
{
300
  FLUSH_KEEP,           /* flush block and keep it in the cache */
301
  FLUSH_RELEASE,        /* flush block and remove it from the cache */
302
  FLUSH_IGNORE_CHANGED, /* remove block from the cache */
303
  /*
304
    As my_disable_flush_pagecache_blocks is always 0, the following option
305
    is strictly equivalent to FLUSH_KEEP
306
  */
307
  FLUSH_FORCE_WRITE,
308
  /**
309
     @brief like FLUSH_KEEP but return immediately if file is already being
310
     flushed (even partially) by another thread; only for page cache,
311
     forbidden for key cache.
312
  */
313
  FLUSH_KEEP_LAZY
314
};
315
316
typedef struct st_record_cache  /* Used when caching records */
317
{
318
  File file;
319
  int rc_seek,error,inited;
320
  uint  rc_length,read_length,reclength;
321
  my_off_t rc_record_pos,end_of_file;
322
  uchar *rc_buff,*rc_buff2,*rc_pos,*rc_end,*rc_request_pos;
323
  enum cache_type type;
324
} RECORD_CACHE;
325
326
enum file_type
327
{
328
  UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE, STREAM_BY_FOPEN, STREAM_BY_FDOPEN,
329
  FILE_BY_O_TMPFILE, FILE_BY_MKSTEMP, FILE_BY_DUP
330
};
331
332
struct st_my_file_info
333
{
334
  char  *name;
335
#ifdef _WIN32
336
  HANDLE fhandle;   /* win32 file handle */
337
  int    oflag;     /* open flags, e.g O_APPEND */
338
#endif
339
  enum   file_type  type;
340
};
341
342
extern struct st_my_file_info *my_file_info;
343
344
/* Free function pointer */
345
typedef void (*FREE_FUNC)(void *);
346
347
typedef struct st_dynamic_array
348
{
349
  uchar *buffer;
350
  size_t elements, max_element;
351
  size_t alloc_increment;
352
  size_t size_of_element;
353
  PSI_memory_key m_psi_key;
354
  myf malloc_flags;
355
} DYNAMIC_ARRAY;
356
357
358
typedef struct st_dynamic_array_append
359
{
360
  DYNAMIC_ARRAY *array;
361
  uchar *pos, *end;
362
} DYNAMIC_ARRAY_APPEND;
363
364
365
typedef struct st_my_tmpdir
366
{
367
  DYNAMIC_ARRAY full_list;
368
  char **list;
369
  size_t cur, max;
370
  mysql_mutex_t mutex;
371
} MY_TMPDIR;
372
373
typedef struct st_dynamic_string
374
{
375
  char *str;
376
  size_t length,max_length,alloc_increment;
377
} DYNAMIC_STRING;
378
379
struct st_io_cache;
380
381
typedef struct st_io_cache_share
382
{
383
  mysql_mutex_t       mutex;           /* To sync on reads into buffer. */
384
  mysql_cond_t        cond;            /* To wait for signals. */
385
  mysql_cond_t        cond_writer;     /* For a synchronized writer. */
386
  /* Offset in file corresponding to the first byte of buffer. */
387
  my_off_t              pos_in_file;
388
  /* If a synchronized write cache is the source of the data. */
389
  struct st_io_cache    *source_cache;
390
  uchar                 *buffer;         /* The read buffer. */
391
  uchar                 *read_end;       /* Behind last valid byte of buffer. */
392
  int                   running_threads; /* threads not in lock. */
393
  int                   total_threads;   /* threads sharing the cache. */
394
  int                   error;           /* Last error. */
395
#ifdef NOT_YET_IMPLEMENTED
396
  /* whether the structure should be free'd */
397
  my_bool alloced;
398
#endif
399
} IO_CACHE_SHARE;
400
401
typedef struct st_io_cache    /* Used when caching files */
402
{
403
  /* Offset in file corresponding to the first byte of uchar* buffer. */
404
  my_off_t pos_in_file;
405
  /*
406
    The offset of end of file for READ_CACHE and WRITE_CACHE.
407
    For SEQ_READ_APPEND it the maximum of the actual end of file and
408
    the position represented by read_end.
409
  */
410
  my_off_t end_of_file;
411
  /* Points to current read position in the buffer */
412
  uchar *read_pos;
413
  /* the non-inclusive boundary in the buffer for the currently valid read */
414
  uchar  *read_end;
415
  uchar  *buffer;       /* The read buffer */
416
  /* Used in ASYNC_IO */
417
  uchar  *request_pos;
418
419
  /* Only used in WRITE caches and in SEQ_READ_APPEND to buffer writes */
420
  uchar  *write_buffer;
421
  /*
422
    Only used in SEQ_READ_APPEND, and points to the current read position
423
    in the write buffer. Note that reads in SEQ_READ_APPEND caches can
424
    happen from both read buffer (uchar* buffer) and write buffer
425
    (uchar* write_buffer).
426
  */
427
  uchar *append_read_pos;
428
  /* Points to current write position in the write buffer */
429
  uchar *write_pos;
430
  /* The non-inclusive boundary of the valid write area */
431
  uchar *write_end;
432
433
  /*
434
    The lock is for append buffer used in SEQ_READ_APPEND cache
435
    need mutex copying from append buffer to read buffer.
436
  */
437
  mysql_mutex_t append_buffer_lock;
438
  /*
439
    The following is used when several threads are reading the
440
    same file in parallel. They are synchronized on disk
441
    accesses reading the cached part of the file asynchronously.
442
    It should be set to NULL to disable the feature.  Only
443
    READ_CACHE mode is supported.
444
  */
445
  IO_CACHE_SHARE *share;
446
447
  /* Track tmpfile usage. Done if (myflags & MY_TRACK) is true */
448
  struct tmp_file_tracking tracking;
449
  /*
450
    A caller will use my_b_read() macro to read from the cache
451
    if the data is already in cache, it will be simply copied with
452
    memcpy() and internal variables will be accordingly updated with
453
    no functions invoked. However, if the data is not fully in the cache,
454
    my_b_read() will call read_function to fetch the data. read_function
455
    must never be invoked directly.
456
  */
457
  int (*read_function)(struct st_io_cache *,uchar *,size_t);
458
  /*
459
    Same idea as in the case of read_function, except my_b_write() needs to
460
    be replaced with my_b_append() for a SEQ_READ_APPEND cache
461
  */
462
  int (*write_function)(struct st_io_cache *,const uchar *,size_t);
463
  /*
464
    Specifies the type of the cache. Depending on the type of the cache
465
    certain operations might not be available and yield unpredicatable
466
    results. Details to be documented later
467
  */
468
  enum cache_type type;
469
  /*
470
    Counts the number of times, when we were forced to use disk. We use it to
471
    increase the binlog_cache_disk_use and binlog_stmt_cache_disk_use status
472
    variables.
473
  */
474
  ulong disk_writes;
475
  char *file_name;      /* if used with 'open_cached_file' */
476
  const char *dir;
477
  char prefix[3];
478
  File file; /* file descriptor */
479
480
  struct st_io_cache *next_file_user;
481
  /*
482
    seek_not_done is set by my_b_seek() to inform the upcoming read/write
483
    operation that a seek needs to be preformed prior to the actual I/O
484
    error is 0 if the cache operation was successful, -1 if there was a
485
    "hard" error, and the actual number of I/O-ed bytes if the read/write was
486
    partial.
487
  */
488
  int seek_not_done,error;
489
  /* length of the buffer used for storing un-encrypted data */
490
  size_t  buffer_length;
491
  /* read_length is the same as buffer_length except when we use async io */
492
  size_t  read_length;
493
  myf myflags;      /* Flags used to my_read/my_write */
494
  /*
495
    alloced_buffer is set to the size of the buffer allocated for the IO_CACHE.
496
    Includes the overhead(storing key to encrypt and decrypt) for encryption.
497
    Set to 0 if nothing is allocated.
498
    Currently READ_NET is the only one that will use a buffer allocated
499
    somewhere else
500
  */
501
  size_t alloced_buffer;
502
} IO_CACHE;
503
504
typedef int (*qsort2_cmp)(const void *, const void *, const void *);
505
506
typedef void (*my_error_reporter)(enum loglevel level, const char *format, ...)
507
  ATTRIBUTE_FORMAT_FPTR(printf, 2, 3);
508
509
extern my_error_reporter my_charset_error_reporter;
510
511
extern PSI_file_key key_file_io_cache;
512
513
/* inline functions for mf_iocache */
514
515
extern int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
516
extern void truncate_io_cache(IO_CACHE *info);
517
extern int _my_b_get(IO_CACHE *info);
518
extern int _my_b_read(IO_CACHE *info,uchar *Buffer,size_t Count);
519
extern int _my_b_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
520
521
/* Test if buffer is inited */
522
0
static inline void my_b_clear(IO_CACHE *info) { info->buffer= 0; }
Unexecuted instantiation: fuzz_json.c:my_b_clear
Unexecuted instantiation: json_lib.c:my_b_clear
Unexecuted instantiation: ctype-ucs2.c:my_b_clear
Unexecuted instantiation: dtoa.c:my_b_clear
Unexecuted instantiation: xml.c:my_b_clear
Unexecuted instantiation: ctype-simple.c:my_b_clear
Unexecuted instantiation: my_strtoll10.c:my_b_clear
Unexecuted instantiation: my_vsnprintf.c:my_b_clear
Unexecuted instantiation: my_malloc.c:my_b_clear
Unexecuted instantiation: my_static.c:my_b_clear
Unexecuted instantiation: my_thr_init.c:my_b_clear
Unexecuted instantiation: thr_mutex.c:my_b_clear
Unexecuted instantiation: thr_rwlock.c:my_b_clear
Unexecuted instantiation: psi_noop.c:my_b_clear
Unexecuted instantiation: my_error.c:my_b_clear
Unexecuted instantiation: my_getsystime.c:my_b_clear
Unexecuted instantiation: my_init.c:my_b_clear
Unexecuted instantiation: my_mess.c:my_b_clear
Unexecuted instantiation: my_once.c:my_b_clear
Unexecuted instantiation: my_symlink.c:my_b_clear
Unexecuted instantiation: my_sync.c:my_b_clear
Unexecuted instantiation: charset.c:my_b_clear
Unexecuted instantiation: errors.c:my_b_clear
Unexecuted instantiation: hash.c:my_b_clear
Unexecuted instantiation: mf_dirname.c:my_b_clear
Unexecuted instantiation: mf_loadpath.c:my_b_clear
Unexecuted instantiation: mf_pack.c:my_b_clear
Unexecuted instantiation: my_div.c:my_b_clear
Unexecuted instantiation: my_getwd.c:my_b_clear
Unexecuted instantiation: my_lib.c:my_b_clear
Unexecuted instantiation: my_open.c:my_b_clear
Unexecuted instantiation: my_read.c:my_b_clear
Unexecuted instantiation: array.c:my_b_clear
Unexecuted instantiation: charset-def.c:my_b_clear
Unexecuted instantiation: mf_qsort.c:my_b_clear
Unexecuted instantiation: my_alloc.c:my_b_clear
Unexecuted instantiation: ctype-tis620.c:my_b_clear
Unexecuted instantiation: str2int.c:my_b_clear
523
0
static inline int my_b_inited(IO_CACHE *info) { return MY_TEST(info->buffer); }
Unexecuted instantiation: fuzz_json.c:my_b_inited
Unexecuted instantiation: json_lib.c:my_b_inited
Unexecuted instantiation: ctype-ucs2.c:my_b_inited
Unexecuted instantiation: dtoa.c:my_b_inited
Unexecuted instantiation: xml.c:my_b_inited
Unexecuted instantiation: ctype-simple.c:my_b_inited
Unexecuted instantiation: my_strtoll10.c:my_b_inited
Unexecuted instantiation: my_vsnprintf.c:my_b_inited
Unexecuted instantiation: my_malloc.c:my_b_inited
Unexecuted instantiation: my_static.c:my_b_inited
Unexecuted instantiation: my_thr_init.c:my_b_inited
Unexecuted instantiation: thr_mutex.c:my_b_inited
Unexecuted instantiation: thr_rwlock.c:my_b_inited
Unexecuted instantiation: psi_noop.c:my_b_inited
Unexecuted instantiation: my_error.c:my_b_inited
Unexecuted instantiation: my_getsystime.c:my_b_inited
Unexecuted instantiation: my_init.c:my_b_inited
Unexecuted instantiation: my_mess.c:my_b_inited
Unexecuted instantiation: my_once.c:my_b_inited
Unexecuted instantiation: my_symlink.c:my_b_inited
Unexecuted instantiation: my_sync.c:my_b_inited
Unexecuted instantiation: charset.c:my_b_inited
Unexecuted instantiation: errors.c:my_b_inited
Unexecuted instantiation: hash.c:my_b_inited
Unexecuted instantiation: mf_dirname.c:my_b_inited
Unexecuted instantiation: mf_loadpath.c:my_b_inited
Unexecuted instantiation: mf_pack.c:my_b_inited
Unexecuted instantiation: my_div.c:my_b_inited
Unexecuted instantiation: my_getwd.c:my_b_inited
Unexecuted instantiation: my_lib.c:my_b_inited
Unexecuted instantiation: my_open.c:my_b_inited
Unexecuted instantiation: my_read.c:my_b_inited
Unexecuted instantiation: array.c:my_b_inited
Unexecuted instantiation: charset-def.c:my_b_inited
Unexecuted instantiation: mf_qsort.c:my_b_inited
Unexecuted instantiation: my_alloc.c:my_b_inited
Unexecuted instantiation: ctype-tis620.c:my_b_inited
Unexecuted instantiation: str2int.c:my_b_inited
524
#define my_b_EOF INT_MIN
525
526
static inline int my_b_read(IO_CACHE *info, uchar *Buffer, size_t Count)
527
0
{
528
0
  if (info->read_pos + Count <= info->read_end)
529
0
  {
530
0
    memcpy(Buffer, info->read_pos, Count);
531
0
    info->read_pos+= Count;
532
0
    return 0;
533
0
  }
534
0
  return _my_b_read(info, Buffer, Count);
535
0
}
Unexecuted instantiation: fuzz_json.c:my_b_read
Unexecuted instantiation: json_lib.c:my_b_read
Unexecuted instantiation: ctype-ucs2.c:my_b_read
Unexecuted instantiation: dtoa.c:my_b_read
Unexecuted instantiation: xml.c:my_b_read
Unexecuted instantiation: ctype-simple.c:my_b_read
Unexecuted instantiation: my_strtoll10.c:my_b_read
Unexecuted instantiation: my_vsnprintf.c:my_b_read
Unexecuted instantiation: my_malloc.c:my_b_read
Unexecuted instantiation: my_static.c:my_b_read
Unexecuted instantiation: my_thr_init.c:my_b_read
Unexecuted instantiation: thr_mutex.c:my_b_read
Unexecuted instantiation: thr_rwlock.c:my_b_read
Unexecuted instantiation: psi_noop.c:my_b_read
Unexecuted instantiation: my_error.c:my_b_read
Unexecuted instantiation: my_getsystime.c:my_b_read
Unexecuted instantiation: my_init.c:my_b_read
Unexecuted instantiation: my_mess.c:my_b_read
Unexecuted instantiation: my_once.c:my_b_read
Unexecuted instantiation: my_symlink.c:my_b_read
Unexecuted instantiation: my_sync.c:my_b_read
Unexecuted instantiation: charset.c:my_b_read
Unexecuted instantiation: errors.c:my_b_read
Unexecuted instantiation: hash.c:my_b_read
Unexecuted instantiation: mf_dirname.c:my_b_read
Unexecuted instantiation: mf_loadpath.c:my_b_read
Unexecuted instantiation: mf_pack.c:my_b_read
Unexecuted instantiation: my_div.c:my_b_read
Unexecuted instantiation: my_getwd.c:my_b_read
Unexecuted instantiation: my_lib.c:my_b_read
Unexecuted instantiation: my_open.c:my_b_read
Unexecuted instantiation: my_read.c:my_b_read
Unexecuted instantiation: array.c:my_b_read
Unexecuted instantiation: charset-def.c:my_b_read
Unexecuted instantiation: mf_qsort.c:my_b_read
Unexecuted instantiation: my_alloc.c:my_b_read
Unexecuted instantiation: ctype-tis620.c:my_b_read
Unexecuted instantiation: str2int.c:my_b_read
536
537
static inline int my_b_write(IO_CACHE *info, const uchar *Buffer, size_t Count)
538
0
{
539
0
  MEM_CHECK_DEFINED(Buffer, Count);
540
0
  if (info->write_pos + Count <= info->write_end)
541
0
  {
542
0
    if (Count)
543
0
    {
544
0
      memcpy(info->write_pos, Buffer, Count);
545
0
      info->write_pos+= Count;
546
0
    }
547
0
    return 0;
548
0
  }
549
0
  return _my_b_write(info, Buffer, Count);
550
0
}
Unexecuted instantiation: fuzz_json.c:my_b_write
Unexecuted instantiation: json_lib.c:my_b_write
Unexecuted instantiation: ctype-ucs2.c:my_b_write
Unexecuted instantiation: dtoa.c:my_b_write
Unexecuted instantiation: xml.c:my_b_write
Unexecuted instantiation: ctype-simple.c:my_b_write
Unexecuted instantiation: my_strtoll10.c:my_b_write
Unexecuted instantiation: my_vsnprintf.c:my_b_write
Unexecuted instantiation: my_malloc.c:my_b_write
Unexecuted instantiation: my_static.c:my_b_write
Unexecuted instantiation: my_thr_init.c:my_b_write
Unexecuted instantiation: thr_mutex.c:my_b_write
Unexecuted instantiation: thr_rwlock.c:my_b_write
Unexecuted instantiation: psi_noop.c:my_b_write
Unexecuted instantiation: my_error.c:my_b_write
Unexecuted instantiation: my_getsystime.c:my_b_write
Unexecuted instantiation: my_init.c:my_b_write
Unexecuted instantiation: my_mess.c:my_b_write
Unexecuted instantiation: my_once.c:my_b_write
Unexecuted instantiation: my_symlink.c:my_b_write
Unexecuted instantiation: my_sync.c:my_b_write
Unexecuted instantiation: charset.c:my_b_write
Unexecuted instantiation: errors.c:my_b_write
Unexecuted instantiation: hash.c:my_b_write
Unexecuted instantiation: mf_dirname.c:my_b_write
Unexecuted instantiation: mf_loadpath.c:my_b_write
Unexecuted instantiation: mf_pack.c:my_b_write
Unexecuted instantiation: my_div.c:my_b_write
Unexecuted instantiation: my_getwd.c:my_b_write
Unexecuted instantiation: my_lib.c:my_b_write
Unexecuted instantiation: my_open.c:my_b_write
Unexecuted instantiation: my_read.c:my_b_write
Unexecuted instantiation: array.c:my_b_write
Unexecuted instantiation: charset-def.c:my_b_write
Unexecuted instantiation: mf_qsort.c:my_b_write
Unexecuted instantiation: my_alloc.c:my_b_write
Unexecuted instantiation: ctype-tis620.c:my_b_write
Unexecuted instantiation: str2int.c:my_b_write
551
552
static inline int my_b_get(IO_CACHE *info)
553
0
{
554
0
  if (info->read_pos != info->read_end)
555
0
  {
556
0
    info->read_pos++;
557
0
    return info->read_pos[-1];
558
0
  }
559
0
  return _my_b_get(info);
560
0
}
Unexecuted instantiation: fuzz_json.c:my_b_get
Unexecuted instantiation: json_lib.c:my_b_get
Unexecuted instantiation: ctype-ucs2.c:my_b_get
Unexecuted instantiation: dtoa.c:my_b_get
Unexecuted instantiation: xml.c:my_b_get
Unexecuted instantiation: ctype-simple.c:my_b_get
Unexecuted instantiation: my_strtoll10.c:my_b_get
Unexecuted instantiation: my_vsnprintf.c:my_b_get
Unexecuted instantiation: my_malloc.c:my_b_get
Unexecuted instantiation: my_static.c:my_b_get
Unexecuted instantiation: my_thr_init.c:my_b_get
Unexecuted instantiation: thr_mutex.c:my_b_get
Unexecuted instantiation: thr_rwlock.c:my_b_get
Unexecuted instantiation: psi_noop.c:my_b_get
Unexecuted instantiation: my_error.c:my_b_get
Unexecuted instantiation: my_getsystime.c:my_b_get
Unexecuted instantiation: my_init.c:my_b_get
Unexecuted instantiation: my_mess.c:my_b_get
Unexecuted instantiation: my_once.c:my_b_get
Unexecuted instantiation: my_symlink.c:my_b_get
Unexecuted instantiation: my_sync.c:my_b_get
Unexecuted instantiation: charset.c:my_b_get
Unexecuted instantiation: errors.c:my_b_get
Unexecuted instantiation: hash.c:my_b_get
Unexecuted instantiation: mf_dirname.c:my_b_get
Unexecuted instantiation: mf_loadpath.c:my_b_get
Unexecuted instantiation: mf_pack.c:my_b_get
Unexecuted instantiation: my_div.c:my_b_get
Unexecuted instantiation: my_getwd.c:my_b_get
Unexecuted instantiation: my_lib.c:my_b_get
Unexecuted instantiation: my_open.c:my_b_get
Unexecuted instantiation: my_read.c:my_b_get
Unexecuted instantiation: array.c:my_b_get
Unexecuted instantiation: charset-def.c:my_b_get
Unexecuted instantiation: mf_qsort.c:my_b_get
Unexecuted instantiation: my_alloc.c:my_b_get
Unexecuted instantiation: ctype-tis620.c:my_b_get
Unexecuted instantiation: str2int.c:my_b_get
561
562
static inline my_bool my_b_write_byte(IO_CACHE *info, uchar chr)
563
0
{
564
0
  MEM_CHECK_DEFINED(&chr, 1);
565
0
  if (info->write_pos >= info->write_end)
566
0
    if (my_b_flush_io_cache(info, 1))
567
0
      return 1;
568
0
  *info->write_pos++= chr;
569
0
  return 0;
570
0
}
Unexecuted instantiation: fuzz_json.c:my_b_write_byte
Unexecuted instantiation: json_lib.c:my_b_write_byte
Unexecuted instantiation: ctype-ucs2.c:my_b_write_byte
Unexecuted instantiation: dtoa.c:my_b_write_byte
Unexecuted instantiation: xml.c:my_b_write_byte
Unexecuted instantiation: ctype-simple.c:my_b_write_byte
Unexecuted instantiation: my_strtoll10.c:my_b_write_byte
Unexecuted instantiation: my_vsnprintf.c:my_b_write_byte
Unexecuted instantiation: my_malloc.c:my_b_write_byte
Unexecuted instantiation: my_static.c:my_b_write_byte
Unexecuted instantiation: my_thr_init.c:my_b_write_byte
Unexecuted instantiation: thr_mutex.c:my_b_write_byte
Unexecuted instantiation: thr_rwlock.c:my_b_write_byte
Unexecuted instantiation: psi_noop.c:my_b_write_byte
Unexecuted instantiation: my_error.c:my_b_write_byte
Unexecuted instantiation: my_getsystime.c:my_b_write_byte
Unexecuted instantiation: my_init.c:my_b_write_byte
Unexecuted instantiation: my_mess.c:my_b_write_byte
Unexecuted instantiation: my_once.c:my_b_write_byte
Unexecuted instantiation: my_symlink.c:my_b_write_byte
Unexecuted instantiation: my_sync.c:my_b_write_byte
Unexecuted instantiation: charset.c:my_b_write_byte
Unexecuted instantiation: errors.c:my_b_write_byte
Unexecuted instantiation: hash.c:my_b_write_byte
Unexecuted instantiation: mf_dirname.c:my_b_write_byte
Unexecuted instantiation: mf_loadpath.c:my_b_write_byte
Unexecuted instantiation: mf_pack.c:my_b_write_byte
Unexecuted instantiation: my_div.c:my_b_write_byte
Unexecuted instantiation: my_getwd.c:my_b_write_byte
Unexecuted instantiation: my_lib.c:my_b_write_byte
Unexecuted instantiation: my_open.c:my_b_write_byte
Unexecuted instantiation: my_read.c:my_b_write_byte
Unexecuted instantiation: array.c:my_b_write_byte
Unexecuted instantiation: charset-def.c:my_b_write_byte
Unexecuted instantiation: mf_qsort.c:my_b_write_byte
Unexecuted instantiation: my_alloc.c:my_b_write_byte
Unexecuted instantiation: ctype-tis620.c:my_b_write_byte
Unexecuted instantiation: str2int.c:my_b_write_byte
571
572
/**
573
  Fill buffer of the cache.
574
575
  @note It assumes that you have already used all characters in the CACHE,
576
        independent of the read_pos value!
577
578
  @returns
579
        0     On error or EOF (info->error = -1 on error)
580
        #     Number of characters
581
*/
582
static inline size_t my_b_fill(IO_CACHE *info)
583
0
{
584
0
  info->read_pos= info->read_end;
585
0
  return _my_b_read(info,0,0) ? 0 : (size_t) (info->read_end - info->read_pos);
586
0
}
Unexecuted instantiation: fuzz_json.c:my_b_fill
Unexecuted instantiation: json_lib.c:my_b_fill
Unexecuted instantiation: ctype-ucs2.c:my_b_fill
Unexecuted instantiation: dtoa.c:my_b_fill
Unexecuted instantiation: xml.c:my_b_fill
Unexecuted instantiation: ctype-simple.c:my_b_fill
Unexecuted instantiation: my_strtoll10.c:my_b_fill
Unexecuted instantiation: my_vsnprintf.c:my_b_fill
Unexecuted instantiation: my_malloc.c:my_b_fill
Unexecuted instantiation: my_static.c:my_b_fill
Unexecuted instantiation: my_thr_init.c:my_b_fill
Unexecuted instantiation: thr_mutex.c:my_b_fill
Unexecuted instantiation: thr_rwlock.c:my_b_fill
Unexecuted instantiation: psi_noop.c:my_b_fill
Unexecuted instantiation: my_error.c:my_b_fill
Unexecuted instantiation: my_getsystime.c:my_b_fill
Unexecuted instantiation: my_init.c:my_b_fill
Unexecuted instantiation: my_mess.c:my_b_fill
Unexecuted instantiation: my_once.c:my_b_fill
Unexecuted instantiation: my_symlink.c:my_b_fill
Unexecuted instantiation: my_sync.c:my_b_fill
Unexecuted instantiation: charset.c:my_b_fill
Unexecuted instantiation: errors.c:my_b_fill
Unexecuted instantiation: hash.c:my_b_fill
Unexecuted instantiation: mf_dirname.c:my_b_fill
Unexecuted instantiation: mf_loadpath.c:my_b_fill
Unexecuted instantiation: mf_pack.c:my_b_fill
Unexecuted instantiation: my_div.c:my_b_fill
Unexecuted instantiation: my_getwd.c:my_b_fill
Unexecuted instantiation: my_lib.c:my_b_fill
Unexecuted instantiation: my_open.c:my_b_fill
Unexecuted instantiation: my_read.c:my_b_fill
Unexecuted instantiation: array.c:my_b_fill
Unexecuted instantiation: charset-def.c:my_b_fill
Unexecuted instantiation: mf_qsort.c:my_b_fill
Unexecuted instantiation: my_alloc.c:my_b_fill
Unexecuted instantiation: ctype-tis620.c:my_b_fill
Unexecuted instantiation: str2int.c:my_b_fill
587
588
static inline my_off_t my_b_tell(const IO_CACHE *info)
589
0
{
590
0
  if (info->type == WRITE_CACHE) {
591
0
    return info->pos_in_file + (my_off_t)(info->write_pos - info->request_pos);
592
0
593
0
  }
594
0
  return info->pos_in_file + (my_off_t) (info->read_pos - info->request_pos);
595
0
}
Unexecuted instantiation: fuzz_json.c:my_b_tell
Unexecuted instantiation: json_lib.c:my_b_tell
Unexecuted instantiation: ctype-ucs2.c:my_b_tell
Unexecuted instantiation: dtoa.c:my_b_tell
Unexecuted instantiation: xml.c:my_b_tell
Unexecuted instantiation: ctype-simple.c:my_b_tell
Unexecuted instantiation: my_strtoll10.c:my_b_tell
Unexecuted instantiation: my_vsnprintf.c:my_b_tell
Unexecuted instantiation: my_malloc.c:my_b_tell
Unexecuted instantiation: my_static.c:my_b_tell
Unexecuted instantiation: my_thr_init.c:my_b_tell
Unexecuted instantiation: thr_mutex.c:my_b_tell
Unexecuted instantiation: thr_rwlock.c:my_b_tell
Unexecuted instantiation: psi_noop.c:my_b_tell
Unexecuted instantiation: my_error.c:my_b_tell
Unexecuted instantiation: my_getsystime.c:my_b_tell
Unexecuted instantiation: my_init.c:my_b_tell
Unexecuted instantiation: my_mess.c:my_b_tell
Unexecuted instantiation: my_once.c:my_b_tell
Unexecuted instantiation: my_symlink.c:my_b_tell
Unexecuted instantiation: my_sync.c:my_b_tell
Unexecuted instantiation: charset.c:my_b_tell
Unexecuted instantiation: errors.c:my_b_tell
Unexecuted instantiation: hash.c:my_b_tell
Unexecuted instantiation: mf_dirname.c:my_b_tell
Unexecuted instantiation: mf_loadpath.c:my_b_tell
Unexecuted instantiation: mf_pack.c:my_b_tell
Unexecuted instantiation: my_div.c:my_b_tell
Unexecuted instantiation: my_getwd.c:my_b_tell
Unexecuted instantiation: my_lib.c:my_b_tell
Unexecuted instantiation: my_open.c:my_b_tell
Unexecuted instantiation: my_read.c:my_b_tell
Unexecuted instantiation: array.c:my_b_tell
Unexecuted instantiation: charset-def.c:my_b_tell
Unexecuted instantiation: mf_qsort.c:my_b_tell
Unexecuted instantiation: my_alloc.c:my_b_tell
Unexecuted instantiation: ctype-tis620.c:my_b_tell
Unexecuted instantiation: str2int.c:my_b_tell
596
597
static inline my_off_t my_b_write_tell(const IO_CACHE *info)
598
0
{
599
0
  return info->pos_in_file + (my_off_t) (info->write_pos - info->write_buffer);
600
0
}
Unexecuted instantiation: fuzz_json.c:my_b_write_tell
Unexecuted instantiation: json_lib.c:my_b_write_tell
Unexecuted instantiation: ctype-ucs2.c:my_b_write_tell
Unexecuted instantiation: dtoa.c:my_b_write_tell
Unexecuted instantiation: xml.c:my_b_write_tell
Unexecuted instantiation: ctype-simple.c:my_b_write_tell
Unexecuted instantiation: my_strtoll10.c:my_b_write_tell
Unexecuted instantiation: my_vsnprintf.c:my_b_write_tell
Unexecuted instantiation: my_malloc.c:my_b_write_tell
Unexecuted instantiation: my_static.c:my_b_write_tell
Unexecuted instantiation: my_thr_init.c:my_b_write_tell
Unexecuted instantiation: thr_mutex.c:my_b_write_tell
Unexecuted instantiation: thr_rwlock.c:my_b_write_tell
Unexecuted instantiation: psi_noop.c:my_b_write_tell
Unexecuted instantiation: my_error.c:my_b_write_tell
Unexecuted instantiation: my_getsystime.c:my_b_write_tell
Unexecuted instantiation: my_init.c:my_b_write_tell
Unexecuted instantiation: my_mess.c:my_b_write_tell
Unexecuted instantiation: my_once.c:my_b_write_tell
Unexecuted instantiation: my_symlink.c:my_b_write_tell
Unexecuted instantiation: my_sync.c:my_b_write_tell
Unexecuted instantiation: charset.c:my_b_write_tell
Unexecuted instantiation: errors.c:my_b_write_tell
Unexecuted instantiation: hash.c:my_b_write_tell
Unexecuted instantiation: mf_dirname.c:my_b_write_tell
Unexecuted instantiation: mf_loadpath.c:my_b_write_tell
Unexecuted instantiation: mf_pack.c:my_b_write_tell
Unexecuted instantiation: my_div.c:my_b_write_tell
Unexecuted instantiation: my_getwd.c:my_b_write_tell
Unexecuted instantiation: my_lib.c:my_b_write_tell
Unexecuted instantiation: my_open.c:my_b_write_tell
Unexecuted instantiation: my_read.c:my_b_write_tell
Unexecuted instantiation: array.c:my_b_write_tell
Unexecuted instantiation: charset-def.c:my_b_write_tell
Unexecuted instantiation: mf_qsort.c:my_b_write_tell
Unexecuted instantiation: my_alloc.c:my_b_write_tell
Unexecuted instantiation: ctype-tis620.c:my_b_write_tell
Unexecuted instantiation: str2int.c:my_b_write_tell
601
602
static inline uchar* my_b_get_buffer_start(const IO_CACHE *info)
603
0
{
604
0
  return info->request_pos;
605
0
}
Unexecuted instantiation: fuzz_json.c:my_b_get_buffer_start
Unexecuted instantiation: json_lib.c:my_b_get_buffer_start
Unexecuted instantiation: ctype-ucs2.c:my_b_get_buffer_start
Unexecuted instantiation: dtoa.c:my_b_get_buffer_start
Unexecuted instantiation: xml.c:my_b_get_buffer_start
Unexecuted instantiation: ctype-simple.c:my_b_get_buffer_start
Unexecuted instantiation: my_strtoll10.c:my_b_get_buffer_start
Unexecuted instantiation: my_vsnprintf.c:my_b_get_buffer_start
Unexecuted instantiation: my_malloc.c:my_b_get_buffer_start
Unexecuted instantiation: my_static.c:my_b_get_buffer_start
Unexecuted instantiation: my_thr_init.c:my_b_get_buffer_start
Unexecuted instantiation: thr_mutex.c:my_b_get_buffer_start
Unexecuted instantiation: thr_rwlock.c:my_b_get_buffer_start
Unexecuted instantiation: psi_noop.c:my_b_get_buffer_start
Unexecuted instantiation: my_error.c:my_b_get_buffer_start
Unexecuted instantiation: my_getsystime.c:my_b_get_buffer_start
Unexecuted instantiation: my_init.c:my_b_get_buffer_start
Unexecuted instantiation: my_mess.c:my_b_get_buffer_start
Unexecuted instantiation: my_once.c:my_b_get_buffer_start
Unexecuted instantiation: my_symlink.c:my_b_get_buffer_start
Unexecuted instantiation: my_sync.c:my_b_get_buffer_start
Unexecuted instantiation: charset.c:my_b_get_buffer_start
Unexecuted instantiation: errors.c:my_b_get_buffer_start
Unexecuted instantiation: hash.c:my_b_get_buffer_start
Unexecuted instantiation: mf_dirname.c:my_b_get_buffer_start
Unexecuted instantiation: mf_loadpath.c:my_b_get_buffer_start
Unexecuted instantiation: mf_pack.c:my_b_get_buffer_start
Unexecuted instantiation: my_div.c:my_b_get_buffer_start
Unexecuted instantiation: my_getwd.c:my_b_get_buffer_start
Unexecuted instantiation: my_lib.c:my_b_get_buffer_start
Unexecuted instantiation: my_open.c:my_b_get_buffer_start
Unexecuted instantiation: my_read.c:my_b_get_buffer_start
Unexecuted instantiation: array.c:my_b_get_buffer_start
Unexecuted instantiation: charset-def.c:my_b_get_buffer_start
Unexecuted instantiation: mf_qsort.c:my_b_get_buffer_start
Unexecuted instantiation: my_alloc.c:my_b_get_buffer_start
Unexecuted instantiation: ctype-tis620.c:my_b_get_buffer_start
Unexecuted instantiation: str2int.c:my_b_get_buffer_start
606
607
static inline size_t my_b_get_bytes_in_buffer(const IO_CACHE *info)
608
0
{
609
0
  return (size_t) (info->read_end - info->request_pos);
610
0
}
Unexecuted instantiation: fuzz_json.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: json_lib.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: ctype-ucs2.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: dtoa.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: xml.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: ctype-simple.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_strtoll10.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_vsnprintf.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_malloc.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_static.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_thr_init.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: thr_mutex.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: thr_rwlock.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: psi_noop.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_error.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_getsystime.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_init.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_mess.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_once.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_symlink.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_sync.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: charset.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: errors.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: hash.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: mf_dirname.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: mf_loadpath.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: mf_pack.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_div.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_getwd.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_lib.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_open.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_read.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: array.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: charset-def.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: mf_qsort.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: my_alloc.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: ctype-tis620.c:my_b_get_bytes_in_buffer
Unexecuted instantiation: str2int.c:my_b_get_bytes_in_buffer
611
612
static inline my_off_t my_b_get_pos_in_file(const IO_CACHE *info)
613
0
{
614
0
  return info->pos_in_file;
615
0
}
Unexecuted instantiation: fuzz_json.c:my_b_get_pos_in_file
Unexecuted instantiation: json_lib.c:my_b_get_pos_in_file
Unexecuted instantiation: ctype-ucs2.c:my_b_get_pos_in_file
Unexecuted instantiation: dtoa.c:my_b_get_pos_in_file
Unexecuted instantiation: xml.c:my_b_get_pos_in_file
Unexecuted instantiation: ctype-simple.c:my_b_get_pos_in_file
Unexecuted instantiation: my_strtoll10.c:my_b_get_pos_in_file
Unexecuted instantiation: my_vsnprintf.c:my_b_get_pos_in_file
Unexecuted instantiation: my_malloc.c:my_b_get_pos_in_file
Unexecuted instantiation: my_static.c:my_b_get_pos_in_file
Unexecuted instantiation: my_thr_init.c:my_b_get_pos_in_file
Unexecuted instantiation: thr_mutex.c:my_b_get_pos_in_file
Unexecuted instantiation: thr_rwlock.c:my_b_get_pos_in_file
Unexecuted instantiation: psi_noop.c:my_b_get_pos_in_file
Unexecuted instantiation: my_error.c:my_b_get_pos_in_file
Unexecuted instantiation: my_getsystime.c:my_b_get_pos_in_file
Unexecuted instantiation: my_init.c:my_b_get_pos_in_file
Unexecuted instantiation: my_mess.c:my_b_get_pos_in_file
Unexecuted instantiation: my_once.c:my_b_get_pos_in_file
Unexecuted instantiation: my_symlink.c:my_b_get_pos_in_file
Unexecuted instantiation: my_sync.c:my_b_get_pos_in_file
Unexecuted instantiation: charset.c:my_b_get_pos_in_file
Unexecuted instantiation: errors.c:my_b_get_pos_in_file
Unexecuted instantiation: hash.c:my_b_get_pos_in_file
Unexecuted instantiation: mf_dirname.c:my_b_get_pos_in_file
Unexecuted instantiation: mf_loadpath.c:my_b_get_pos_in_file
Unexecuted instantiation: mf_pack.c:my_b_get_pos_in_file
Unexecuted instantiation: my_div.c:my_b_get_pos_in_file
Unexecuted instantiation: my_getwd.c:my_b_get_pos_in_file
Unexecuted instantiation: my_lib.c:my_b_get_pos_in_file
Unexecuted instantiation: my_open.c:my_b_get_pos_in_file
Unexecuted instantiation: my_read.c:my_b_get_pos_in_file
Unexecuted instantiation: array.c:my_b_get_pos_in_file
Unexecuted instantiation: charset-def.c:my_b_get_pos_in_file
Unexecuted instantiation: mf_qsort.c:my_b_get_pos_in_file
Unexecuted instantiation: my_alloc.c:my_b_get_pos_in_file
Unexecuted instantiation: ctype-tis620.c:my_b_get_pos_in_file
Unexecuted instantiation: str2int.c:my_b_get_pos_in_file
616
617
static inline size_t my_b_bytes_in_cache(const IO_CACHE *info)
618
0
{
619
0
  if (info->type == WRITE_CACHE) {
620
0
    return (size_t) (info->write_end - info->write_pos);
621
0
  }
622
0
  return (size_t) (info->read_end - info->read_pos);
623
0
}
Unexecuted instantiation: fuzz_json.c:my_b_bytes_in_cache
Unexecuted instantiation: json_lib.c:my_b_bytes_in_cache
Unexecuted instantiation: ctype-ucs2.c:my_b_bytes_in_cache
Unexecuted instantiation: dtoa.c:my_b_bytes_in_cache
Unexecuted instantiation: xml.c:my_b_bytes_in_cache
Unexecuted instantiation: ctype-simple.c:my_b_bytes_in_cache
Unexecuted instantiation: my_strtoll10.c:my_b_bytes_in_cache
Unexecuted instantiation: my_vsnprintf.c:my_b_bytes_in_cache
Unexecuted instantiation: my_malloc.c:my_b_bytes_in_cache
Unexecuted instantiation: my_static.c:my_b_bytes_in_cache
Unexecuted instantiation: my_thr_init.c:my_b_bytes_in_cache
Unexecuted instantiation: thr_mutex.c:my_b_bytes_in_cache
Unexecuted instantiation: thr_rwlock.c:my_b_bytes_in_cache
Unexecuted instantiation: psi_noop.c:my_b_bytes_in_cache
Unexecuted instantiation: my_error.c:my_b_bytes_in_cache
Unexecuted instantiation: my_getsystime.c:my_b_bytes_in_cache
Unexecuted instantiation: my_init.c:my_b_bytes_in_cache
Unexecuted instantiation: my_mess.c:my_b_bytes_in_cache
Unexecuted instantiation: my_once.c:my_b_bytes_in_cache
Unexecuted instantiation: my_symlink.c:my_b_bytes_in_cache
Unexecuted instantiation: my_sync.c:my_b_bytes_in_cache
Unexecuted instantiation: charset.c:my_b_bytes_in_cache
Unexecuted instantiation: errors.c:my_b_bytes_in_cache
Unexecuted instantiation: hash.c:my_b_bytes_in_cache
Unexecuted instantiation: mf_dirname.c:my_b_bytes_in_cache
Unexecuted instantiation: mf_loadpath.c:my_b_bytes_in_cache
Unexecuted instantiation: mf_pack.c:my_b_bytes_in_cache
Unexecuted instantiation: my_div.c:my_b_bytes_in_cache
Unexecuted instantiation: my_getwd.c:my_b_bytes_in_cache
Unexecuted instantiation: my_lib.c:my_b_bytes_in_cache
Unexecuted instantiation: my_open.c:my_b_bytes_in_cache
Unexecuted instantiation: my_read.c:my_b_bytes_in_cache
Unexecuted instantiation: array.c:my_b_bytes_in_cache
Unexecuted instantiation: charset-def.c:my_b_bytes_in_cache
Unexecuted instantiation: mf_qsort.c:my_b_bytes_in_cache
Unexecuted instantiation: my_alloc.c:my_b_bytes_in_cache
Unexecuted instantiation: ctype-tis620.c:my_b_bytes_in_cache
Unexecuted instantiation: str2int.c:my_b_bytes_in_cache
624
625
int my_b_copy_to_file    (IO_CACHE *cache, FILE *file, size_t count);
626
int my_b_copy_all_to_file(IO_CACHE *cache, FILE *file);
627
int my_b_copy_to_cache(IO_CACHE *from_cache, IO_CACHE *to_cache, size_t count);
628
int my_b_copy_all_to_cache(IO_CACHE *from_cache, IO_CACHE *to_cache);
629
630
my_off_t my_b_append_tell(IO_CACHE* info);
631
my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
632
int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos);
633
634
typedef uint32 ha_checksum;
635
636
extern int (*mysys_test_invalid_symlink)(const char *filename);
637
#include <my_alloc.h>
638
639
  /* Prototypes for mysys and my_func functions */
640
641
extern int my_copy(const char *from,const char *to,myf MyFlags);
642
extern int my_delete(const char *name,myf MyFlags);
643
extern int my_rmtree(const char *name, myf Myflags);
644
extern int my_getwd(char * buf,size_t size,myf MyFlags);
645
extern int my_setwd(const char *dir,myf MyFlags);
646
extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags);
647
extern void *my_once_alloc(size_t Size,myf MyFlags);
648
extern void my_once_free(void);
649
extern char *my_once_strdup(const char *src,myf myflags);
650
extern void *my_once_memdup(const void *src, size_t len, myf myflags);
651
extern File my_open(const char *FileName,int Flags,myf MyFlags);
652
extern File my_register_filename(File fd, const char *FileName,
653
         enum file_type type_of_file,
654
         uint error_message_number, myf MyFlags);
655
extern File my_create(const char *FileName,int CreateFlags,
656
          int AccessFlags, myf MyFlags);
657
extern int my_close(File Filedes,myf MyFlags);
658
extern int my_mkdir(const char *dir, int Flags, myf MyFlags);
659
extern int my_readlink(char *to, const char *filename, myf MyFlags);
660
extern int my_is_symlink(const char *filename);
661
extern int my_realpath(char *to, const char *filename, myf MyFlags);
662
extern File my_create_with_symlink(const char *linkname, const char *filename,
663
           int createflags, int access_flags,
664
           myf MyFlags);
665
extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags);
666
extern int my_symlink(const char *content, const char *linkname, myf MyFlags);
667
extern int my_handler_delete_with_symlink(const char *filename, myf sync_dir);
668
669
extern size_t my_read(File Filedes,uchar *Buffer,size_t Count,myf MyFlags);
670
extern size_t my_pread(File Filedes,uchar *Buffer,size_t Count,my_off_t offset,
671
         myf MyFlags);
672
extern int my_rename(const char *from,const char *to,myf MyFlags);
673
extern my_off_t my_seek(File fd,my_off_t pos,int whence,myf MyFlags);
674
extern my_off_t my_tell(File fd,myf MyFlags);
675
extern size_t my_write(File Filedes,const uchar *Buffer,size_t Count,
676
         myf MyFlags);
677
extern size_t my_pwrite(File Filedes,const uchar *Buffer,size_t Count,
678
          my_off_t offset,myf MyFlags);
679
extern size_t my_fread(FILE *stream,uchar *Buffer,size_t Count,myf MyFlags);
680
extern size_t my_fwrite(FILE *stream,const uchar *Buffer,size_t Count,
681
          myf MyFlags);
682
extern my_off_t my_fseek(FILE *stream,my_off_t pos,int whence,myf MyFlags);
683
extern my_off_t my_ftell(FILE *stream,myf MyFlags);
684
extern void (*my_sleep_for_space)(unsigned int seconds);
685
686
/* implemented in my_memmem.c */
687
extern void *my_memmem(const void *haystack, size_t haystacklen,
688
                       const void *needle, size_t needlelen);
689
690
691
#ifdef _WIN32
692
extern int      my_access(const char *path, int amode);
693
#define my_check_user(A,B) (NULL)
694
#define my_set_user(A,B,C) (0)
695
#else
696
#define my_access access
697
struct passwd *my_check_user(const char *user, myf MyFlags);
698
int my_set_user(const char *user, struct passwd *user_info, myf MyFlags);
699
#endif
700
701
extern int check_if_legal_filename(const char *path);
702
extern int check_if_legal_tablename(const char *path);
703
704
#ifdef _WIN32
705
extern my_bool is_filename_allowed(const char *name, size_t length,
706
                   my_bool allow_current_dir);
707
#else /* _WIN32 */
708
# define is_filename_allowed(name, length, allow_cwd) (TRUE)
709
#endif /* _WIN32 */ 
710
711
#ifdef _WIN32
712
/* Windows-only functions (CRT equivalents)*/
713
extern HANDLE   my_get_osfhandle(File fd);
714
extern File     my_win_handle2File(HANDLE hFile);
715
extern void     my_osmaperr(unsigned long last_error);
716
#endif
717
718
extern void init_glob_errs(void);
719
extern const char** get_global_errmsgs(int nr);
720
extern void wait_for_free_space(const char *filename, int errors);
721
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
722
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
723
extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
724
extern int my_fclose(FILE *fd,myf MyFlags);
725
extern int my_vfprintf(FILE *stream, const char* format, va_list args);
726
extern const char* my_strerror(char *buf, size_t len, int nr);
727
extern int my_fprintf(FILE *stream, const char* format, ...);
728
extern File my_fileno(FILE *fd);
729
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
730
extern int my_chmod(const char *name, mode_t mode, myf my_flags);
731
extern const char *my_basename(const char *filename);
732
extern void thr_set_sync_wait_callback(void (*before_sync)(void),
733
                                       void (*after_sync)(void));
734
extern int my_sync(File fd, myf my_flags);
735
extern int my_sync_dir(const char *dir_name, myf my_flags);
736
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);
737
extern const char *my_get_err_msg(uint nr);
738
extern int my_error_register(const char** (*get_errmsgs) (int nr),
739
                             uint first, uint last);
740
extern my_bool my_error_unregister(uint first, uint last);
741
extern void my_message(uint my_err, const char *str,myf MyFlags);
742
extern void my_message_stderr(uint my_err, const char *str, myf MyFlags);
743
extern my_bool my_init(void);
744
extern void my_end(int infoflag);
745
extern int my_redel(const char *from, const char *to, time_t backup_time_stamp,
746
                    myf MyFlags);
747
void my_create_backup_name(char *to, const char *from,
748
                           time_t backup_time_stamp);
749
extern int my_copystat(const char *from, const char *to, int MyFlags);
750
extern char * my_filename(File fd);
751
752
extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist);
753
extern char *my_tmpdir(MY_TMPDIR *tmpdir);
754
extern void free_tmpdir(MY_TMPDIR *tmpdir);
755
756
extern void my_remember_signal(int signal_number,sig_handler (*func)(int));
757
extern size_t dirname_part(char * to,const char *name, size_t *to_res_length);
758
extern size_t dirname_length(const char *name);
759
#define base_name(A) (A+dirname_length(A))
760
extern int test_if_hard_path(const char *dir_name);
761
extern my_bool has_path(const char *name);
762
extern char *convert_dirname(char *to, const char *from, const char *from_end);
763
extern void to_unix_path(char * name);
764
extern char * fn_ext(const char *name);
765
extern char * fn_ext2(const char *name);
766
extern char * fn_same(char * toname,const char *name,int flag);
767
extern char * fn_format(char * to,const char *name,const char *dir,
768
         const char *form, uint flag);
769
extern size_t strlength(const char *str);
770
extern void pack_dirname(char * to,const char *from);
771
extern size_t normalize_dirname(char * to, const char *from);
772
extern size_t unpack_dirname(char * to,const char *from);
773
extern size_t cleanup_dirname(char * to,const char *from);
774
extern size_t system_filename(char * to,const char *from);
775
extern size_t unpack_filename(char * to,const char *from);
776
extern char * intern_filename(char * to,const char *from);
777
extern int pack_filename(char * to, const char *name, size_t max_length);
778
extern char * my_path(char * to,const char *progname,
779
       const char *own_pathname_part);
780
extern char * my_load_path(char * to, const char *path,
781
            const char *own_path_prefix);
782
extern int wild_compare(const char *str,const char *wildstr,
783
                        pbool str_is_pattern);
784
extern my_bool array_append_string_unique(const char *str,
785
                                          const char **array, size_t size);
786
extern void get_date(char * to,int timeflag,time_t use_time);
787
extern void soundex(CHARSET_INFO *, char * out_pntr, char * in_pntr,
788
                    pbool remove_garbage);
789
extern int init_record_cache(RECORD_CACHE *info,size_t cachesize,File file,
790
           size_t reclength,enum cache_type type,
791
           pbool use_async_io);
792
extern int read_cache_record(RECORD_CACHE *info,uchar *to);
793
extern int end_record_cache(RECORD_CACHE *info);
794
extern int write_cache_record(RECORD_CACHE *info,my_off_t filepos,
795
            const uchar *record,size_t length);
796
extern int flush_write_cache(RECORD_CACHE *info);
797
extern void handle_recived_signals(void);
798
799
extern sig_handler my_set_alarm_variable(int signo);
800
extern my_bool radixsort_is_applicable(uint n_items, size_t size_of_element);
801
extern void my_string_ptr_sort(uchar *base,uint items,size_t size);
802
extern void radixsort_for_str_ptr(uchar* base[], uint number_of_elements,
803
          size_t size_of_element,uchar *buffer[]);
804
extern qsort_t my_qsort(void *base_ptr, size_t total_elems, size_t size,
805
                        qsort_cmp cmp);
806
extern qsort_t my_qsort2(void *base_ptr, size_t total_elems, size_t size,
807
                         qsort2_cmp cmp, void *cmp_argument);
808
extern qsort2_cmp get_ptr_compare(size_t);
809
void my_store_ptr(uchar *buff, size_t pack_length, my_off_t pos);
810
my_off_t my_get_ptr(uchar *ptr, size_t pack_length);
811
extern int init_io_cache(IO_CACHE *info,File file,size_t cachesize,
812
       enum cache_type type,my_off_t seek_offset,
813
       my_bool use_async_io, myf cache_myflags);
814
extern int init_io_cache_ext(IO_CACHE *info, File file, size_t cachesize,
815
                              enum cache_type type, my_off_t seek_offset,
816
                              pbool use_async_io, myf cache_myflags,
817
                              PSI_file_key file_key);
818
extern my_bool reinit_io_cache(IO_CACHE *info,enum cache_type type,
819
             my_off_t seek_offset, my_bool use_async_io,
820
             my_bool clear_cache);
821
extern void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare,
822
                                IO_CACHE *write_cache, uint num_threads);
823
824
extern int init_slave_io_cache(IO_CACHE *master, IO_CACHE *slave);
825
void end_slave_io_cache(IO_CACHE *cache);
826
void seek_io_cache(IO_CACHE *cache, my_off_t needed_offset);
827
828
extern void remove_io_thread(IO_CACHE *info);
829
extern int my_b_append(IO_CACHE *info,const uchar *Buffer,size_t Count);
830
extern int my_b_safe_write(IO_CACHE *info,const uchar *Buffer,size_t Count);
831
832
extern int my_block_write(IO_CACHE *info, const uchar *Buffer,
833
        size_t Count, my_off_t pos);
834
835
#define flush_io_cache(info) my_b_flush_io_cache((info),1)
836
837
extern int end_io_cache(IO_CACHE *info);
838
extern void my_b_seek(IO_CACHE *info,my_off_t pos);
839
extern size_t my_b_gets(IO_CACHE *info, char *to, size_t max_length);
840
extern my_off_t my_b_filelength(IO_CACHE *info);
841
extern my_bool my_b_write_backtick_quote(IO_CACHE *info, const char *str,
842
                                         size_t len);
843
extern my_bool my_b_printf(IO_CACHE *info, const char* fmt, ...);
844
extern size_t my_b_vprintf(IO_CACHE *info, const char* fmt, va_list ap);
845
extern my_bool open_cached_file(IO_CACHE *cache,const char *dir,
846
         const char *prefix, size_t cache_size,
847
         myf cache_myflags);
848
extern my_bool real_open_cached_file(IO_CACHE *cache);
849
extern void close_cached_file(IO_CACHE *cache);
850
extern File create_temp_file(char *to, const char *dir, const char *pfx,
851
                             int mode, myf MyFlags);
852
extern my_bool io_cache_tmp_file_track(IO_CACHE *info, ulonglong file_size);
853
854
0
#define my_init_dynamic_array(A,B,C,D,E,F) init_dynamic_array2(A,B,C,NULL,D,E,F)
855
#define my_init_dynamic_array2(A,B,C,D,E,F,G) init_dynamic_array2(A,B,C,D,E,F,G)
856
extern my_bool init_dynamic_array2(PSI_memory_key psi_key, DYNAMIC_ARRAY *array,
857
                                   size_t element_size, void *init_buffer,
858
                                   size_t init_alloc, size_t alloc_increment,
859
                                   myf my_flags);
860
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array, const void* element);
861
extern void *alloc_dynamic(DYNAMIC_ARRAY *array);
862
extern void *pop_dynamic(DYNAMIC_ARRAY*);
863
extern my_bool set_dynamic(DYNAMIC_ARRAY *array, const void *element,
864
                           size_t array_index);
865
extern my_bool allocate_dynamic(DYNAMIC_ARRAY *array, size_t max_elements);
866
extern void get_dynamic(DYNAMIC_ARRAY *array, void *element, size_t array_index);
867
extern void delete_dynamic(DYNAMIC_ARRAY *array);
868
extern void delete_dynamic_element(DYNAMIC_ARRAY *array, size_t array_index);
869
extern void delete_dynamic_with_callback(DYNAMIC_ARRAY *array, FREE_FUNC f);
870
extern void freeze_size(DYNAMIC_ARRAY *array);
871
#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
872
0
#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
873
0
#define push_dynamic(A,B) insert_dynamic((A),(B))
874
0
#define reset_dynamic(array) ((array)->elements= 0)
875
0
#define sort_dynamic(A,cmp) my_qsort((A)->buffer, (A)->elements, (A)->size_of_element, (cmp))
876
extern void init_append_dynamic(DYNAMIC_ARRAY_APPEND *append,
877
                                DYNAMIC_ARRAY *array);
878
extern my_bool append_dynamic(DYNAMIC_ARRAY_APPEND *append,
879
                              const void * element);
880
881
extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
882
           size_t init_alloc,size_t alloc_increment);
883
extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
884
my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
885
        size_t length);
886
extern my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append,
887
                                       ...);
888
extern my_bool dynstr_append_quoted(DYNAMIC_STRING *str,
889
                                    const char *append, size_t len,
890
                                    char quote);
891
extern my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str);
892
extern my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size);
893
extern my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n);
894
extern void dynstr_free(DYNAMIC_STRING *str);
895
extern uint32 copy_and_convert_extended(char *to, uint32 to_length,
896
                                        CHARSET_INFO *to_cs,
897
                                        const char *from, uint32 from_length,
898
                                        CHARSET_INFO *from_cs, uint *errors);
899
extern void dynstr_reassociate(DYNAMIC_STRING *str, char **res, size_t *length,
900
                               size_t *alloc_length);
901
extern uint32 copy_and_convert_extended(char *to, uint32 to_length,
902
                                        CHARSET_INFO *to_cs,
903
                                        const char *from, uint32 from_length,
904
                                        CHARSET_INFO *from_cs, uint *errors);
905
#ifdef HAVE_MLOCK
906
extern void *my_malloc_lock(size_t length,myf flags);
907
extern void my_free_lock(void *ptr);
908
#else
909
#define my_malloc_lock(A,B) my_malloc(PSI_INSTRUMENT_ME, (A),(B))
910
#define my_free_lock(A) my_free((A))
911
#endif
912
#define alloc_root_inited(A) ((A)->min_malloc != 0)
913
#define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0)
914
extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root,
915
                            size_t block_size, size_t pre_alloc_size,
916
                            myf my_flags);
917
extern void *alloc_root(MEM_ROOT *mem_root, size_t Size);
918
extern void *multi_alloc_root(MEM_ROOT *mem_root, ...);
919
extern void free_root(MEM_ROOT *root, myf MyFLAGS);
920
extern void move_root(MEM_ROOT *to, MEM_ROOT *from);
921
extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
922
extern void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size,
923
                                size_t prealloc_size);
924
extern USED_MEM *get_last_memroot_block(MEM_ROOT* root);
925
extern void free_all_new_blocks(MEM_ROOT *root, USED_MEM *last_block);
926
extern void protect_root(MEM_ROOT *root, int prot);
927
extern char *strdup_root(MEM_ROOT *root,const char *str);
928
static inline char *safe_strdup_root(MEM_ROOT *root, const char *str)
929
0
{
930
0
  return str ? strdup_root(root, str) : 0;
931
0
}
Unexecuted instantiation: fuzz_json.c:safe_strdup_root
Unexecuted instantiation: json_lib.c:safe_strdup_root
Unexecuted instantiation: ctype-ucs2.c:safe_strdup_root
Unexecuted instantiation: dtoa.c:safe_strdup_root
Unexecuted instantiation: xml.c:safe_strdup_root
Unexecuted instantiation: ctype-simple.c:safe_strdup_root
Unexecuted instantiation: my_strtoll10.c:safe_strdup_root
Unexecuted instantiation: my_vsnprintf.c:safe_strdup_root
Unexecuted instantiation: my_malloc.c:safe_strdup_root
Unexecuted instantiation: my_static.c:safe_strdup_root
Unexecuted instantiation: my_thr_init.c:safe_strdup_root
Unexecuted instantiation: thr_mutex.c:safe_strdup_root
Unexecuted instantiation: thr_rwlock.c:safe_strdup_root
Unexecuted instantiation: psi_noop.c:safe_strdup_root
Unexecuted instantiation: my_error.c:safe_strdup_root
Unexecuted instantiation: my_getsystime.c:safe_strdup_root
Unexecuted instantiation: my_init.c:safe_strdup_root
Unexecuted instantiation: my_mess.c:safe_strdup_root
Unexecuted instantiation: my_once.c:safe_strdup_root
Unexecuted instantiation: my_symlink.c:safe_strdup_root
Unexecuted instantiation: my_sync.c:safe_strdup_root
Unexecuted instantiation: charset.c:safe_strdup_root
Unexecuted instantiation: errors.c:safe_strdup_root
Unexecuted instantiation: hash.c:safe_strdup_root
Unexecuted instantiation: mf_dirname.c:safe_strdup_root
Unexecuted instantiation: mf_loadpath.c:safe_strdup_root
Unexecuted instantiation: mf_pack.c:safe_strdup_root
Unexecuted instantiation: my_div.c:safe_strdup_root
Unexecuted instantiation: my_getwd.c:safe_strdup_root
Unexecuted instantiation: my_lib.c:safe_strdup_root
Unexecuted instantiation: my_open.c:safe_strdup_root
Unexecuted instantiation: my_read.c:safe_strdup_root
Unexecuted instantiation: array.c:safe_strdup_root
Unexecuted instantiation: charset-def.c:safe_strdup_root
Unexecuted instantiation: mf_qsort.c:safe_strdup_root
Unexecuted instantiation: my_alloc.c:safe_strdup_root
Unexecuted instantiation: ctype-tis620.c:safe_strdup_root
Unexecuted instantiation: str2int.c:safe_strdup_root
932
extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len);
933
extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len);
934
935
extern LEX_CSTRING safe_lexcstrdup_root(MEM_ROOT *root, const LEX_CSTRING str);
936
937
static inline LEX_STRING lex_string_strmake_root(MEM_ROOT *mem_root,
938
                                                 const char *str, size_t length)
939
0
{
940
0
  LEX_STRING tmp;
941
0
  tmp.str= strmake_root(mem_root, str, length);
942
0
  tmp.length= tmp.str ? length : 0;
943
0
  return tmp;
944
0
}
Unexecuted instantiation: fuzz_json.c:lex_string_strmake_root
Unexecuted instantiation: json_lib.c:lex_string_strmake_root
Unexecuted instantiation: ctype-ucs2.c:lex_string_strmake_root
Unexecuted instantiation: dtoa.c:lex_string_strmake_root
Unexecuted instantiation: xml.c:lex_string_strmake_root
Unexecuted instantiation: ctype-simple.c:lex_string_strmake_root
Unexecuted instantiation: my_strtoll10.c:lex_string_strmake_root
Unexecuted instantiation: my_vsnprintf.c:lex_string_strmake_root
Unexecuted instantiation: my_malloc.c:lex_string_strmake_root
Unexecuted instantiation: my_static.c:lex_string_strmake_root
Unexecuted instantiation: my_thr_init.c:lex_string_strmake_root
Unexecuted instantiation: thr_mutex.c:lex_string_strmake_root
Unexecuted instantiation: thr_rwlock.c:lex_string_strmake_root
Unexecuted instantiation: psi_noop.c:lex_string_strmake_root
Unexecuted instantiation: my_error.c:lex_string_strmake_root
Unexecuted instantiation: my_getsystime.c:lex_string_strmake_root
Unexecuted instantiation: my_init.c:lex_string_strmake_root
Unexecuted instantiation: my_mess.c:lex_string_strmake_root
Unexecuted instantiation: my_once.c:lex_string_strmake_root
Unexecuted instantiation: my_symlink.c:lex_string_strmake_root
Unexecuted instantiation: my_sync.c:lex_string_strmake_root
Unexecuted instantiation: charset.c:lex_string_strmake_root
Unexecuted instantiation: errors.c:lex_string_strmake_root
Unexecuted instantiation: hash.c:lex_string_strmake_root
Unexecuted instantiation: mf_dirname.c:lex_string_strmake_root
Unexecuted instantiation: mf_loadpath.c:lex_string_strmake_root
Unexecuted instantiation: mf_pack.c:lex_string_strmake_root
Unexecuted instantiation: my_div.c:lex_string_strmake_root
Unexecuted instantiation: my_getwd.c:lex_string_strmake_root
Unexecuted instantiation: my_lib.c:lex_string_strmake_root
Unexecuted instantiation: my_open.c:lex_string_strmake_root
Unexecuted instantiation: my_read.c:lex_string_strmake_root
Unexecuted instantiation: array.c:lex_string_strmake_root
Unexecuted instantiation: charset-def.c:lex_string_strmake_root
Unexecuted instantiation: mf_qsort.c:lex_string_strmake_root
Unexecuted instantiation: my_alloc.c:lex_string_strmake_root
Unexecuted instantiation: ctype-tis620.c:lex_string_strmake_root
Unexecuted instantiation: str2int.c:lex_string_strmake_root
945
946
extern LEX_STRING lex_string_casedn_root(MEM_ROOT *root,
947
                                        CHARSET_INFO *cs,
948
                                        const char *str, size_t length);
949
950
extern my_bool my_compress(uchar *, size_t *, size_t *);
951
extern my_bool my_uncompress(uchar *, size_t , size_t *);
952
extern uchar *my_compress_alloc(const uchar *packet, size_t *len,
953
                                size_t *complen);
954
extern void *my_az_allocator(void *dummy, unsigned int items, unsigned int size);
955
extern void my_az_free(void *dummy, void *address);
956
extern int my_compress_buffer(uchar *dest, size_t *destLen,
957
                              const uchar *source, size_t sourceLen);
958
extern int packfrm(const uchar *, size_t, uchar **, size_t *);
959
extern int unpackfrm(uchar **, size_t *, const uchar *);
960
961
extern uint32 my_checksum(uint32, const void *, size_t);
962
extern uint32 my_crc32c(uint32, const void *, size_t);
963
964
extern const char *my_crc32c_implementation();
965
966
#ifdef DBUG_ASSERT_EXISTS
967
extern void my_debug_put_break_here(void);
968
#else
969
#define my_debug_put_break_here() do {} while(0)
970
#endif
971
972
extern void my_sleep(ulong m_seconds);
973
extern uint my_set_max_open_files(uint files);
974
void my_free_open_file_info(void);
975
976
extern my_bool my_gethwaddr(uchar *to);
977
extern int my_getncpus(void);
978
979
#define HRTIME_RESOLUTION               1000000ULL  /* microseconds */
980
typedef struct {ulonglong val;} my_hrtime_t;
981
void my_time_init(void);
982
extern my_hrtime_t my_hrtime(void);
983
984
#ifdef _WIN32
985
extern my_hrtime_t my_hrtime_coarse();
986
#else
987
#define my_hrtime_coarse() my_hrtime()
988
#endif
989
990
extern ulonglong my_interval_timer(void);
991
extern ulonglong my_getcputime(void);
992
993
#define microsecond_interval_timer()    (my_interval_timer()/1000)
994
#define hrtime_to_time(X)               ((time_t)((X).val/HRTIME_RESOLUTION))
995
#define hrtime_from_time(X)             ((ulonglong)((X)*HRTIME_RESOLUTION))
996
#define hrtime_to_double(X)             ((X).val/(double)HRTIME_RESOLUTION)
997
#define hrtime_sec_part(X)              ((ulong)((X).val % HRTIME_RESOLUTION))
998
#define my_time(X)                      hrtime_to_time(my_hrtime_coarse())
999
1000
/**
1001
  Make high resolution time from two parts.
1002
*/
1003
1004
static inline my_hrtime_t make_hr_time(my_time_t time, ulong time_sec_part)
1005
0
{
1006
0
  my_hrtime_t res= {((ulonglong) time)*1000000 + time_sec_part};
1007
0
  return res;
1008
0
}
Unexecuted instantiation: fuzz_json.c:make_hr_time
Unexecuted instantiation: json_lib.c:make_hr_time
Unexecuted instantiation: ctype-ucs2.c:make_hr_time
Unexecuted instantiation: dtoa.c:make_hr_time
Unexecuted instantiation: xml.c:make_hr_time
Unexecuted instantiation: ctype-simple.c:make_hr_time
Unexecuted instantiation: my_strtoll10.c:make_hr_time
Unexecuted instantiation: my_vsnprintf.c:make_hr_time
Unexecuted instantiation: my_malloc.c:make_hr_time
Unexecuted instantiation: my_static.c:make_hr_time
Unexecuted instantiation: my_thr_init.c:make_hr_time
Unexecuted instantiation: thr_mutex.c:make_hr_time
Unexecuted instantiation: thr_rwlock.c:make_hr_time
Unexecuted instantiation: psi_noop.c:make_hr_time
Unexecuted instantiation: my_error.c:make_hr_time
Unexecuted instantiation: my_getsystime.c:make_hr_time
Unexecuted instantiation: my_init.c:make_hr_time
Unexecuted instantiation: my_mess.c:make_hr_time
Unexecuted instantiation: my_once.c:make_hr_time
Unexecuted instantiation: my_symlink.c:make_hr_time
Unexecuted instantiation: my_sync.c:make_hr_time
Unexecuted instantiation: charset.c:make_hr_time
Unexecuted instantiation: errors.c:make_hr_time
Unexecuted instantiation: hash.c:make_hr_time
Unexecuted instantiation: mf_dirname.c:make_hr_time
Unexecuted instantiation: mf_loadpath.c:make_hr_time
Unexecuted instantiation: mf_pack.c:make_hr_time
Unexecuted instantiation: my_div.c:make_hr_time
Unexecuted instantiation: my_getwd.c:make_hr_time
Unexecuted instantiation: my_lib.c:make_hr_time
Unexecuted instantiation: my_open.c:make_hr_time
Unexecuted instantiation: my_read.c:make_hr_time
Unexecuted instantiation: array.c:make_hr_time
Unexecuted instantiation: charset-def.c:make_hr_time
Unexecuted instantiation: mf_qsort.c:make_hr_time
Unexecuted instantiation: my_alloc.c:make_hr_time
Unexecuted instantiation: ctype-tis620.c:make_hr_time
Unexecuted instantiation: str2int.c:make_hr_time
1009
1010
1011
#if STACK_DIRECTION < 0
1012
#define available_stack_size(CUR,END) (long) ((char*)(CUR) - (char*)(END))
1013
#else
1014
#define available_stack_size(CUR,END) (long) ((char*)(END) - (char*)(CUR))
1015
#endif
1016
1017
#ifndef MAP_SYNC
1018
#define MAP_SYNC 0x80000
1019
#endif
1020
#ifndef MAP_SHARED_VALIDATE
1021
#define MAP_SHARED_VALIDATE 0x03
1022
#endif
1023
1024
#ifdef HAVE_SYS_MMAN_H
1025
#ifndef MAP_NOSYNC
1026
#define MAP_NOSYNC      0
1027
#endif
1028
#ifndef MAP_NORESERVE
1029
#define MAP_NORESERVE 0         /* For irix and AIX */
1030
#endif
1031
1032
#ifdef HAVE_MMAP64
1033
0
#define my_mmap(a,b,c,d,e,f)    mmap64(a,b,c,d,e,f)
1034
#else
1035
#define my_mmap(a,b,c,d,e,f)    mmap(a,b,c,d,e,f)
1036
#endif
1037
0
#define my_munmap(a,b)          munmap((a),(b))
1038
1039
#else
1040
/* not a complete set of mmap() flags, but only those that necessary */
1041
#define PROT_READ        1
1042
#define PROT_WRITE       2
1043
#define MAP_NORESERVE    0
1044
#define MAP_SHARED       0x0001
1045
#define MAP_PRIVATE      0x0002
1046
#define MAP_NOSYNC       0x0800
1047
#define MAP_FAILED       ((void *)-1)
1048
#define MS_SYNC          0x0000
1049
1050
#define HAVE_MMAP
1051
void *my_mmap(void *, size_t, int, int, int, my_off_t);
1052
int my_munmap(void *, size_t);
1053
#endif
1054
1055
#ifdef _WIN32
1056
extern FILE* my_win_popen(const char*, const char*);
1057
extern int my_win_pclose(FILE*);
1058
#define my_popen(A,B) my_win_popen(A,B)
1059
#define my_pclose(A) my_win_pclose(A)
1060
#else
1061
#define my_popen(A,B) popen(A,B)
1062
#define my_pclose(A) pclose(A)
1063
#endif
1064
1065
/* my_getpagesize */
1066
#ifdef HAVE_GETPAGESIZE
1067
#define my_getpagesize()        getpagesize()
1068
#else
1069
int my_getpagesize(void);
1070
#endif
1071
1072
int my_msync(int, void *, size_t, int);
1073
1074
#define MY_UUID_SIZE 16
1075
#define MY_UUID_BARE_STRING_LENGTH (8+4+4+4+12)
1076
#define MY_UUID_SEPARATORS 4
1077
#define MY_UUID_STRING_LENGTH (MY_UUID_BARE_STRING_LENGTH + MY_UUID_SEPARATORS)
1078
1079
void my_uuid_init(ulong seed1, ulong seed2);
1080
void my_uuid(uchar *guid);
1081
void my_uuid_end(void);
1082
1083
static inline void my_uuid2str(const uchar *guid, char *s, int with_separators)
1084
0
{
1085
0
  int i;
1086
0
  int mask= with_separators ? ((1 << 3) | (1 << 5) | (1 << 7) | (1 << 9)) : 0;
1087
0
  for (i=0; i < MY_UUID_SIZE; i++, mask >>= 1)
1088
0
  {
1089
0
    *s++= _dig_vec_lower[guid[i] >>4];
1090
0
    *s++= _dig_vec_lower[guid[i] & 15];
1091
0
    if (mask & 1)
1092
0
      *s++= '-';
1093
0
  }
1094
0
}
Unexecuted instantiation: fuzz_json.c:my_uuid2str
Unexecuted instantiation: json_lib.c:my_uuid2str
Unexecuted instantiation: ctype-ucs2.c:my_uuid2str
Unexecuted instantiation: dtoa.c:my_uuid2str
Unexecuted instantiation: xml.c:my_uuid2str
Unexecuted instantiation: ctype-simple.c:my_uuid2str
Unexecuted instantiation: my_strtoll10.c:my_uuid2str
Unexecuted instantiation: my_vsnprintf.c:my_uuid2str
Unexecuted instantiation: my_malloc.c:my_uuid2str
Unexecuted instantiation: my_static.c:my_uuid2str
Unexecuted instantiation: my_thr_init.c:my_uuid2str
Unexecuted instantiation: thr_mutex.c:my_uuid2str
Unexecuted instantiation: thr_rwlock.c:my_uuid2str
Unexecuted instantiation: psi_noop.c:my_uuid2str
Unexecuted instantiation: my_error.c:my_uuid2str
Unexecuted instantiation: my_getsystime.c:my_uuid2str
Unexecuted instantiation: my_init.c:my_uuid2str
Unexecuted instantiation: my_mess.c:my_uuid2str
Unexecuted instantiation: my_once.c:my_uuid2str
Unexecuted instantiation: my_symlink.c:my_uuid2str
Unexecuted instantiation: my_sync.c:my_uuid2str
Unexecuted instantiation: charset.c:my_uuid2str
Unexecuted instantiation: errors.c:my_uuid2str
Unexecuted instantiation: hash.c:my_uuid2str
Unexecuted instantiation: mf_dirname.c:my_uuid2str
Unexecuted instantiation: mf_loadpath.c:my_uuid2str
Unexecuted instantiation: mf_pack.c:my_uuid2str
Unexecuted instantiation: my_div.c:my_uuid2str
Unexecuted instantiation: my_getwd.c:my_uuid2str
Unexecuted instantiation: my_lib.c:my_uuid2str
Unexecuted instantiation: my_open.c:my_uuid2str
Unexecuted instantiation: my_read.c:my_uuid2str
Unexecuted instantiation: array.c:my_uuid2str
Unexecuted instantiation: charset-def.c:my_uuid2str
Unexecuted instantiation: mf_qsort.c:my_uuid2str
Unexecuted instantiation: my_alloc.c:my_uuid2str
Unexecuted instantiation: ctype-tis620.c:my_uuid2str
Unexecuted instantiation: str2int.c:my_uuid2str
1095
1096
1097
const char *my_dlerror(const char *dlpath);
1098
1099
1100
/* System timezone handling*/
1101
void my_tzset();
1102
void my_tzname(char *sys_timezone, size_t size);
1103
1104
struct my_tz
1105
{
1106
  long seconds_offset;
1107
  char abbreviation[64];
1108
};
1109
void my_tzinfo(time_t t, struct my_tz*);
1110
1111
/* character sets */
1112
extern void my_charset_loader_init_mysys(MY_CHARSET_LOADER *loader);
1113
extern uint get_charset_number(const char *cs_name, uint cs_flags, myf flags);
1114
extern uint get_collation_number(const char *name,myf flags);
1115
extern const char *get_charset_name(uint cs_number);
1116
1117
extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
1118
extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
1119
extern CHARSET_INFO *my_collation_get_by_name(MY_CHARSET_LOADER *loader,
1120
                                              const char *name, myf flags);
1121
extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
1122
             uint cs_flags, myf my_flags);
1123
extern CHARSET_INFO *my_charset_get_by_name(MY_CHARSET_LOADER *loader,
1124
                                            const char *name,
1125
                                            uint cs_flags, myf my_flags);
1126
extern my_bool resolve_charset(const char *cs_name,
1127
                               CHARSET_INFO *default_cs,
1128
                               CHARSET_INFO **cs,
1129
                               myf flags);
1130
extern my_bool resolve_collation(const char *cl_name,
1131
                                 CHARSET_INFO *default_cl,
1132
                                 CHARSET_INFO **cl,
1133
                                 myf my_flags);
1134
extern void free_charsets(void);
1135
extern char *get_charsets_dir(char *buf);
1136
static inline my_bool my_charset_same(CHARSET_INFO *cs1, CHARSET_INFO *cs2)
1137
0
{
1138
0
  return (cs1->cs_name.str == cs2->cs_name.str);
1139
0
}
Unexecuted instantiation: fuzz_json.c:my_charset_same
Unexecuted instantiation: json_lib.c:my_charset_same
Unexecuted instantiation: ctype-ucs2.c:my_charset_same
Unexecuted instantiation: dtoa.c:my_charset_same
Unexecuted instantiation: xml.c:my_charset_same
Unexecuted instantiation: ctype-simple.c:my_charset_same
Unexecuted instantiation: my_strtoll10.c:my_charset_same
Unexecuted instantiation: my_vsnprintf.c:my_charset_same
Unexecuted instantiation: my_malloc.c:my_charset_same
Unexecuted instantiation: my_static.c:my_charset_same
Unexecuted instantiation: my_thr_init.c:my_charset_same
Unexecuted instantiation: thr_mutex.c:my_charset_same
Unexecuted instantiation: thr_rwlock.c:my_charset_same
Unexecuted instantiation: psi_noop.c:my_charset_same
Unexecuted instantiation: my_error.c:my_charset_same
Unexecuted instantiation: my_getsystime.c:my_charset_same
Unexecuted instantiation: my_init.c:my_charset_same
Unexecuted instantiation: my_mess.c:my_charset_same
Unexecuted instantiation: my_once.c:my_charset_same
Unexecuted instantiation: my_symlink.c:my_charset_same
Unexecuted instantiation: my_sync.c:my_charset_same
Unexecuted instantiation: charset.c:my_charset_same
Unexecuted instantiation: errors.c:my_charset_same
Unexecuted instantiation: hash.c:my_charset_same
Unexecuted instantiation: mf_dirname.c:my_charset_same
Unexecuted instantiation: mf_loadpath.c:my_charset_same
Unexecuted instantiation: mf_pack.c:my_charset_same
Unexecuted instantiation: my_div.c:my_charset_same
Unexecuted instantiation: my_getwd.c:my_charset_same
Unexecuted instantiation: my_lib.c:my_charset_same
Unexecuted instantiation: my_open.c:my_charset_same
Unexecuted instantiation: my_read.c:my_charset_same
Unexecuted instantiation: array.c:my_charset_same
Unexecuted instantiation: charset-def.c:my_charset_same
Unexecuted instantiation: mf_qsort.c:my_charset_same
Unexecuted instantiation: my_alloc.c:my_charset_same
Unexecuted instantiation: ctype-tis620.c:my_charset_same
Unexecuted instantiation: str2int.c:my_charset_same
1140
extern my_bool init_compiled_charsets(myf flags);
1141
extern void add_compiled_collation(struct charset_info_st *cs);
1142
extern void add_compiled_extra_collation(struct charset_info_st *cs);
1143
extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
1144
                                      char *to, size_t to_length,
1145
                                      const char *from, size_t length,
1146
                                      my_bool *overflow);
1147
extern char *my_get_tty_password(const char *opt_message);
1148
#ifdef _WIN32
1149
#define BACKSLASH_MBTAIL
1150
/* File system character set */
1151
extern CHARSET_INFO *fs_character_set(void);
1152
extern int my_set_console_cp(const char *name);
1153
#else
1154
#define my_set_console_cp(A) do {} while (0)
1155
#endif
1156
extern const char *my_default_csname(void);
1157
extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
1158
                                      char *to, size_t to_length,
1159
                                      const char *from, size_t length,
1160
                                      my_bool *overflow);
1161
1162
extern void thd_increment_bytes_sent(void *thd, size_t length);
1163
extern void thd_increment_bytes_received(void *thd, size_t length);
1164
extern void thd_increment_net_big_packet_count(void *thd, size_t length);
1165
1166
#include <mysql/psi/psi.h>
1167
1168
#ifdef HAVE_PSI_INTERFACE
1169
extern MYSQL_PLUGIN_IMPORT struct PSI_bootstrap *PSI_hook;
1170
extern void set_psi_server(PSI *psi);
1171
void my_init_mysys_psi_keys(void);
1172
#endif
1173
1174
struct st_mysql_file;
1175
extern struct st_mysql_file *mysql_stdin;
1176
C_MODE_END
1177
1178
1179
#ifdef __cplusplus
1180
1181
class Charset_loader_mysys: public MY_CHARSET_LOADER
1182
{
1183
public:
1184
  Charset_loader_mysys()
1185
  {
1186
    my_charset_loader_init_mysys(this);
1187
  }
1188
1189
  /**
1190
    Get a CHARSET_INFO by a character set name.
1191
1192
    @param name      Collation name
1193
    @param cs_flags  e.g. MY_CS_PRIMARY, MY_CS_BINARY
1194
    @param my_flags  mysys flags (MY_WME, MY_UTF8_IS_UTF8MB3)
1195
    @return
1196
    @retval          NULL on error (e.g. not found)
1197
    @retval          A CHARSET_INFO pointter on success
1198
  */
1199
  CHARSET_INFO *get_charset(const char *cs_name, uint cs_flags, myf my_flags)
1200
  {
1201
    error[0]= '\0'; // Need to clear in case of the second call
1202
    return my_charset_get_by_name(this, cs_name, cs_flags, my_flags);
1203
  }
1204
1205
  /**
1206
    Get a CHARSET_INFO by an exact collation by name.
1207
1208
    @param name      Collation name
1209
    @param my_flags  e.g. the utf8 translation flag
1210
    @return
1211
    @retval          NULL on error (e.g. not found)
1212
    @retval          A CHARSET_INFO pointter on success
1213
  */
1214
  CHARSET_INFO *get_exact_collation(const char *name, myf my_flags)
1215
  {
1216
    error[0]= '\0'; // Need to clear in case of the second call
1217
    return my_collation_get_by_name(this, name, my_flags);
1218
  }
1219
1220
  /**
1221
    Get a CHARSET_INFO by a context collation by name.
1222
    The returned pointer must be further resolved to a character set.
1223
1224
    @param name      Collation name
1225
    @param utf8_flag The utf8 translation flag
1226
    @return
1227
    @retval          NULL on error (e.g. not found)
1228
    @retval          A CHARSET_INFO pointter on success
1229
  */
1230
  CHARSET_INFO *get_context_collation(const char *name, myf my_flags)
1231
  {
1232
    return get_exact_collation_by_context_name(&my_charset_utf8mb4_general_ci,
1233
                                               name, my_flags);
1234
  }
1235
1236
  /**
1237
    Get an exact CHARSET_INFO by a contextually typed collation name.
1238
1239
    @param name      Collation name
1240
    @param utf8_flag The utf8 translation flag
1241
    @return
1242
    @retval          NULL on error (e.g. not found)
1243
    @retval          A CHARSET_INFO pointer on success
1244
  */
1245
  CHARSET_INFO *get_exact_collation_by_context_name(CHARSET_INFO *cs,
1246
                                                    const char *name,
1247
                                                    myf my_flags)
1248
  {
1249
    char tmp[MY_CS_COLLATION_NAME_SIZE];
1250
    my_snprintf(tmp, sizeof(tmp), "%s_%s", cs->cs_name.str, name);
1251
    return get_exact_collation(tmp, my_flags);
1252
  }
1253
1254
  /*
1255
    Find a collation with binary comparison rules
1256
  */
1257
  CHARSET_INFO *get_bin_collation(CHARSET_INFO *cs, myf my_flags)
1258
  {
1259
    /*
1260
      We don't need to handle old_mode=UTF8_IS_UTF8MB3 here,
1261
      This method assumes that "cs" points to a real character set name.
1262
      It can be either "utf8mb3" or "utf8mb4". It cannot be "utf8".
1263
      No thd->get_utf8_flag() flag passed to get_charset_by_csname().
1264
    */
1265
    DBUG_ASSERT(cs->cs_name.length !=4 || memcmp(cs->cs_name.str, "utf8", 4));
1266
    /*
1267
      CREATE TABLE t1 (a CHAR(10) BINARY)
1268
        CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
1269
      Nothing to do, we have the binary collation already.
1270
    */
1271
    if (cs->state & MY_CS_BINSORT)
1272
      return cs;
1273
1274
    // CREATE TABLE t1 (a CHAR(10) BINARY) CHARACTER SET utf8mb4;/
1275
    error[0]= '\0'; // Need in case of the second execution
1276
    return get_charset(cs->cs_name.str, MY_CS_BINSORT, my_flags);
1277
  }
1278
1279
  /*
1280
    Find the default collation in the given character set
1281
  */
1282
  CHARSET_INFO *get_default_collation(CHARSET_INFO *cs, myf my_flags)
1283
  {
1284
    // See comments in find_bin_collation_or_error()
1285
    DBUG_ASSERT(cs->cs_name.length !=4 || memcmp(cs->cs_name.str, "utf8", 4));
1286
    /*
1287
      CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT) CHARACTER SET utf8mb4;
1288
      Nothing to do, we have the default collation already.
1289
    */
1290
    if (cs->state & MY_CS_PRIMARY)
1291
      return cs;
1292
    /*
1293
      CREATE TABLE t1 (a CHAR(10) COLLATE DEFAULT)
1294
        CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
1295
1296
      Don't need to handle old_mode=UTF8_IS_UTF8MB3 here.
1297
      See comments in find_bin_collation_or_error.
1298
    */
1299
    cs= get_charset(cs->cs_name.str, MY_CS_PRIMARY, my_flags);
1300
    DBUG_ASSERT(cs);
1301
    return cs;
1302
  }
1303
};
1304
1305
#endif /*__cplusplus */
1306
1307
1308
#endif /* _my_sys_h */