You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Renamed prefixes for 10.2 integration
This commit is contained in:
@@ -56,16 +56,16 @@ static struct st_plugin_type plugin_types[]=
|
|||||||
|
|
||||||
static void version()
|
static void version()
|
||||||
{
|
{
|
||||||
printf("%s Version %s\n", my_progname, CLIENT_PLUGIN_INFO_VERSION);
|
printf("%s Version %s\n", ma_progname, CLIENT_PLUGIN_INFO_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
printf("%s Version %s\n", my_progname, CLIENT_PLUGIN_INFO_VERSION);
|
printf("%s Version %s\n", ma_progname, CLIENT_PLUGIN_INFO_VERSION);
|
||||||
puts("Copyright 2015 MariaDB Corporation AB");
|
puts("Copyright 2015 MariaDB Corporation AB");
|
||||||
puts("Show client plugin information for MariaDB Connector/C.");
|
puts("Show client plugin information for MariaDB Connector/C.");
|
||||||
printf("Usage: %s [OPTIONS] [plugin_name]\n", my_progname);
|
printf("Usage: %s [OPTIONS] [plugin_name]\n", ma_progname);
|
||||||
while (long_options[i].name)
|
while (long_options[i].name)
|
||||||
{
|
{
|
||||||
printf(" --%-12s -%s\n", long_options[i].name, values[i]);
|
printf(" --%-12s -%s\n", long_options[i].name, values[i]);
|
||||||
@@ -73,7 +73,7 @@ static void usage(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *get_type_name(int type)
|
static char *ma_get_type_name(int type)
|
||||||
{
|
{
|
||||||
int i=0;
|
int i=0;
|
||||||
while (plugin_types[i].type)
|
while (plugin_types[i].type)
|
||||||
@@ -88,7 +88,7 @@ static char *get_type_name(int type)
|
|||||||
static void show_plugin_info(struct st_mysql_client_plugin *plugin, my_bool builtin)
|
static void show_plugin_info(struct st_mysql_client_plugin *plugin, my_bool builtin)
|
||||||
{
|
{
|
||||||
printf("Name: %s\n", plugin->name);
|
printf("Name: %s\n", plugin->name);
|
||||||
printf("Type: %s\n", get_type_name(plugin->type));
|
printf("Type: %s\n", ma_get_type_name(plugin->type));
|
||||||
printf("Desc: %s\n", plugin->desc);
|
printf("Desc: %s\n", plugin->desc);
|
||||||
printf("Author: %s\n", plugin->author);
|
printf("Author: %s\n", plugin->author);
|
||||||
printf("License: %s\n", plugin->license);
|
printf("License: %s\n", plugin->license);
|
||||||
@@ -164,7 +164,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int option_index= 0;
|
int option_index= 0;
|
||||||
int c;
|
int c;
|
||||||
my_progname= argv[0];
|
ma_progname= argv[0];
|
||||||
|
|
||||||
mysql_server_init(0, NULL, NULL);
|
mysql_server_init(0, NULL, NULL);
|
||||||
|
|
||||||
|
@@ -37,7 +37,7 @@ extern const char *mariadb_client_errors[]; /* Error messages */
|
|||||||
#define CER_MAX_ERROR 5999
|
#define CER_MAX_ERROR 5999
|
||||||
#define CER(X) mariadb_client_errors[(X)-CER_MIN_ERROR]
|
#define CER(X) mariadb_client_errors[(X)-CER_MIN_ERROR]
|
||||||
#define ER(X) client_errors[(X)-CR_MIN_ERROR]
|
#define ER(X) client_errors[(X)-CR_MIN_ERROR]
|
||||||
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
|
#define CLIENT_ERRMAP 2 /* Errormap used by ma_error() */
|
||||||
|
|
||||||
#define CR_UNKNOWN_ERROR 2000
|
#define CR_UNKNOWN_ERROR 2000
|
||||||
#define CR_SOCKET_CREATE_ERROR 2001
|
#define CR_SOCKET_CREATE_ERROR 2001
|
||||||
|
@@ -52,11 +52,11 @@ typedef struct charset_info_st
|
|||||||
} CHARSET_INFO;
|
} CHARSET_INFO;
|
||||||
|
|
||||||
extern const CHARSET_INFO compiled_charsets[];
|
extern const CHARSET_INFO compiled_charsets[];
|
||||||
extern CHARSET_INFO *default_charset_info;
|
extern CHARSET_INFO *ma_default_charset_info;
|
||||||
extern CHARSET_INFO *my_charset_bin;
|
extern CHARSET_INFO *ma_charset_bin;
|
||||||
extern CHARSET_INFO *my_charset_latin1;
|
extern CHARSET_INFO *ma_charset_latin1;
|
||||||
extern CHARSET_INFO *my_charset_utf8_general_ci;
|
extern CHARSET_INFO *ma_charset_utf8_general_ci;
|
||||||
extern CHARSET_INFO *my_charset_utf16le_general_ci;
|
extern CHARSET_INFO *ma_charset_utf16le_general_ci;
|
||||||
|
|
||||||
CHARSET_INFO *find_compiled_charset(unsigned int cs_number);
|
CHARSET_INFO *find_compiled_charset(unsigned int cs_number);
|
||||||
CHARSET_INFO *find_compiled_charset_by_name(const char *name);
|
CHARSET_INFO *find_compiled_charset_by_name(const char *name);
|
||||||
|
@@ -195,7 +195,7 @@ extern char *my_itoa(int val,char *dst,int radix);
|
|||||||
extern char *my_ltoa(long val,char *dst,int radix);
|
extern char *my_ltoa(long val,char *dst,int radix);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char *llstr(longlong value,char *buff);
|
extern char *ma_llstr(longlong value,char *buff);
|
||||||
#ifndef HAVE_STRTOUL
|
#ifndef HAVE_STRTOUL
|
||||||
extern long strtol(const char *str, char **ptr, int base);
|
extern long strtol(const char *str, char **ptr, int base);
|
||||||
extern ulong strtoul(const char *str, char **ptr, int base);
|
extern ulong strtoul(const char *str, char **ptr, int base);
|
||||||
|
@@ -25,26 +25,26 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int volatile my_have_got_alarm;
|
extern int volatile ma_have_got_alarm;
|
||||||
extern ulong my_time_to_wait_for_lock;
|
extern ulong ma_time_to_wait_for_lock;
|
||||||
|
|
||||||
#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
|
#if defined(HAVE_ALARM) && !defined(NO_ALARM_LOOP)
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#define ALARM_VARIABLES uint alarm_old=0; \
|
#define ALARM_VARIABLES uint alarm_old=0; \
|
||||||
sig_return alarm_signal=0
|
sig_return alarm_signal=0
|
||||||
#define ALARM_INIT my_have_got_alarm=0 ; \
|
#define ALARM_INIT ma_have_got_alarm=0 ; \
|
||||||
alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \
|
alarm_old=(uint) alarm(MY_HOW_OFTEN_TO_ALARM); \
|
||||||
alarm_signal=signal(SIGALRM,my_set_alarm_variable);
|
alarm_signal=signal(SIGALRM,my_set_alarm_variable);
|
||||||
#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
|
#define ALARM_END VOID(signal(SIGALRM,alarm_signal)); \
|
||||||
VOID(alarm(alarm_old));
|
VOID(alarm(alarm_old));
|
||||||
#define ALARM_TEST my_have_got_alarm
|
#define ALARM_TEST ma_have_got_alarm
|
||||||
#ifdef DONT_REMEMBER_SIGNAL
|
#ifdef DONT_REMEMBER_SIGNAL
|
||||||
#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
|
#define ALARM_REINIT VOID(alarm(MY_HOW_OFTEN_TO_ALARM)); \
|
||||||
VOID(signal(SIGALRM,my_set_alarm_variable));\
|
VOID(signal(SIGALRM,my_set_alarm_variable));\
|
||||||
my_have_got_alarm=0;
|
ma_have_got_alarm=0;
|
||||||
#else
|
#else
|
||||||
#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
|
#define ALARM_REINIT VOID(alarm((uint) MY_HOW_OFTEN_TO_ALARM)); \
|
||||||
my_have_got_alarm=0;
|
ma_have_got_alarm=0;
|
||||||
#endif /* DONT_REMEMBER_SIGNAL */
|
#endif /* DONT_REMEMBER_SIGNAL */
|
||||||
#else
|
#else
|
||||||
#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
|
#define ALARM_VARIABLES long alarm_pos=0,alarm_end_pos=MY_HOW_OFTEN_TO_WRITE-1
|
||||||
|
@@ -39,7 +39,7 @@ extern int list_walk(LIST *list,list_walk_action action,gptr argument);
|
|||||||
|
|
||||||
#define rest(a) ((a)->next)
|
#define rest(a) ((a)->next)
|
||||||
#define list_push(a,b) (a)=list_cons((b),(a))
|
#define list_push(a,b) (a)=list_cons((b),(a))
|
||||||
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; my_free((gptr) old,MYF(MY_FAE)); }
|
#define list_pop(A) {LIST *old=(A); (A)=list_delete(old,old) ; ma_free((gptr) old,MYF(MY_FAE)); }
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -516,11 +516,11 @@ extern pthread_mutexattr_t my_errchk_mutexattr;
|
|||||||
#define MY_INIT_MUTEX_ERRCHK &my_errchk_mutexattr
|
#define MY_INIT_MUTEX_ERRCHK &my_errchk_mutexattr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern my_bool my_thread_global_init(void);
|
extern my_bool ma_thread_global_init(void);
|
||||||
extern void my_thread_global_end(void);
|
extern void ma_thread_global_end(void);
|
||||||
extern my_bool my_thread_init(void);
|
extern my_bool ma_thread_init(void);
|
||||||
extern void my_thread_end(void);
|
extern void ma_thread_end(void);
|
||||||
extern const char *my_thread_name(void);
|
extern const char *ma_thread_name(void);
|
||||||
extern long my_thread_id(void);
|
extern long my_thread_id(void);
|
||||||
extern int pthread_no_free(void *);
|
extern int pthread_no_free(void *);
|
||||||
extern int pthread_dummy(int);
|
extern int pthread_dummy(int);
|
||||||
@@ -534,7 +534,7 @@ extern int pthread_dummy(int);
|
|||||||
#define DEFAULT_THREAD_STACK (64*1024)
|
#define DEFAULT_THREAD_STACK (64*1024)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct st_my_thread_var
|
struct st_ma_thread_var
|
||||||
{
|
{
|
||||||
int thr_errno;
|
int thr_errno;
|
||||||
pthread_cond_t suspend;
|
pthread_cond_t suspend;
|
||||||
@@ -552,9 +552,9 @@ struct st_my_thread_var
|
|||||||
my_bool initialized;
|
my_bool initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct st_my_thread_var *_my_thread_var(void) __attribute__ ((const));
|
extern struct st_ma_thread_var *_ma_thread_var(void) __attribute__ ((const));
|
||||||
extern void **my_thread_var_dbug();
|
extern void **my_thread_var_dbug();
|
||||||
#define my_thread_var (_my_thread_var())
|
#define my_thread_var (_ma_thread_var())
|
||||||
#define my_errno my_thread_var->thr_errno
|
#define my_errno my_thread_var->thr_errno
|
||||||
|
|
||||||
/* statistics_xxx functions are for not essential statistic */
|
/* statistics_xxx functions are for not essential statistic */
|
||||||
|
160
include/my_sys.h
160
include/my_sys.h
@@ -41,9 +41,9 @@ extern int NEAR my_errno; /* Last error in mysys */
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; }
|
#define MYSYS_PROGRAM_USES_CURSES() { ma_error_handler_hook = ma_message_curses; mysys_uses_curses=1; }
|
||||||
#define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;}
|
#define MYSYS_PROGRAM_DONT_USE_CURSES() { ma_error_handler_hook = ma_message_no_curses; mysys_uses_curses=0;}
|
||||||
#define MY_INIT(name); { my_progname= name; my_init(); }
|
#define MY_INIT(name); { ma_progname= name; ma_init(); }
|
||||||
|
|
||||||
#define MAXMAPS (4) /* Number of error message maps */
|
#define MAXMAPS (4) /* Number of error message maps */
|
||||||
#define ERRMOD (1000) /* Max number of errors in a map */
|
#define ERRMOD (1000) /* Max number of errors in a map */
|
||||||
@@ -68,14 +68,14 @@ extern int NEAR my_errno; /* Last error in mysys */
|
|||||||
#define MY_REDEL_MAKE_BACKUP 256
|
#define MY_REDEL_MAKE_BACKUP 256
|
||||||
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
|
#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
|
||||||
#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
|
#define MY_DONT_WAIT 64 /* my_lock() don't wait if can't lock */
|
||||||
#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */
|
#define MY_ZEROFILL 32 /* ma_malloc(), fill array with zero */
|
||||||
#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */
|
#define MY_ALLOW_ZERO_PTR 64 /* ma_realloc() ; zero ptr -> malloc */
|
||||||
#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
|
#define MY_FREE_ON_ERROR 128 /* ma_realloc() ; Free old ptr on error */
|
||||||
#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
|
#define MY_HOLD_ON_ERROR 256 /* ma_realloc() ; Return old ptr on error */
|
||||||
#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */
|
#define MY_THREADSAFE 128 /* pread/pwrite: Don't allow interrupts */
|
||||||
#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */
|
#define MY_DONT_OVERWRITE_FILE 1024 /* my_copy; Don't overwrite file */
|
||||||
|
|
||||||
#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
|
#define MY_CHECK_ERROR 1 /* Params to ma_end; Check open-close */
|
||||||
#define MY_GIVE_INFO 2 /* Give time info about process*/
|
#define MY_GIVE_INFO 2 /* Give time info about process*/
|
||||||
|
|
||||||
#define ME_HIGHBYTE 8 /* Shift for colours */
|
#define ME_HIGHBYTE 8 /* Shift for colours */
|
||||||
@@ -119,14 +119,14 @@ extern int NEAR my_errno; /* Last error in mysys */
|
|||||||
#define TERMINATE(A) {}
|
#define TERMINATE(A) {}
|
||||||
#define QUICK_SAFEMALLOC
|
#define QUICK_SAFEMALLOC
|
||||||
#define NORMAL_SAFEMALLOC
|
#define NORMAL_SAFEMALLOC
|
||||||
extern gptr my_malloc(size_t Size,myf MyFlags);
|
extern gptr ma_malloc(size_t Size,myf MyFlags);
|
||||||
#define my_malloc_ci(SZ,FLAG) my_malloc( SZ, FLAG )
|
#define ma_malloc_ci(SZ,FLAG) ma_malloc( SZ, FLAG )
|
||||||
extern gptr my_realloc(gptr oldpoint, size_t Size,myf MyFlags);
|
extern gptr ma_realloc(gptr oldpoint, size_t Size,myf MyFlags);
|
||||||
extern void my_no_flags_free(void *ptr);
|
extern void my_no_flags_free(void *ptr);
|
||||||
extern gptr my_memdup(const unsigned char *from, size_t length,myf MyFlags);
|
extern gptr ma_memdup(const unsigned char *from, size_t length,myf MyFlags);
|
||||||
extern my_string my_strdup(const char *from,myf MyFlags);
|
extern my_string ma_strdup(const char *from,myf MyFlags);
|
||||||
extern my_string my_strndup(const char *from, size_t length, myf MyFlags);
|
extern my_string ma_strndup(const char *from, size_t length, myf MyFlags);
|
||||||
#define my_free(PTR) my_no_flags_free(PTR)
|
#define ma_free(PTR) my_no_flags_free(PTR)
|
||||||
#define CALLER_INFO_PROTO /* nothing */
|
#define CALLER_INFO_PROTO /* nothing */
|
||||||
#define CALLER_INFO /* nothing */
|
#define CALLER_INFO /* nothing */
|
||||||
#define ORIG_CALLER_INFO /* nothing */
|
#define ORIG_CALLER_INFO /* nothing */
|
||||||
@@ -143,8 +143,8 @@ extern my_string my_strndup(const char *from, size_t length, myf MyFlags);
|
|||||||
#define my_alloca(SZ) alloca((size_t) (SZ))
|
#define my_alloca(SZ) alloca((size_t) (SZ))
|
||||||
#define my_afree(PTR) {}
|
#define my_afree(PTR) {}
|
||||||
#else
|
#else
|
||||||
#define my_alloca(SZ) my_malloc(SZ,MYF(0))
|
#define my_alloca(SZ) ma_malloc(SZ,MYF(0))
|
||||||
#define my_afree(PTR) my_free(PTR)
|
#define my_afree(PTR) ma_free(PTR)
|
||||||
#endif /* HAVE_ALLOCA */
|
#endif /* HAVE_ALLOCA */
|
||||||
|
|
||||||
#ifdef MSDOS
|
#ifdef MSDOS
|
||||||
@@ -172,11 +172,11 @@ extern int errno; /* declare errno */
|
|||||||
#endif
|
#endif
|
||||||
extern const char ** NEAR my_errmsg[];
|
extern const char ** NEAR my_errmsg[];
|
||||||
extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
|
extern char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
|
||||||
extern char *home_dir; /* Home directory for user */
|
extern char *ma_ma_ma_home_dir; /* Home directory for user */
|
||||||
extern char *my_progname; /* program-name (printed in errors) */
|
extern char *ma_progname; /* program-name (printed in errors) */
|
||||||
extern char NEAR curr_dir[]; /* Current directory for user */
|
extern char NEAR ma_cur_dir[]; /* Current directory for user */
|
||||||
extern int (*error_handler_hook)(uint my_err, const char *str,myf MyFlags);
|
extern int (*ma_error_handler_hook)(uint my_err, const char *str,myf MyFlags);
|
||||||
extern int (*fatal_error_handler_hook)(uint my_err, const char *str,
|
extern int (*fatal_ma_error_handler_hook)(uint my_err, const char *str,
|
||||||
myf MyFlags);
|
myf MyFlags);
|
||||||
|
|
||||||
/* charsets */
|
/* charsets */
|
||||||
@@ -188,7 +188,7 @@ extern CHARSET_INFO *get_charset_by_name(const char *cs_name);
|
|||||||
extern CHARSET_INFO *get_charset_by_nr(uint cs_number);
|
extern CHARSET_INFO *get_charset_by_nr(uint cs_number);
|
||||||
extern my_bool set_default_charset_by_name(const char *cs_name, myf flags);
|
extern my_bool set_default_charset_by_name(const char *cs_name, myf flags);
|
||||||
extern void free_charsets(void);
|
extern void free_charsets(void);
|
||||||
extern char *list_charsets(myf want_flags); /* my_free() this string... */
|
extern char *list_charsets(myf want_flags); /* ma_free() this string... */
|
||||||
extern char *get_charsets_dir(char *buf);
|
extern char *get_charsets_dir(char *buf);
|
||||||
|
|
||||||
|
|
||||||
@@ -196,26 +196,26 @@ extern char *get_charsets_dir(char *buf);
|
|||||||
extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests,
|
extern ulong _my_cache_w_requests,_my_cache_write,_my_cache_r_requests,
|
||||||
_my_cache_read;
|
_my_cache_read;
|
||||||
extern ulong _my_blocks_used,_my_blocks_changed;
|
extern ulong _my_blocks_used,_my_blocks_changed;
|
||||||
extern ulong my_file_opened,my_stream_opened, my_tmp_file_created;
|
extern ulong ma_file_opened,ma_stream_opened, ma_tmp_file_created;
|
||||||
extern my_bool key_cache_inited;
|
extern my_bool key_cache_inited;
|
||||||
|
|
||||||
/* Point to current my_message() */
|
/* Point to current ma_message() */
|
||||||
extern void (*my_sigtstp_cleanup)(void),
|
extern void (*my_sigtstp_cleanup)(void),
|
||||||
/* Executed before jump to shell */
|
/* Executed before jump to shell */
|
||||||
(*my_sigtstp_restart)(void),
|
(*my_sigtstp_restart)(void),
|
||||||
(*my_abort_hook)(int);
|
(*my_abort_hook)(int);
|
||||||
/* Executed when comming from shell */
|
/* Executed when comming from shell */
|
||||||
extern int NEAR my_umask, /* Default creation mask */
|
extern int NEAR ma_umask, /* Default creation mask */
|
||||||
NEAR my_umask_dir,
|
NEAR ma_umask_dir,
|
||||||
NEAR my_recived_signals, /* Signals we have got */
|
NEAR my_recived_signals, /* Signals we have got */
|
||||||
NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
|
NEAR my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */
|
||||||
NEAR my_dont_interrupt; /* call remember_intr when set */
|
NEAR ma_dont_interrupt; /* call remember_intr when set */
|
||||||
extern my_bool NEAR mysys_uses_curses, my_use_symdir;
|
extern my_bool NEAR mysys_uses_curses, ma_use_symdir;
|
||||||
extern size_t lCurMemory,lMaxMemory; /* from safemalloc */
|
extern size_t lCurMemory,lMaxMemory; /* from safemalloc */
|
||||||
|
|
||||||
extern ulong my_default_record_cache_size;
|
extern ulong ma_default_record_cache_size;
|
||||||
extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
|
extern my_bool NEAR ma_disable_locking,NEAR ma_disable_async_io,
|
||||||
NEAR my_disable_flush_key_blocks, NEAR my_disable_symlinks;
|
NEAR ma_disable_flush_key_blocks, NEAR ma_disable_symlinks;
|
||||||
extern char wild_many,wild_one,wild_prefix;
|
extern char wild_many,wild_one,wild_prefix;
|
||||||
extern const char *charsets_dir;
|
extern const char *charsets_dir;
|
||||||
extern char *defaults_extra_file;
|
extern char *defaults_extra_file;
|
||||||
@@ -259,14 +259,14 @@ typedef struct st_record_cache /* Used when cacheing records */
|
|||||||
enum file_type { UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE,
|
enum file_type { UNOPEN = 0, FILE_BY_OPEN, FILE_BY_CREATE,
|
||||||
STREAM_BY_FOPEN, STREAM_BY_FDOPEN, FILE_BY_MKSTEMP };
|
STREAM_BY_FOPEN, STREAM_BY_FDOPEN, FILE_BY_MKSTEMP };
|
||||||
|
|
||||||
extern struct my_file_info
|
extern struct ma_file_info
|
||||||
{
|
{
|
||||||
my_string name;
|
my_string name;
|
||||||
enum file_type type;
|
enum file_type type;
|
||||||
#if defined(THREAD) && !defined(HAVE_PREAD)
|
#if defined(THREAD) && !defined(HAVE_PREAD)
|
||||||
pthread_mutex_t mutex;
|
pthread_mutex_t mutex;
|
||||||
#endif
|
#endif
|
||||||
} my_file_info[MY_NFILE];
|
} ma_file_info[MY_NFILE];
|
||||||
|
|
||||||
|
|
||||||
typedef struct st_dynamic_array {
|
typedef struct st_dynamic_array {
|
||||||
@@ -352,7 +352,7 @@ typedef struct st_changeable_var {
|
|||||||
} CHANGEABLE_VAR;
|
} CHANGEABLE_VAR;
|
||||||
|
|
||||||
|
|
||||||
/* structs for alloc_root */
|
/* structs for ma_alloc_root */
|
||||||
|
|
||||||
#ifndef ST_USED_MEM_DEFINED
|
#ifndef ST_USED_MEM_DEFINED
|
||||||
#define ST_USED_MEM_DEFINED
|
#define ST_USED_MEM_DEFINED
|
||||||
@@ -423,30 +423,30 @@ extern gptr _myrealloc(gptr pPtr,size_t uSize,const char *sFile,
|
|||||||
extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...));
|
extern gptr my_multi_malloc _VARARGS((myf MyFlags, ...));
|
||||||
extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag);
|
extern void _myfree(gptr pPtr,const char *sFile,uint uLine, myf MyFlag);
|
||||||
extern int _sanity(const char *sFile,unsigned int uLine);
|
extern int _sanity(const char *sFile,unsigned int uLine);
|
||||||
extern gptr _my_memdup(const unsigned char *from, size_t length,
|
extern gptr _ma_memdup(const unsigned char *from, size_t length,
|
||||||
const char *sFile, uint uLine,myf MyFlag);
|
const char *sFile, uint uLine,myf MyFlag);
|
||||||
extern my_string _my_strdup(const char *from, const char *sFile, uint uLine,
|
extern my_string _ma_strdup(const char *from, const char *sFile, uint uLine,
|
||||||
myf MyFlag);
|
myf MyFlag);
|
||||||
#ifndef TERMINATE
|
#ifndef TERMINATE
|
||||||
extern void TERMINATE(FILE *file);
|
extern void TERMINATE(FILE *file);
|
||||||
#endif
|
#endif
|
||||||
extern void init_glob_errs(void);
|
extern void ma_init_glob_errs(void);
|
||||||
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
|
extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
|
||||||
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
|
extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
|
||||||
extern int my_fclose(FILE *fd,myf MyFlags);
|
extern int my_fclose(FILE *fd,myf MyFlags);
|
||||||
extern int my_chsize(File fd,my_off_t newlength,myf MyFlags);
|
extern int my_chsize(File fd,my_off_t newlength,myf MyFlags);
|
||||||
extern int my_error _VARARGS((int nr,myf MyFlags, ...));
|
extern int ma_error _VARARGS((int nr,myf MyFlags, ...));
|
||||||
extern int my_printf_error _VARARGS((uint my_err, const char *format,
|
extern int ma_printf_error _VARARGS((uint my_err, const char *format,
|
||||||
myf MyFlags, ...)
|
myf MyFlags, ...)
|
||||||
__attribute__ ((format (printf, 2, 4))));
|
__attribute__ ((format (printf, 2, 4))));
|
||||||
extern int my_vsnprintf( char *str, size_t n,
|
extern int ma_vsnprintf( char *str, size_t n,
|
||||||
const char *format, va_list ap );
|
const char *format, va_list ap );
|
||||||
extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
|
extern int ma_snprintf(char* to, size_t n, const char* fmt, ...);
|
||||||
extern int my_message(uint my_err, const char *str,myf MyFlags);
|
extern int ma_message(uint my_err, const char *str,myf MyFlags);
|
||||||
extern int my_message_no_curses(uint my_err, const char *str,myf MyFlags);
|
extern int ma_message_no_curses(uint my_err, const char *str,myf MyFlags);
|
||||||
extern int my_message_curses(uint my_err, const char *str,myf MyFlags);
|
extern int ma_message_curses(uint my_err, const char *str,myf MyFlags);
|
||||||
extern void my_init(void);
|
extern void ma_init(void);
|
||||||
extern void my_end(int infoflag);
|
extern void ma_end(int infoflag);
|
||||||
extern int my_redel(const char *from, const char *to, int MyFlags);
|
extern int my_redel(const char *from, const char *to, int MyFlags);
|
||||||
extern int my_copystat(const char *from, const char *to, int MyFlags);
|
extern int my_copystat(const char *from, const char *to, int MyFlags);
|
||||||
extern my_string my_filename(File fd);
|
extern my_string my_filename(File fd);
|
||||||
@@ -476,12 +476,12 @@ extern my_string fn_same(my_string toname,const char *name,int flag);
|
|||||||
extern my_string fn_format(my_string to,const char *name,const char *dsk,
|
extern my_string fn_format(my_string to,const char *name,const char *dsk,
|
||||||
const char *form,int flag);
|
const char *form,int flag);
|
||||||
extern size_s strlength(const char *str);
|
extern size_s strlength(const char *str);
|
||||||
extern void pack_dirname(my_string to,const char *from);
|
extern void ma_pack_dirname(my_string to,const char *from);
|
||||||
extern uint unpack_dirname(my_string to,const char *from);
|
extern uint unma_pack_dirname(my_string to,const char *from);
|
||||||
extern uint cleanup_dirname(my_string to,const char *from);
|
extern uint ma_cleanup_dirname(my_string to,const char *from);
|
||||||
extern uint system_filename(my_string to,const char *from);
|
extern uint ma_system_filename(my_string to,const char *from);
|
||||||
extern my_string unpack_filename(my_string to,const char *from);
|
extern my_string ma_unpack_filename(my_string to,const char *from);
|
||||||
extern my_string intern_filename(my_string to,const char *from);
|
extern my_string ma_intern_filename(my_string to,const char *from);
|
||||||
extern my_string directory_file_name(my_string dst, const char *src);
|
extern my_string directory_file_name(my_string dst, const char *src);
|
||||||
extern int pack_filename(my_string to, const char *name, size_s max_length);
|
extern int pack_filename(my_string to, const char *name, size_s max_length);
|
||||||
extern my_string my_path(my_string to,const char *progname,
|
extern my_string my_path(my_string to,const char *progname,
|
||||||
@@ -553,25 +553,25 @@ extern my_bool real_open_cached_file(IO_CACHE *cache);
|
|||||||
extern void close_cached_file(IO_CACHE *cache);
|
extern void close_cached_file(IO_CACHE *cache);
|
||||||
File create_temp_file(char *to, const char *dir, const char *pfx,
|
File create_temp_file(char *to, const char *dir, const char *pfx,
|
||||||
int mode, myf MyFlags);
|
int mode, myf MyFlags);
|
||||||
#define my_init_dynamic_array(A,B,C,D) init_dynamic_array(A,B,C,D CALLER_INFO)
|
#define ma_init_dynamic_array(A,B,C,D) init_dynamic_array(A,B,C,D CALLER_INFO)
|
||||||
#define my_init_dynamic_array_ci(A,B,C,D) init_dynamic_array(A,B,C,D ORIG_CALLER_INFO)
|
#define ma_init_dynamic_array_ci(A,B,C,D) init_dynamic_array(A,B,C,D ORIG_CALLER_INFO)
|
||||||
extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
|
extern my_bool init_dynamic_array(DYNAMIC_ARRAY *array,uint element_size,
|
||||||
uint init_alloc,uint alloc_increment CALLER_INFO_PROTO);
|
uint init_alloc,uint alloc_increment CALLER_INFO_PROTO);
|
||||||
extern my_bool insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
|
extern my_bool ma_insert_dynamic(DYNAMIC_ARRAY *array,gptr element);
|
||||||
extern unsigned char *alloc_dynamic(DYNAMIC_ARRAY *array);
|
extern unsigned char *ma_alloc_dynamic(DYNAMIC_ARRAY *array);
|
||||||
extern unsigned char *pop_dynamic(DYNAMIC_ARRAY*);
|
extern unsigned char *ma_pop_dynamic(DYNAMIC_ARRAY*);
|
||||||
extern my_bool set_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
|
extern my_bool ma_set_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
|
||||||
extern void get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
|
extern void ma_get_dynamic(DYNAMIC_ARRAY *array,gptr element,uint array_index);
|
||||||
extern void delete_dynamic(DYNAMIC_ARRAY *array);
|
extern void ma_delete_dynamic(DYNAMIC_ARRAY *array);
|
||||||
extern void delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
|
extern void ma_delete_dynamic_element(DYNAMIC_ARRAY *array, uint array_index);
|
||||||
extern void freeze_size(DYNAMIC_ARRAY *array);
|
extern void ma_freeze_size(DYNAMIC_ARRAY *array);
|
||||||
#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
|
#define dynamic_array_ptr(array,array_index) ((array)->buffer+(array_index)*(array)->size_of_element)
|
||||||
#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
|
#define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index))
|
||||||
#define push_dynamic(A,B) insert_dynamic(A,B)
|
#define push_dynamic(A,B) ma_insert_dynamic(A,B)
|
||||||
|
|
||||||
extern int find_type(my_string x,TYPELIB *typelib,uint full_name);
|
extern int ma_find_type(my_string x,TYPELIB *typelib,uint full_name);
|
||||||
extern void make_type(my_string to,uint nr,TYPELIB *typelib);
|
extern void ma_make_type(my_string to,uint nr,TYPELIB *typelib);
|
||||||
extern const char *get_type(TYPELIB *typelib,uint nr);
|
extern const char *ma_get_type(TYPELIB *typelib,uint nr);
|
||||||
extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
|
extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
|
||||||
size_t init_alloc, size_t alloc_increment);
|
size_t init_alloc, size_t alloc_increment);
|
||||||
extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
|
extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append);
|
||||||
@@ -585,22 +585,22 @@ my_bool set_changeable_var(my_string str,CHANGEABLE_VAR *vars);
|
|||||||
my_bool set_changeable_varval(const char *var, ulong val,
|
my_bool set_changeable_varval(const char *var, ulong val,
|
||||||
CHANGEABLE_VAR *vars);
|
CHANGEABLE_VAR *vars);
|
||||||
#ifdef HAVE_MLOCK
|
#ifdef HAVE_MLOCK
|
||||||
extern unsigned char *my_malloc_lock(size_t length,myf flags);
|
extern unsigned char *ma_malloc_lock(size_t length,myf flags);
|
||||||
extern void my_free_lock(unsigned char *ptr,myf flags);
|
extern void ma_free_lock(unsigned char *ptr,myf flags);
|
||||||
#else
|
#else
|
||||||
#define my_malloc_lock(A,B) my_malloc((A),(B))
|
#define ma_malloc_lock(A,B) ma_malloc((A),(B))
|
||||||
#define my_free_lock(A,B) my_free((A),(B))
|
#define ma_free_lock(A,B) ma_free((A),(B))
|
||||||
#endif
|
#endif
|
||||||
#define alloc_root_inited(A) ((A)->min_malloc != 0)
|
#define ma_alloc_root_inited(A) ((A)->min_malloc != 0)
|
||||||
void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size);
|
void ma_init_ma_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size);
|
||||||
gptr alloc_root(MEM_ROOT *mem_root, size_t Size);
|
gptr ma_alloc_root(MEM_ROOT *mem_root, size_t Size);
|
||||||
void free_root(MEM_ROOT *root, myf MyFLAGS);
|
void ma_free_root(MEM_ROOT *root, myf MyFLAGS);
|
||||||
char *strdup_root(MEM_ROOT *root,const char *str);
|
char *ma_strdup_root(MEM_ROOT *root,const char *str);
|
||||||
char *memdup_root(MEM_ROOT *root,const char *str, size_t len);
|
char *ma_memdup_root(MEM_ROOT *root,const char *str, size_t len);
|
||||||
void load_defaults(const char *conf_file, const char **groups,
|
void mariadb_load_defaults(const char *conf_file, const char **groups,
|
||||||
int *argc, char ***argv);
|
int *argc, char ***argv);
|
||||||
void free_defaults(char **argv);
|
void ma_free_defaults(char **argv);
|
||||||
void print_defaults(const char *conf_file, const char **groups);
|
void ma_print_defaults(const char *conf_file, const char **groups);
|
||||||
my_bool my_compress(unsigned char *, size_t *, size_t *);
|
my_bool my_compress(unsigned char *, size_t *, size_t *);
|
||||||
my_bool my_uncompress(unsigned char *, size_t *, size_t *);
|
my_bool my_uncompress(unsigned char *, size_t *, size_t *);
|
||||||
unsigned char *my_compress_alloc(const unsigned char *packet, size_t *len, size_t *complen);
|
unsigned char *my_compress_alloc(const unsigned char *packet, size_t *len, size_t *complen);
|
||||||
|
@@ -408,10 +408,10 @@ void hash_password(unsigned long *result, const char *password, size_t len);
|
|||||||
|
|
||||||
/* Some other useful functions */
|
/* Some other useful functions */
|
||||||
|
|
||||||
void load_defaults(const char *conf_file, const char **groups,
|
void mariadb_load_defaults(const char *conf_file, const char **groups,
|
||||||
int *argc, char ***argv);
|
int *argc, char ***argv);
|
||||||
my_bool my_thread_init(void);
|
my_bool ma_thread_init(void);
|
||||||
void my_thread_end(void);
|
void ma_thread_end(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@@ -23,9 +23,9 @@ extern "C" {
|
|||||||
|
|
||||||
#define GLOB 0 /* Error maps */
|
#define GLOB 0 /* Error maps */
|
||||||
#define GLOBERRS EE_LASTERROR - EE_FIRSTERROR + 1 /* Max number of error messages in map's */
|
#define GLOBERRS EE_LASTERROR - EE_FIRSTERROR + 1 /* Max number of error messages in map's */
|
||||||
#define EE(X) globerrs[ (X) - EE_FIRSTERROR ] /* Defines to add error to right map */
|
#define EE(X) ma_globerrs[ (X) - EE_FIRSTERROR ] /* Defines to add error to right map */
|
||||||
|
|
||||||
extern const char * NEAR globerrs[]; /* my_error_messages is here */
|
extern const char * NEAR ma_globerrs[]; /* ma_error_messages is here */
|
||||||
|
|
||||||
/* Error message numbers in global map
|
/* Error message numbers in global map
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
|
|||||||
array->max_element=init_alloc;
|
array->max_element=init_alloc;
|
||||||
array->alloc_increment=alloc_increment;
|
array->alloc_increment=alloc_increment;
|
||||||
array->size_of_element=element_size;
|
array->size_of_element=element_size;
|
||||||
if (!(array->buffer=(char*) my_malloc_ci(element_size*init_alloc,MYF(MY_WME))))
|
if (!(array->buffer=(char*) ma_malloc_ci(element_size*init_alloc,MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
array->max_element=0;
|
array->max_element=0;
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
@@ -53,12 +53,12 @@ my_bool init_dynamic_array(DYNAMIC_ARRAY *array, uint element_size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my_bool insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
|
my_bool ma_insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
|
||||||
{
|
{
|
||||||
gptr buffer;
|
gptr buffer;
|
||||||
if (array->elements == array->max_element)
|
if (array->elements == array->max_element)
|
||||||
{ /* Call only when nessesary */
|
{ /* Call only when nessesary */
|
||||||
if (!(buffer=alloc_dynamic(array)))
|
if (!(buffer=ma_alloc_dynamic(array)))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -73,12 +73,12 @@ my_bool insert_dynamic(DYNAMIC_ARRAY *array, gptr element)
|
|||||||
|
|
||||||
/* Alloc room for one element */
|
/* Alloc room for one element */
|
||||||
|
|
||||||
unsigned char *alloc_dynamic(DYNAMIC_ARRAY *array)
|
unsigned char *ma_alloc_dynamic(DYNAMIC_ARRAY *array)
|
||||||
{
|
{
|
||||||
if (array->elements == array->max_element)
|
if (array->elements == array->max_element)
|
||||||
{
|
{
|
||||||
char *new_ptr;
|
char *new_ptr;
|
||||||
if (!(new_ptr=(char*) my_realloc(array->buffer,(array->max_element+
|
if (!(new_ptr=(char*) ma_realloc(array->buffer,(array->max_element+
|
||||||
array->alloc_increment)*
|
array->alloc_increment)*
|
||||||
array->size_of_element,
|
array->size_of_element,
|
||||||
MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
|
MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
|
||||||
@@ -92,7 +92,7 @@ unsigned char *alloc_dynamic(DYNAMIC_ARRAY *array)
|
|||||||
|
|
||||||
/* remove last element from array and return it */
|
/* remove last element from array and return it */
|
||||||
|
|
||||||
unsigned char *pop_dynamic(DYNAMIC_ARRAY *array)
|
unsigned char *ma_pop_dynamic(DYNAMIC_ARRAY *array)
|
||||||
{
|
{
|
||||||
if (array->elements)
|
if (array->elements)
|
||||||
return array->buffer+(--array->elements * array->size_of_element);
|
return array->buffer+(--array->elements * array->size_of_element);
|
||||||
@@ -100,7 +100,7 @@ unsigned char *pop_dynamic(DYNAMIC_ARRAY *array)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
|
my_bool ma_set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
|
||||||
{
|
{
|
||||||
if (idx >= array->elements)
|
if (idx >= array->elements)
|
||||||
{
|
{
|
||||||
@@ -110,7 +110,7 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
|
|||||||
char *new_ptr;
|
char *new_ptr;
|
||||||
size=(idx+array->alloc_increment)/array->alloc_increment;
|
size=(idx+array->alloc_increment)/array->alloc_increment;
|
||||||
size*= array->alloc_increment;
|
size*= array->alloc_increment;
|
||||||
if (!(new_ptr=(char*) my_realloc(array->buffer,size*
|
if (!(new_ptr=(char*) ma_realloc(array->buffer,size*
|
||||||
array->size_of_element,
|
array->size_of_element,
|
||||||
MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
|
MYF(MY_WME | MY_ALLOW_ZERO_PTR))))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -127,7 +127,7 @@ my_bool set_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void get_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
|
void ma_get_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
|
||||||
{
|
{
|
||||||
if (idx >= array->elements)
|
if (idx >= array->elements)
|
||||||
{
|
{
|
||||||
@@ -141,18 +141,18 @@ void get_dynamic(DYNAMIC_ARRAY *array, gptr element, uint idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void delete_dynamic(DYNAMIC_ARRAY *array)
|
void ma_delete_dynamic(DYNAMIC_ARRAY *array)
|
||||||
{
|
{
|
||||||
if (array->buffer)
|
if (array->buffer)
|
||||||
{
|
{
|
||||||
my_free(array->buffer);
|
ma_free(array->buffer);
|
||||||
array->buffer=0;
|
array->buffer=0;
|
||||||
array->elements=array->max_element=0;
|
array->elements=array->max_element=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
|
void ma_delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
|
||||||
{
|
{
|
||||||
char *ptr=array->buffer+array->size_of_element*idx;
|
char *ptr=array->buffer+array->size_of_element*idx;
|
||||||
array->elements--;
|
array->elements--;
|
||||||
@@ -161,13 +161,13 @@ void delete_dynamic_element(DYNAMIC_ARRAY *array, uint idx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void freeze_size(DYNAMIC_ARRAY *array)
|
void ma_freeze_size(DYNAMIC_ARRAY *array)
|
||||||
{
|
{
|
||||||
uint elements=max(array->elements,1);
|
uint elements=max(array->elements,1);
|
||||||
|
|
||||||
if (array->buffer && array->max_element != elements)
|
if (array->buffer && array->max_element != elements)
|
||||||
{
|
{
|
||||||
array->buffer=(char*) my_realloc(array->buffer,
|
array->buffer=(char*) ma_realloc(array->buffer,
|
||||||
elements*array->size_of_element,
|
elements*array->size_of_element,
|
||||||
MYF(MY_WME));
|
MYF(MY_WME));
|
||||||
array->max_element=elements;
|
array->max_element=elements;
|
||||||
|
@@ -21,11 +21,11 @@
|
|||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
#include <my_dir.h>
|
#include <my_dir.h>
|
||||||
|
|
||||||
CHARSET_INFO *default_charset_info = (CHARSET_INFO *)&compiled_charsets[5];
|
CHARSET_INFO *ma_default_charset_info = (CHARSET_INFO *)&compiled_charsets[5];
|
||||||
CHARSET_INFO *my_charset_bin= (CHARSET_INFO *)&compiled_charsets[32];
|
CHARSET_INFO *ma_charset_bin= (CHARSET_INFO *)&compiled_charsets[32];
|
||||||
CHARSET_INFO *my_charset_latin1= (CHARSET_INFO *)&compiled_charsets[5];
|
CHARSET_INFO *ma_charset_latin1= (CHARSET_INFO *)&compiled_charsets[5];
|
||||||
CHARSET_INFO *my_charset_utf8_general_ci= (CHARSET_INFO *)&compiled_charsets[21];
|
CHARSET_INFO *ma_charset_utf8_general_ci= (CHARSET_INFO *)&compiled_charsets[21];
|
||||||
CHARSET_INFO *my_charset_utf16le_general_ci= (CHARSET_INFO *)&compiled_charsets[68];
|
CHARSET_INFO *ma_charset_utf16le_general_ci= (CHARSET_INFO *)&compiled_charsets[68];
|
||||||
|
|
||||||
CHARSET_INFO * STDCALL mysql_get_charset_by_nr(uint cs_number)
|
CHARSET_INFO * STDCALL mysql_get_charset_by_nr(uint cs_number)
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ my_bool set_default_charset(uint cs, myf flags)
|
|||||||
DBUG_PRINT("error",("Couldn't set default character set"));
|
DBUG_PRINT("error",("Couldn't set default character set"));
|
||||||
DBUG_RETURN(TRUE); /* error */
|
DBUG_RETURN(TRUE); /* error */
|
||||||
}
|
}
|
||||||
default_charset_info = new_charset;
|
ma_default_charset_info = new_charset;
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +74,6 @@ my_bool set_default_charset_by_name(const char *cs_name, myf flags)
|
|||||||
DBUG_RETURN(TRUE); /* error */
|
DBUG_RETURN(TRUE); /* error */
|
||||||
}
|
}
|
||||||
|
|
||||||
default_charset_info = new_charset;
|
ma_default_charset_info = new_charset;
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
|
@@ -197,7 +197,7 @@ add_plugin(MYSQL *mysql, struct st_mysql_client_plugin *plugin, void *dlhandle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
p= (struct st_client_plugin_int *)
|
p= (struct st_client_plugin_int *)
|
||||||
memdup_root(&mem_root, (char *)&plugin_int, sizeof(plugin_int));
|
ma_memdup_root(&mem_root, (char *)&plugin_int, sizeof(plugin_int));
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
{
|
||||||
@@ -250,7 +250,7 @@ static void load_env_plugins(MYSQL *mysql)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
free_env= plugs= my_strdup(s, MYF(MY_WME));
|
free_env= plugs= ma_strdup(s, MYF(MY_WME));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if ((s= strchr(plugs, ';')))
|
if ((s= strchr(plugs, ';')))
|
||||||
@@ -259,7 +259,7 @@ static void load_env_plugins(MYSQL *mysql)
|
|||||||
plugs= s + 1;
|
plugs= s + 1;
|
||||||
} while (s);
|
} while (s);
|
||||||
|
|
||||||
my_free(free_env);
|
ma_free(free_env);
|
||||||
}
|
}
|
||||||
|
|
||||||
/********** extern functions to be used by libmariadb *********************/
|
/********** extern functions to be used by libmariadb *********************/
|
||||||
@@ -286,7 +286,7 @@ int mysql_client_plugin_init()
|
|||||||
bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
|
bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
|
||||||
|
|
||||||
pthread_mutex_init(&LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
|
pthread_mutex_init(&LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
|
||||||
init_alloc_root(&mem_root, 128, 128);
|
ma_init_ma_alloc_root(&mem_root, 128, 128);
|
||||||
|
|
||||||
bzero(&plugin_list, sizeof(plugin_list));
|
bzero(&plugin_list, sizeof(plugin_list));
|
||||||
|
|
||||||
@@ -329,7 +329,7 @@ void mysql_client_plugin_deinit()
|
|||||||
|
|
||||||
bzero(&plugin_list, sizeof(plugin_list));
|
bzero(&plugin_list, sizeof(plugin_list));
|
||||||
initialized= 0;
|
initialized= 0;
|
||||||
free_root(&mem_root, MYF(0));
|
ma_free_root(&mem_root, MYF(0));
|
||||||
pthread_mutex_destroy(&LOCK_load_client_plugin);
|
pthread_mutex_destroy(&LOCK_load_client_plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -101,7 +101,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
|
extern int ma_snprintf(char* to, size_t n, const char* fmt, ...);
|
||||||
|
|
||||||
char _dig_vec_upper[] =
|
char _dig_vec_upper[] =
|
||||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
@@ -283,7 +283,7 @@ typedef struct _db_code_state_ {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
The test below is so we could call functions with DBUG_ENTER before
|
The test below is so we could call functions with DBUG_ENTER before
|
||||||
my_thread_init().
|
ma_thread_init().
|
||||||
*/
|
*/
|
||||||
#define get_code_state_if_not_set_or_return if (!cs && !((cs=code_state()))) return
|
#define get_code_state_if_not_set_or_return if (!cs && !((cs=code_state()))) return
|
||||||
#define get_code_state_or_return if (!((cs=code_state()))) return
|
#define get_code_state_or_return if (!((cs=code_state()))) return
|
||||||
@@ -1290,7 +1290,7 @@ void _db_return_(uint _line_, struct _db_stack_frame_ *_stack_frame_)
|
|||||||
if (cs->framep != _stack_frame_)
|
if (cs->framep != _stack_frame_)
|
||||||
{
|
{
|
||||||
char buf[512];
|
char buf[512];
|
||||||
my_snprintf(buf, sizeof(buf), ERR_MISSING_RETURN, cs->func);
|
ma_snprintf(buf, sizeof(buf), ERR_MISSING_RETURN, cs->func);
|
||||||
DbugExit(buf);
|
DbugExit(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1957,7 +1957,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_)
|
|||||||
cs->lineno++;
|
cs->lineno++;
|
||||||
if (cs->stack->flags & PID_ON)
|
if (cs->stack->flags & PID_ON)
|
||||||
{
|
{
|
||||||
(void) fprintf(cs->stack->out_file, "%-7s: ", my_thread_name());
|
(void) fprintf(cs->stack->out_file, "%-7s: ", ma_thread_name());
|
||||||
}
|
}
|
||||||
if (cs->stack->flags & NUMBER_ON)
|
if (cs->stack->flags & NUMBER_ON)
|
||||||
(void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno);
|
(void) fprintf(cs->stack->out_file, "%5d: ", cs->lineno);
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
** On Windows defaults will also search in the Windows directory for a file
|
** On Windows defaults will also search in the Windows directory for a file
|
||||||
** called 'group'.ini
|
** called 'group'.ini
|
||||||
** As long as the program uses the last argument for conflicting
|
** As long as the program uses the last argument for conflicting
|
||||||
** options one only have to add a call to "load_defaults" to enable
|
** options one only have to add a call to "mariadb_load_defaults" to enable
|
||||||
** use of default values.
|
** use of default values.
|
||||||
** pre- and end 'blank space' are removed from options and values. The
|
** pre- and end 'blank space' are removed from options and values. The
|
||||||
** following escape sequences are recognized in values: \b \t \n \r \\
|
** following escape sequences are recognized in values: \b \t \n \r \\
|
||||||
@@ -75,24 +75,24 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args,MEM_ROOT *alloc,
|
|||||||
const char *ext, TYPELIB *group);
|
const char *ext, TYPELIB *group);
|
||||||
|
|
||||||
|
|
||||||
void load_defaults(const char *conf_file, const char **groups,
|
void mariadb_load_defaults(const char *conf_file, const char **groups,
|
||||||
int *argc, char ***argv)
|
int *argc, char ***argv)
|
||||||
{
|
{
|
||||||
DYNAMIC_ARRAY args;
|
DYNAMIC_ARRAY args;
|
||||||
const char **dirs, *forced_default_file;
|
const char **dirs, *forced_default_file;
|
||||||
TYPELIB group;
|
TYPELIB group;
|
||||||
my_bool found_print_defaults=0;
|
my_bool found_ma_print_defaults=0;
|
||||||
uint args_used=0;
|
uint args_used=0;
|
||||||
MEM_ROOT alloc;
|
MEM_ROOT alloc;
|
||||||
char *ptr,**res;
|
char *ptr,**res;
|
||||||
DBUG_ENTER("load_defaults");
|
DBUG_ENTER("mariadb_load_defaults");
|
||||||
|
|
||||||
init_alloc_root(&alloc,128,0);
|
ma_init_ma_alloc_root(&alloc,128,0);
|
||||||
if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults"))
|
if (*argc >= 2 && !strcmp(argv[0][1],"--no-defaults"))
|
||||||
{
|
{
|
||||||
/* remove the --no-defaults argument and return only the other arguments */
|
/* remove the --no-defaults argument and return only the other arguments */
|
||||||
uint i;
|
uint i;
|
||||||
if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
|
if (!(ptr=(char*) ma_alloc_root(&alloc,sizeof(alloc)+
|
||||||
(*argc + 1)*sizeof(char*))))
|
(*argc + 1)*sizeof(char*))))
|
||||||
goto err;
|
goto err;
|
||||||
res= (char**) (ptr+sizeof(alloc));
|
res= (char**) (ptr+sizeof(alloc));
|
||||||
@@ -127,7 +127,7 @@ void load_defaults(const char *conf_file, const char **groups,
|
|||||||
for (; *groups ; groups++)
|
for (; *groups ; groups++)
|
||||||
group.count++;
|
group.count++;
|
||||||
|
|
||||||
if (my_init_dynamic_array(&args, sizeof(char*),*argc, 32))
|
if (ma_init_dynamic_array(&args, sizeof(char*),*argc, 32))
|
||||||
goto err;
|
goto err;
|
||||||
if (forced_default_file)
|
if (forced_default_file)
|
||||||
{
|
{
|
||||||
@@ -169,7 +169,7 @@ void load_defaults(const char *conf_file, const char **groups,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(ptr=(char*) alloc_root(&alloc,sizeof(alloc)+
|
if (!(ptr=(char*) ma_alloc_root(&alloc,sizeof(alloc)+
|
||||||
(args.elements + *argc +1) *sizeof(char*))))
|
(args.elements + *argc +1) *sizeof(char*))))
|
||||||
goto err;
|
goto err;
|
||||||
res= (char**) (ptr+sizeof(alloc));
|
res= (char**) (ptr+sizeof(alloc));
|
||||||
@@ -184,7 +184,7 @@ void load_defaults(const char *conf_file, const char **groups,
|
|||||||
/* Check if we wan't to see the new argument list */
|
/* Check if we wan't to see the new argument list */
|
||||||
if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults"))
|
if (*argc >= 2 && !strcmp(argv[0][1],"--print-defaults"))
|
||||||
{
|
{
|
||||||
found_print_defaults=1;
|
found_ma_print_defaults=1;
|
||||||
--*argc; ++*argv; /* skipp argument */
|
--*argc; ++*argv; /* skipp argument */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,8 +195,8 @@ void load_defaults(const char *conf_file, const char **groups,
|
|||||||
(*argc)+=args.elements;
|
(*argc)+=args.elements;
|
||||||
*argv= (char**) res;
|
*argv= (char**) res;
|
||||||
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
|
*(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */
|
||||||
delete_dynamic(&args);
|
ma_delete_dynamic(&args);
|
||||||
if (found_print_defaults)
|
if (found_ma_print_defaults)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
printf("%s would have been started with the following arguments:\n",
|
printf("%s would have been started with the following arguments:\n",
|
||||||
@@ -214,11 +214,11 @@ void load_defaults(const char *conf_file, const char **groups,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void free_defaults(char **argv)
|
void ma_free_defaults(char **argv)
|
||||||
{
|
{
|
||||||
MEM_ROOT ptr;
|
MEM_ROOT ptr;
|
||||||
memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
|
memcpy_fixed((char*) &ptr,(char *) argv - sizeof(ptr), sizeof(ptr));
|
||||||
free_root(&ptr,MYF(0));
|
ma_free_root(&ptr,MYF(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
}
|
}
|
||||||
for ( ; isspace(end[-1]) ; end--) ; /* Remove end space */
|
for ( ; isspace(end[-1]) ; end--) ; /* Remove end space */
|
||||||
end[0]=0;
|
end[0]=0;
|
||||||
read_values=find_type(ptr,group,3) > 0;
|
read_values=ma_find_type(ptr,group,3) > 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!found_group)
|
if (!found_group)
|
||||||
@@ -311,10 +311,10 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
for ( ; isspace(end[-1]) ; end--) ;
|
for ( ; isspace(end[-1]) ; end--) ;
|
||||||
if (!value)
|
if (!value)
|
||||||
{
|
{
|
||||||
if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3)))
|
if (!(tmp=ma_alloc_root(alloc,(uint) (end-ptr)+3)))
|
||||||
goto err;
|
goto err;
|
||||||
strmake(strmov(tmp,"--"),ptr,(uint) (end-ptr));
|
strmake(strmov(tmp,"--"),ptr,(uint) (end-ptr));
|
||||||
if (insert_dynamic(args,(gptr) &tmp))
|
if (ma_insert_dynamic(args,(gptr) &tmp))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -333,10 +333,10 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
}
|
}
|
||||||
if (value_end < value) /* Empty string */
|
if (value_end < value) /* Empty string */
|
||||||
value_end=value;
|
value_end=value;
|
||||||
if (!(tmp=alloc_root(alloc,(uint) (end-ptr)+3 +
|
if (!(tmp=ma_alloc_root(alloc,(uint) (end-ptr)+3 +
|
||||||
(uint) (value_end-value)+1)))
|
(uint) (value_end-value)+1)))
|
||||||
goto err;
|
goto err;
|
||||||
if (insert_dynamic(args,(gptr) &tmp))
|
if (ma_insert_dynamic(args,(gptr) &tmp))
|
||||||
goto err;
|
goto err;
|
||||||
ptr=strnmov(strmov(tmp,"--"),ptr,(uint) (end-ptr));
|
ptr=strnmov(strmov(tmp,"--"),ptr,(uint) (end-ptr));
|
||||||
*ptr++= '=';
|
*ptr++= '=';
|
||||||
@@ -390,7 +390,7 @@ static my_bool search_default_file(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void print_defaults(const char *conf_file, const char **groups)
|
void ma_print_defaults(const char *conf_file, const char **groups)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
bool have_ext=fn_ext(conf_file)[0] != 0;
|
bool have_ext=fn_ext(conf_file)[0] != 0;
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
#ifndef SHARED_LIBRARY
|
#ifndef SHARED_LIBRARY
|
||||||
|
|
||||||
const char * NEAR globerrs[GLOBERRS]=
|
const char * NEAR ma_globerrs[GLOBERRS]=
|
||||||
{
|
{
|
||||||
"Can't create/write to file '%s' (Errcode: %d)",
|
"Can't create/write to file '%s' (Errcode: %d)",
|
||||||
"Error reading file '%s' (Errcode: %d)",
|
"Error reading file '%s' (Errcode: %d)",
|
||||||
@@ -55,16 +55,16 @@ const char * NEAR globerrs[GLOBERRS]=
|
|||||||
"Can't change mode for file '%s' to 0x%lx (Error: %d)"
|
"Can't change mode for file '%s' to 0x%lx (Error: %d)"
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_glob_errs(void)
|
void ma_init_glob_errs(void)
|
||||||
{
|
{
|
||||||
my_errmsg[GLOB] = & globerrs[0];
|
my_errmsg[GLOB] = & ma_globerrs[0];
|
||||||
} /* init_glob_errs */
|
} /* ma_init_glob_errs */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
void init_glob_errs()
|
void ma_init_glob_errs()
|
||||||
{
|
{
|
||||||
my_errmsg[GLOB] = & globerrs[0];
|
my_errmsg[GLOB] = & ma_globerrs[0];
|
||||||
|
|
||||||
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
|
EE(EE_FILENOTFOUND) = "File '%s' not found (Errcode: %d)";
|
||||||
EE(EE_CANTCREATEFILE) = "Can't create/write to file '%s' (Errcode: %d)";
|
EE(EE_CANTCREATEFILE) = "Can't create/write to file '%s' (Errcode: %d)";
|
||||||
|
@@ -51,7 +51,7 @@ my_bool _hash_init(HASH *hash,uint size,uint key_offset,uint key_length,
|
|||||||
DBUG_PRINT("enter",("hash: %lx size: %d",hash,size));
|
DBUG_PRINT("enter",("hash: %lx size: %d",hash,size));
|
||||||
|
|
||||||
hash->records=0;
|
hash->records=0;
|
||||||
if (my_init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0))
|
if (ma_init_dynamic_array_ci(&hash->array,sizeof(HASH_LINK),size,0))
|
||||||
{
|
{
|
||||||
hash->free=0; /* Allow call to hash_free */
|
hash->free=0; /* Allow call to hash_free */
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
@@ -82,7 +82,7 @@ void hash_free(HASH *hash)
|
|||||||
(*hash->free)(data[i].data);
|
(*hash->free)(data[i].data);
|
||||||
hash->free=0;
|
hash->free=0;
|
||||||
}
|
}
|
||||||
delete_dynamic(&hash->array);
|
ma_delete_dynamic(&hash->array);
|
||||||
hash->records=0;
|
hash->records=0;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@@ -303,7 +303,7 @@ my_bool hash_insert(HASH *info,const uchar *record)
|
|||||||
LINT_INIT(ptr_to_rec); LINT_INIT(ptr_to_rec2);
|
LINT_INIT(ptr_to_rec); LINT_INIT(ptr_to_rec2);
|
||||||
|
|
||||||
flag=0;
|
flag=0;
|
||||||
if (!(empty=(HASH_LINK*) alloc_dynamic(&info->array)))
|
if (!(empty=(HASH_LINK*) ma_alloc_dynamic(&info->array)))
|
||||||
return(TRUE); /* No more memory */
|
return(TRUE); /* No more memory */
|
||||||
|
|
||||||
info->current_record= NO_RECORD;
|
info->current_record= NO_RECORD;
|
||||||
@@ -503,7 +503,7 @@ my_bool hash_delete(HASH *hash,uchar *record)
|
|||||||
pos->next=empty_index;
|
pos->next=empty_index;
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
VOID(pop_dynamic(&hash->array));
|
VOID(ma_pop_dynamic(&hash->array));
|
||||||
if (hash->free)
|
if (hash->free)
|
||||||
(*hash->free)((uchar*) record);
|
(*hash->free)((uchar*) record);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
@@ -83,7 +83,7 @@ extern ulong net_buffer_length; /* net.c */
|
|||||||
|
|
||||||
static my_bool mysql_client_init=0;
|
static my_bool mysql_client_init=0;
|
||||||
static void mysql_close_options(MYSQL *mysql);
|
static void mysql_close_options(MYSQL *mysql);
|
||||||
extern my_bool my_init_done;
|
extern my_bool ma_init_done;
|
||||||
extern my_bool mysql_ps_subsystem_initialized;
|
extern my_bool mysql_ps_subsystem_initialized;
|
||||||
extern my_bool mysql_handle_local_infile(MYSQL *mysql, const char *filename);
|
extern my_bool mysql_handle_local_infile(MYSQL *mysql, const char *filename);
|
||||||
extern const CHARSET_INFO * mysql_find_charset_nr(uint charsetnr);
|
extern const CHARSET_INFO * mysql_find_charset_nr(uint charsetnr);
|
||||||
@@ -350,8 +350,8 @@ void free_rows(MYSQL_DATA *cur)
|
|||||||
{
|
{
|
||||||
if (cur)
|
if (cur)
|
||||||
{
|
{
|
||||||
free_root(&cur->alloc,MYF(0));
|
ma_free_root(&cur->alloc,MYF(0));
|
||||||
my_free(cur);
|
ma_free(cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -446,8 +446,8 @@ static void free_old_query(MYSQL *mysql)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("free_old_query");
|
DBUG_ENTER("free_old_query");
|
||||||
if (mysql->fields)
|
if (mysql->fields)
|
||||||
free_root(&mysql->field_alloc,MYF(0));
|
ma_free_root(&mysql->field_alloc,MYF(0));
|
||||||
init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */
|
ma_init_ma_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */
|
||||||
mysql->fields=0;
|
mysql->fields=0;
|
||||||
mysql->field_count=0; /* For API */
|
mysql->field_count=0; /* For API */
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
@@ -621,10 +621,10 @@ mysql_free_result(MYSQL_RES *result)
|
|||||||
}
|
}
|
||||||
free_rows(result->data);
|
free_rows(result->data);
|
||||||
if (result->fields)
|
if (result->fields)
|
||||||
free_root(&result->field_alloc,MYF(0));
|
ma_free_root(&result->field_alloc,MYF(0));
|
||||||
if (result->row)
|
if (result->row)
|
||||||
my_free(result->row);
|
ma_free(result->row);
|
||||||
my_free(result);
|
ma_free(result);
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@@ -665,13 +665,13 @@ enum option_val
|
|||||||
#define CHECK_OPT_EXTENSION_SET(OPTS)\
|
#define CHECK_OPT_EXTENSION_SET(OPTS)\
|
||||||
if (!(OPTS)->extension) \
|
if (!(OPTS)->extension) \
|
||||||
(OPTS)->extension= (struct st_mysql_options_extension *) \
|
(OPTS)->extension= (struct st_mysql_options_extension *) \
|
||||||
my_malloc(sizeof(struct st_mysql_options_extension), \
|
ma_malloc(sizeof(struct st_mysql_options_extension), \
|
||||||
MYF(MY_WME | MY_ZEROFILL)); \
|
MYF(MY_WME | MY_ZEROFILL)); \
|
||||||
|
|
||||||
#define OPT_SET_EXTENDED_VALUE_STR(OPTS, KEY, VAL) \
|
#define OPT_SET_EXTENDED_VALUE_STR(OPTS, KEY, VAL) \
|
||||||
CHECK_OPT_EXTENSION_SET(OPTS) \
|
CHECK_OPT_EXTENSION_SET(OPTS) \
|
||||||
my_free((gptr)(OPTS)->extension->KEY);\
|
ma_free((gptr)(OPTS)->extension->KEY);\
|
||||||
(OPTS)->extension->KEY= my_strdup((char *)(VAL), MYF(MY_WME))
|
(OPTS)->extension->KEY= ma_strdup((char *)(VAL), MYF(MY_WME))
|
||||||
|
|
||||||
#define OPT_SET_EXTENDED_VALUE_INT(OPTS, KEY, VAL) \
|
#define OPT_SET_EXTENDED_VALUE_INT(OPTS, KEY, VAL) \
|
||||||
CHECK_OPT_EXTENSION_SET(OPTS) \
|
CHECK_OPT_EXTENSION_SET(OPTS) \
|
||||||
@@ -682,23 +682,23 @@ static TYPELIB option_types={array_elements(default_options)-1,
|
|||||||
"options",default_options};
|
"options",default_options};
|
||||||
|
|
||||||
const char *protocol_names[]= {"TCP", "SOCKED", "PIPE", "MEMORY", NULL};
|
const char *protocol_names[]= {"TCP", "SOCKED", "PIPE", "MEMORY", NULL};
|
||||||
static TYPELIB protocol_types= {array_elements(protocol_names)-1,
|
TYPELIB sql_protocol_typelib= {array_elements(protocol_names)-1,
|
||||||
"protocol names",
|
"protocol names",
|
||||||
protocol_names};
|
protocol_names};
|
||||||
|
|
||||||
static void options_add_initcommand(struct st_mysql_options *options,
|
static void options_add_initcommand(struct st_mysql_options *options,
|
||||||
const char *init_cmd)
|
const char *init_cmd)
|
||||||
{
|
{
|
||||||
char *insert= my_strdup(init_cmd, MYF(MY_WME));
|
char *insert= ma_strdup(init_cmd, MYF(MY_WME));
|
||||||
if (!options->init_command)
|
if (!options->init_command)
|
||||||
{
|
{
|
||||||
options->init_command= (DYNAMIC_ARRAY*)my_malloc(sizeof(DYNAMIC_ARRAY),
|
options->init_command= (DYNAMIC_ARRAY*)ma_malloc(sizeof(DYNAMIC_ARRAY),
|
||||||
MYF(MY_WME));
|
MYF(MY_WME));
|
||||||
my_init_dynamic_array(options->init_command, sizeof(char*), 5, 5);
|
ma_init_dynamic_array(options->init_command, sizeof(char*), 5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (insert_dynamic(options->init_command, (gptr)&insert))
|
if (ma_insert_dynamic(options->init_command, (gptr)&insert))
|
||||||
my_free(insert);
|
ma_free(insert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -714,7 +714,7 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
|
argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
|
||||||
groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
|
groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
|
||||||
|
|
||||||
load_defaults(filename, groups, &argc, &argv);
|
mariadb_load_defaults(filename, groups, &argc, &argv);
|
||||||
if (argc != 1) /* If some default option */
|
if (argc != 1) /* If some default option */
|
||||||
{
|
{
|
||||||
char **option=argv;
|
char **option=argv;
|
||||||
@@ -733,7 +733,7 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
/* Change all '_' in variable name to '-' */
|
/* Change all '_' in variable name to '-' */
|
||||||
for (end= *option ; *(end= strcend(end,'_')) ; )
|
for (end= *option ; *(end= strcend(end,'_')) ; )
|
||||||
*end= '-';
|
*end= '-';
|
||||||
switch (find_type(*option+2,&option_types,2)) {
|
switch (ma_find_type(*option+2,&option_types,2)) {
|
||||||
case OPT_port:
|
case OPT_port:
|
||||||
if (opt_arg)
|
if (opt_arg)
|
||||||
options->port=atoi(opt_arg);
|
options->port=atoi(opt_arg);
|
||||||
@@ -741,8 +741,8 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
case OPT_socket:
|
case OPT_socket:
|
||||||
if (opt_arg)
|
if (opt_arg)
|
||||||
{
|
{
|
||||||
my_free(options->unix_socket);
|
ma_free(options->unix_socket);
|
||||||
options->unix_socket=my_strdup(opt_arg,MYF(MY_WME));
|
options->unix_socket=ma_strdup(opt_arg,MYF(MY_WME));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_compress:
|
case OPT_compress:
|
||||||
@@ -751,8 +751,8 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
case OPT_password:
|
case OPT_password:
|
||||||
if (opt_arg)
|
if (opt_arg)
|
||||||
{
|
{
|
||||||
my_free(options->password);
|
ma_free(options->password);
|
||||||
options->password=my_strdup(opt_arg,MYF(MY_WME));
|
options->password=ma_strdup(opt_arg,MYF(MY_WME));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_pipe:
|
case OPT_pipe:
|
||||||
@@ -766,8 +766,8 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
case OPT_user:
|
case OPT_user:
|
||||||
if (opt_arg)
|
if (opt_arg)
|
||||||
{
|
{
|
||||||
my_free(options->user);
|
ma_free(options->user);
|
||||||
options->user=my_strdup(opt_arg,MYF(MY_WME));
|
options->user=ma_strdup(opt_arg,MYF(MY_WME));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_init_command:
|
case OPT_init_command:
|
||||||
@@ -777,15 +777,15 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
case OPT_host:
|
case OPT_host:
|
||||||
if (opt_arg)
|
if (opt_arg)
|
||||||
{
|
{
|
||||||
my_free(options->host);
|
ma_free(options->host);
|
||||||
options->host=my_strdup(opt_arg,MYF(MY_WME));
|
options->host=ma_strdup(opt_arg,MYF(MY_WME));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_database:
|
case OPT_database:
|
||||||
if (opt_arg)
|
if (opt_arg)
|
||||||
{
|
{
|
||||||
my_free(options->db);
|
ma_free(options->db);
|
||||||
options->db=my_strdup(opt_arg,MYF(MY_WME));
|
options->db=ma_strdup(opt_arg,MYF(MY_WME));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPT_debug:
|
case OPT_debug:
|
||||||
@@ -796,20 +796,20 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
break;
|
break;
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
case OPT_ssl_key:
|
case OPT_ssl_key:
|
||||||
my_free(options->ssl_key);
|
ma_free(options->ssl_key);
|
||||||
options->ssl_key = my_strdup(opt_arg, MYF(MY_WME));
|
options->ssl_key = ma_strdup(opt_arg, MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case OPT_ssl_cert:
|
case OPT_ssl_cert:
|
||||||
my_free(options->ssl_cert);
|
ma_free(options->ssl_cert);
|
||||||
options->ssl_cert = my_strdup(opt_arg, MYF(MY_WME));
|
options->ssl_cert = ma_strdup(opt_arg, MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case OPT_ssl_ca:
|
case OPT_ssl_ca:
|
||||||
my_free(options->ssl_ca);
|
ma_free(options->ssl_ca);
|
||||||
options->ssl_ca = my_strdup(opt_arg, MYF(MY_WME));
|
options->ssl_ca = ma_strdup(opt_arg, MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case OPT_ssl_capath:
|
case OPT_ssl_capath:
|
||||||
my_free(options->ssl_capath);
|
ma_free(options->ssl_capath);
|
||||||
options->ssl_capath = my_strdup(opt_arg, MYF(MY_WME));
|
options->ssl_capath = ma_strdup(opt_arg, MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case OPT_ssl_cipher:
|
case OPT_ssl_cipher:
|
||||||
break;
|
break;
|
||||||
@@ -833,12 +833,12 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
break;
|
break;
|
||||||
#endif /* HAVE_SSL */
|
#endif /* HAVE_SSL */
|
||||||
case OPT_charset_dir:
|
case OPT_charset_dir:
|
||||||
my_free(options->charset_dir);
|
ma_free(options->charset_dir);
|
||||||
options->charset_dir = my_strdup(opt_arg, MYF(MY_WME));
|
options->charset_dir = ma_strdup(opt_arg, MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case OPT_charset_name:
|
case OPT_charset_name:
|
||||||
my_free(options->charset_name);
|
ma_free(options->charset_name);
|
||||||
options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
|
options->charset_name = ma_strdup(opt_arg, MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case OPT_interactive_timeout:
|
case OPT_interactive_timeout:
|
||||||
options->client_flag|= CLIENT_INTERACTIVE;
|
options->client_flag|= CLIENT_INTERACTIVE;
|
||||||
@@ -857,7 +857,7 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
options->max_allowed_packet= atoi(opt_arg);
|
options->max_allowed_packet= atoi(opt_arg);
|
||||||
break;
|
break;
|
||||||
case OPT_protocol:
|
case OPT_protocol:
|
||||||
options->protocol= find_type(opt_arg, &protocol_types, 0);
|
options->protocol= ma_find_type(opt_arg, &sql_protocol_typelib, 0);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
if (options->protocol < 0 || options->protocol > 1)
|
if (options->protocol < 0 || options->protocol > 1)
|
||||||
#else
|
#else
|
||||||
@@ -899,8 +899,8 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
OPT_SET_EXTENDED_VALUE_STR(options, default_auth, opt_arg);
|
OPT_SET_EXTENDED_VALUE_STR(options, default_auth, opt_arg);
|
||||||
break;
|
break;
|
||||||
case OPT_bind_address:
|
case OPT_bind_address:
|
||||||
my_free(options->bind_address);
|
ma_free(options->bind_address);
|
||||||
options->bind_address= my_strdup(opt_arg, MYF(MY_WME));
|
options->bind_address= ma_strdup(opt_arg, MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DBUG_PRINT("warning",("unknown option: %s",option[0]));
|
DBUG_PRINT("warning",("unknown option: %s",option[0]));
|
||||||
@@ -908,7 +908,7 @@ static void mysql_read_default_options(struct st_mysql_options *options,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free_defaults(argv);
|
ma_free_defaults(argv);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -942,7 +942,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|||||||
unsigned int i, field_count= sizeof(rset_field_offsets)/sizeof(size_t)/2;
|
unsigned int i, field_count= sizeof(rset_field_offsets)/sizeof(size_t)/2;
|
||||||
|
|
||||||
DBUG_ENTER("unpack_fields");
|
DBUG_ENTER("unpack_fields");
|
||||||
field=result=(MYSQL_FIELD*) alloc_root(alloc,sizeof(MYSQL_FIELD)*fields);
|
field=result=(MYSQL_FIELD*) ma_alloc_root(alloc,sizeof(MYSQL_FIELD)*fields);
|
||||||
if (!result)
|
if (!result)
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
@@ -952,12 +952,12 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|||||||
{
|
{
|
||||||
switch(row->data[i][0]) {
|
switch(row->data[i][0]) {
|
||||||
case 0:
|
case 0:
|
||||||
*(char **)(((char *)field) + rset_field_offsets[i*2])= strdup_root(alloc, "");
|
*(char **)(((char *)field) + rset_field_offsets[i*2])= ma_strdup_root(alloc, "");
|
||||||
*(unsigned int *)(((char *)field) + rset_field_offsets[i*2+1])= 0;
|
*(unsigned int *)(((char *)field) + rset_field_offsets[i*2+1])= 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*(char **)(((char *)field) + rset_field_offsets[i*2])=
|
*(char **)(((char *)field) + rset_field_offsets[i*2])=
|
||||||
strdup_root(alloc, (char *)row->data[i]);
|
ma_strdup_root(alloc, (char *)row->data[i]);
|
||||||
*(unsigned int *)(((char *)field) + rset_field_offsets[i*2+1])=
|
*(unsigned int *)(((char *)field) + rset_field_offsets[i*2+1])=
|
||||||
(uint)(row->data[i+1] - row->data[i] - 1);
|
(uint)(row->data[i+1] - row->data[i] - 1);
|
||||||
break;
|
break;
|
||||||
@@ -985,7 +985,7 @@ unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
|
|||||||
|
|
||||||
if (default_value && row->data[7])
|
if (default_value && row->data[7])
|
||||||
{
|
{
|
||||||
field->def=strdup_root(alloc,(char*) row->data[7]);
|
field->def=ma_strdup_root(alloc,(char*) row->data[7]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
field->def=0;
|
field->def=0;
|
||||||
@@ -1013,13 +1013,13 @@ MYSQL_DATA *mthd_my_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
|||||||
|
|
||||||
if ((pkt_len= net_safe_read(mysql)) == packet_error)
|
if ((pkt_len= net_safe_read(mysql)) == packet_error)
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
if (!(result=(MYSQL_DATA*) my_malloc(sizeof(MYSQL_DATA),
|
if (!(result=(MYSQL_DATA*) ma_malloc(sizeof(MYSQL_DATA),
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
init_alloc_root(&result->alloc,8192,0); /* Assume rowlength < 8192 */
|
ma_init_ma_alloc_root(&result->alloc,8192,0); /* Assume rowlength < 8192 */
|
||||||
result->alloc.min_malloc=sizeof(MYSQL_ROWS);
|
result->alloc.min_malloc=sizeof(MYSQL_ROWS);
|
||||||
prev_ptr= &result->data;
|
prev_ptr= &result->data;
|
||||||
result->rows=0;
|
result->rows=0;
|
||||||
@@ -1028,10 +1028,10 @@ MYSQL_DATA *mthd_my_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
|
|||||||
while (*(cp=net->read_pos) != 254 || pkt_len >= 8)
|
while (*(cp=net->read_pos) != 254 || pkt_len >= 8)
|
||||||
{
|
{
|
||||||
result->rows++;
|
result->rows++;
|
||||||
if (!(cur= (MYSQL_ROWS*) alloc_root(&result->alloc,
|
if (!(cur= (MYSQL_ROWS*) ma_alloc_root(&result->alloc,
|
||||||
sizeof(MYSQL_ROWS))) ||
|
sizeof(MYSQL_ROWS))) ||
|
||||||
!(cur->data= ((MYSQL_ROW)
|
!(cur->data= ((MYSQL_ROW)
|
||||||
alloc_root(&result->alloc,
|
ma_alloc_root(&result->alloc,
|
||||||
(fields+1)*sizeof(char *)+fields+pkt_len))))
|
(fields+1)*sizeof(char *)+fields+pkt_len))))
|
||||||
{
|
{
|
||||||
free_rows(result);
|
free_rows(result);
|
||||||
@@ -1151,7 +1151,7 @@ mysql_init(MYSQL *mysql)
|
|||||||
return NULL;
|
return NULL;
|
||||||
if (!mysql)
|
if (!mysql)
|
||||||
{
|
{
|
||||||
if (!(mysql=(MYSQL*) my_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
|
if (!(mysql=(MYSQL*) ma_malloc(sizeof(*mysql),MYF(MY_WME | MY_ZEROFILL))))
|
||||||
return 0;
|
return 0;
|
||||||
mysql->free_me=1;
|
mysql->free_me=1;
|
||||||
mysql->net.pvio= 0;
|
mysql->net.pvio= 0;
|
||||||
@@ -1159,7 +1159,7 @@ mysql_init(MYSQL *mysql)
|
|||||||
else
|
else
|
||||||
bzero((char*) (mysql),sizeof(*(mysql)));
|
bzero((char*) (mysql),sizeof(*(mysql)));
|
||||||
mysql->options.connect_timeout=CONNECT_TIMEOUT;
|
mysql->options.connect_timeout=CONNECT_TIMEOUT;
|
||||||
mysql->charset= default_charset_info;
|
mysql->charset= ma_default_charset_info;
|
||||||
mysql->methods= &MARIADB_DEFAULT_METHODS;
|
mysql->methods= &MARIADB_DEFAULT_METHODS;
|
||||||
strmov(mysql->net.sqlstate, "00000");
|
strmov(mysql->net.sqlstate, "00000");
|
||||||
mysql->net.last_error[0]= mysql->net.last_errno= 0;
|
mysql->net.last_error[0]= mysql->net.last_errno= 0;
|
||||||
@@ -1308,7 +1308,7 @@ mysql_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
if (!(plugin= (MARIADB_CONNECTION_PLUGIN *)mysql_client_find_plugin(mysql, plugin_name, MARIADB_CLIENT_CONNECTION_PLUGIN)))
|
if (!(plugin= (MARIADB_CONNECTION_PLUGIN *)mysql_client_find_plugin(mysql, plugin_name, MARIADB_CLIENT_CONNECTION_PLUGIN)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!(mysql->net.conn_hdlr= (MA_CONNECTION_HANDLER *)my_malloc(sizeof(MA_CONNECTION_HANDLER), MYF(MY_ZEROFILL))))
|
if (!(mysql->net.conn_hdlr= (MA_CONNECTION_HANDLER *)ma_malloc(sizeof(MA_CONNECTION_HANDLER), MYF(MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1324,7 +1324,7 @@ mysql_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
MYSQL *my= plugin->connect(mysql, end, user, passwd, db, port, unix_socket, client_flag);
|
MYSQL *my= plugin->connect(mysql, end, user, passwd, db, port, unix_socket, client_flag);
|
||||||
if (!my)
|
if (!my)
|
||||||
{
|
{
|
||||||
my_free(mysql->net.conn_hdlr);
|
ma_free(mysql->net.conn_hdlr);
|
||||||
mysql->net.conn_hdlr= NULL;
|
mysql->net.conn_hdlr= NULL;
|
||||||
}
|
}
|
||||||
return my;
|
return my;
|
||||||
@@ -1374,8 +1374,8 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
(mysql->options.my_cnf_file ?
|
(mysql->options.my_cnf_file ?
|
||||||
mysql->options.my_cnf_file : "my"),
|
mysql->options.my_cnf_file : "my"),
|
||||||
mysql->options.my_cnf_group);
|
mysql->options.my_cnf_group);
|
||||||
my_free(mysql->options.my_cnf_file);
|
ma_free(mysql->options.my_cnf_file);
|
||||||
my_free(mysql->options.my_cnf_group);
|
ma_free(mysql->options.my_cnf_group);
|
||||||
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
|
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1529,8 +1529,8 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
(uint) strlen(cinfo.unix_socket)+1 : (uint) 1,
|
(uint) strlen(cinfo.unix_socket)+1 : (uint) 1,
|
||||||
&mysql->server_version, (uint) (end - (char*) net->read_pos),
|
&mysql->server_version, (uint) (end - (char*) net->read_pos),
|
||||||
NullS) ||
|
NullS) ||
|
||||||
!(mysql->user=my_strdup(user,MYF(0))) ||
|
!(mysql->user=ma_strdup(user,MYF(0))) ||
|
||||||
!(mysql->passwd=my_strdup(passwd,MYF(0))))
|
!(mysql->passwd=ma_strdup(passwd,MYF(0))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto error;
|
goto error;
|
||||||
@@ -1546,7 +1546,7 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
|
|
||||||
if (strncmp(end, MA_RPL_VERSION_HACK, sizeof(MA_RPL_VERSION_HACK) - 1) == 0)
|
if (strncmp(end, MA_RPL_VERSION_HACK, sizeof(MA_RPL_VERSION_HACK) - 1) == 0)
|
||||||
{
|
{
|
||||||
if (!(mysql->server_version= my_strdup(end + sizeof(MA_RPL_VERSION_HACK) - 1, 0)))
|
if (!(mysql->server_version= ma_strdup(end + sizeof(MA_RPL_VERSION_HACK) - 1, 0)))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto error;
|
goto error;
|
||||||
@@ -1555,7 +1555,7 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!(mysql->server_version= my_strdup(end, MYF(0))))
|
if (!(mysql->server_version= ma_strdup(end, MYF(0))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto error;
|
goto error;
|
||||||
@@ -1631,7 +1631,7 @@ MYSQL *mthd_my_real_connect(MYSQL *mysql, const char *host, const char *user,
|
|||||||
else if (mysql->server_language)
|
else if (mysql->server_language)
|
||||||
mysql->charset= mysql_find_charset_nr(mysql->server_language);
|
mysql->charset= mysql_find_charset_nr(mysql->server_language);
|
||||||
else
|
else
|
||||||
mysql->charset=default_charset_info;
|
mysql->charset=ma_default_charset_info;
|
||||||
|
|
||||||
if (!mysql->charset)
|
if (!mysql->charset)
|
||||||
{
|
{
|
||||||
@@ -1865,10 +1865,10 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||||||
else if (mysql->server_language)
|
else if (mysql->server_language)
|
||||||
mysql->charset=mysql_find_charset_nr(mysql->server_language);
|
mysql->charset=mysql_find_charset_nr(mysql->server_language);
|
||||||
else
|
else
|
||||||
mysql->charset=default_charset_info;
|
mysql->charset=ma_default_charset_info;
|
||||||
|
|
||||||
mysql->user= my_strdup(user ? user : "", MYF(MY_WME));
|
mysql->user= ma_strdup(user ? user : "", MYF(MY_WME));
|
||||||
mysql->passwd= my_strdup(passwd ? passwd : "", MYF(MY_WME));
|
mysql->passwd= ma_strdup(passwd ? passwd : "", MYF(MY_WME));
|
||||||
|
|
||||||
/* db will be set in run_plugin_auth */
|
/* db will be set in run_plugin_auth */
|
||||||
mysql->db= 0;
|
mysql->db= 0;
|
||||||
@@ -1879,20 +1879,20 @@ my_bool STDCALL mysql_change_user(MYSQL *mysql, const char *user,
|
|||||||
|
|
||||||
if (rc==0)
|
if (rc==0)
|
||||||
{
|
{
|
||||||
my_free(s_user);
|
ma_free(s_user);
|
||||||
my_free(s_passwd);
|
ma_free(s_passwd);
|
||||||
my_free(s_db);
|
ma_free(s_db);
|
||||||
|
|
||||||
if (db && !(mysql->db= my_strdup(db,MYF(MY_WME))))
|
if (db && !(mysql->db= ma_strdup(db,MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
rc= 1;
|
rc= 1;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
my_free(mysql->user);
|
ma_free(mysql->user);
|
||||||
my_free(mysql->passwd);
|
ma_free(mysql->passwd);
|
||||||
my_free(mysql->db);
|
ma_free(mysql->db);
|
||||||
|
|
||||||
mysql->user= s_user;
|
mysql->user= s_user;
|
||||||
mysql->passwd= s_passwd;
|
mysql->passwd= s_passwd;
|
||||||
@@ -1916,8 +1916,8 @@ mysql_select_db(MYSQL *mysql, const char *db)
|
|||||||
|
|
||||||
if ((error=simple_command(mysql, COM_INIT_DB,db,(uint) strlen(db),0,0)))
|
if ((error=simple_command(mysql, COM_INIT_DB,db,(uint) strlen(db),0,0)))
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
my_free(mysql->db);
|
ma_free(mysql->db);
|
||||||
mysql->db=my_strdup(db,MYF(MY_WME));
|
mysql->db=ma_strdup(db,MYF(MY_WME));
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1935,39 +1935,39 @@ static void mysql_close_options(MYSQL *mysql)
|
|||||||
char **end= begin + mysql->options.init_command->elements;
|
char **end= begin + mysql->options.init_command->elements;
|
||||||
|
|
||||||
for (;begin < end; begin++)
|
for (;begin < end; begin++)
|
||||||
my_free(*begin);
|
ma_free(*begin);
|
||||||
delete_dynamic(mysql->options.init_command);
|
ma_delete_dynamic(mysql->options.init_command);
|
||||||
my_free(mysql->options.init_command);
|
ma_free(mysql->options.init_command);
|
||||||
}
|
}
|
||||||
my_free(mysql->options.user);
|
ma_free(mysql->options.user);
|
||||||
my_free(mysql->options.host);
|
ma_free(mysql->options.host);
|
||||||
my_free(mysql->options.password);
|
ma_free(mysql->options.password);
|
||||||
my_free(mysql->options.unix_socket);
|
ma_free(mysql->options.unix_socket);
|
||||||
my_free(mysql->options.db);
|
ma_free(mysql->options.db);
|
||||||
my_free(mysql->options.my_cnf_file);
|
ma_free(mysql->options.my_cnf_file);
|
||||||
my_free(mysql->options.my_cnf_group);
|
ma_free(mysql->options.my_cnf_group);
|
||||||
my_free(mysql->options.charset_dir);
|
ma_free(mysql->options.charset_dir);
|
||||||
my_free(mysql->options.charset_name);
|
ma_free(mysql->options.charset_name);
|
||||||
my_free(mysql->options.bind_address);
|
ma_free(mysql->options.bind_address);
|
||||||
my_free(mysql->options.ssl_key);
|
ma_free(mysql->options.ssl_key);
|
||||||
my_free(mysql->options.ssl_cert);
|
ma_free(mysql->options.ssl_cert);
|
||||||
my_free(mysql->options.ssl_ca);
|
ma_free(mysql->options.ssl_ca);
|
||||||
my_free(mysql->options.ssl_capath);
|
ma_free(mysql->options.ssl_capath);
|
||||||
my_free(mysql->options.ssl_cipher);
|
ma_free(mysql->options.ssl_cipher);
|
||||||
|
|
||||||
if (mysql->options.extension)
|
if (mysql->options.extension)
|
||||||
{
|
{
|
||||||
struct mysql_async_context *ctxt;
|
struct mysql_async_context *ctxt;
|
||||||
my_free(mysql->options.extension->plugin_dir);
|
ma_free(mysql->options.extension->plugin_dir);
|
||||||
my_free(mysql->options.extension->default_auth);
|
ma_free(mysql->options.extension->default_auth);
|
||||||
my_free(mysql->options.extension->db_driver);
|
ma_free(mysql->options.extension->db_driver);
|
||||||
my_free(mysql->options.extension->ssl_crl);
|
ma_free(mysql->options.extension->ssl_crl);
|
||||||
my_free(mysql->options.extension->ssl_crlpath);
|
ma_free(mysql->options.extension->ssl_crlpath);
|
||||||
my_free(mysql->options.extension->ssl_fp);
|
ma_free(mysql->options.extension->ssl_fp);
|
||||||
my_free(mysql->options.extension->ssl_fp_list);
|
ma_free(mysql->options.extension->ssl_fp_list);
|
||||||
my_free(mysql->options.extension->ssl_pw);
|
ma_free(mysql->options.extension->ssl_pw);
|
||||||
my_free(mysql->options.extension->url);
|
ma_free(mysql->options.extension->url);
|
||||||
my_free(mysql->options.extension->connection_handler);
|
ma_free(mysql->options.extension->connection_handler);
|
||||||
if(hash_inited(&mysql->options.extension->connect_attrs))
|
if(hash_inited(&mysql->options.extension->connect_attrs))
|
||||||
hash_free(&mysql->options.extension->connect_attrs);
|
hash_free(&mysql->options.extension->connect_attrs);
|
||||||
if (hash_inited(&mysql->options.extension->userdata))
|
if (hash_inited(&mysql->options.extension->userdata))
|
||||||
@@ -1975,22 +1975,22 @@ static void mysql_close_options(MYSQL *mysql)
|
|||||||
if ((ctxt = mysql->options.extension->async_context) != 0)
|
if ((ctxt = mysql->options.extension->async_context) != 0)
|
||||||
{
|
{
|
||||||
my_context_destroy(&ctxt->async_context);
|
my_context_destroy(&ctxt->async_context);
|
||||||
my_free(ctxt);
|
ma_free(ctxt);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
my_free(mysql->options.extension);
|
ma_free(mysql->options.extension);
|
||||||
/* clear all pointer */
|
/* clear all pointer */
|
||||||
memset(&mysql->options, 0, sizeof(mysql->options));
|
memset(&mysql->options, 0, sizeof(mysql->options));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mysql_close_memory(MYSQL *mysql)
|
static void mysql_close_memory(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
my_free(mysql->host_info);
|
ma_free(mysql->host_info);
|
||||||
my_free(mysql->user);
|
ma_free(mysql->user);
|
||||||
my_free(mysql->passwd);
|
ma_free(mysql->passwd);
|
||||||
my_free(mysql->db);
|
ma_free(mysql->db);
|
||||||
my_free(mysql->server_version);
|
ma_free(mysql->server_version);
|
||||||
mysql->host_info= mysql->server_version=mysql->user=mysql->passwd=mysql->db=0;
|
mysql->host_info= mysql->server_version=mysql->user=mysql->passwd=mysql->db=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2007,7 +2007,7 @@ void my_set_error(MYSQL *mysql,
|
|||||||
mysql->net.last_errno= error_nr;
|
mysql->net.last_errno= error_nr;
|
||||||
strncpy(mysql->net.sqlstate, sqlstate, SQLSTATE_LENGTH);
|
strncpy(mysql->net.sqlstate, sqlstate, SQLSTATE_LENGTH);
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
my_vsnprintf(mysql->net.last_error, MYSQL_ERRMSG_SIZE,
|
ma_vsnprintf(mysql->net.last_error, MYSQL_ERRMSG_SIZE,
|
||||||
format ? format : ER(error_nr), ap);
|
format ? format : ER(error_nr), ap);
|
||||||
DBUG_PRINT("info", ("error(%d) %s", error_nr, mysql->net.last_error));
|
DBUG_PRINT("info", ("error(%d) %s", error_nr, mysql->net.last_error));
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
@@ -2037,7 +2037,7 @@ mysql_close(MYSQL *mysql)
|
|||||||
{
|
{
|
||||||
MA_CONNECTION_HANDLER *p= mysql->net.conn_hdlr;
|
MA_CONNECTION_HANDLER *p= mysql->net.conn_hdlr;
|
||||||
p->plugin->close(mysql);
|
p->plugin->close(mysql);
|
||||||
my_free(p);
|
ma_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysql->methods)
|
if (mysql->methods)
|
||||||
@@ -2054,11 +2054,11 @@ mysql_close(MYSQL *mysql)
|
|||||||
bzero((char*) &mysql->options,sizeof(mysql->options));
|
bzero((char*) &mysql->options,sizeof(mysql->options));
|
||||||
|
|
||||||
if (mysql->extension)
|
if (mysql->extension)
|
||||||
my_free(mysql->extension);
|
ma_free(mysql->extension);
|
||||||
|
|
||||||
mysql->net.pvio= 0;
|
mysql->net.pvio= 0;
|
||||||
if (mysql->free_me)
|
if (mysql->free_me)
|
||||||
my_free(mysql);
|
ma_free(mysql);
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@@ -2186,7 +2186,7 @@ mysql_store_result(MYSQL *mysql)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
mysql->status=MYSQL_STATUS_READY; /* server is ready */
|
mysql->status=MYSQL_STATUS_READY; /* server is ready */
|
||||||
if (!(result=(MYSQL_RES*) my_malloc(sizeof(MYSQL_RES)+
|
if (!(result=(MYSQL_RES*) ma_malloc(sizeof(MYSQL_RES)+
|
||||||
sizeof(ulong)*mysql->field_count,
|
sizeof(ulong)*mysql->field_count,
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
@@ -2197,7 +2197,7 @@ mysql_store_result(MYSQL *mysql)
|
|||||||
result->lengths=(ulong*) (result+1);
|
result->lengths=(ulong*) (result+1);
|
||||||
if (!(result->data=mysql->methods->db_read_rows(mysql,mysql->fields,mysql->field_count)))
|
if (!(result->data=mysql->methods->db_read_rows(mysql,mysql->fields,mysql->field_count)))
|
||||||
{
|
{
|
||||||
my_free(result);
|
ma_free(result);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
mysql->affected_rows= result->row_count= result->data->rows;
|
mysql->affected_rows= result->row_count= result->data->rows;
|
||||||
@@ -2235,15 +2235,15 @@ mysql_use_result(MYSQL *mysql)
|
|||||||
SET_CLIENT_ERROR(mysql, CR_COMMANDS_OUT_OF_SYNC, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_COMMANDS_OUT_OF_SYNC, SQLSTATE_UNKNOWN, 0);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
if (!(result=(MYSQL_RES*) my_malloc(sizeof(*result)+
|
if (!(result=(MYSQL_RES*) ma_malloc(sizeof(*result)+
|
||||||
sizeof(ulong)*mysql->field_count,
|
sizeof(ulong)*mysql->field_count,
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
result->lengths=(ulong*) (result+1);
|
result->lengths=(ulong*) (result+1);
|
||||||
if (!(result->row=(MYSQL_ROW)
|
if (!(result->row=(MYSQL_ROW)
|
||||||
my_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
|
ma_malloc(sizeof(result->row[0])*(mysql->field_count+1), MYF(MY_WME))))
|
||||||
{ /* Ptrs: to one row */
|
{ /* Ptrs: to one row */
|
||||||
my_free(result);
|
ma_free(result);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
result->fields= mysql->fields;
|
result->fields= mysql->fields;
|
||||||
@@ -2441,7 +2441,7 @@ mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)
|
|||||||
DBUG_RETURN(NULL);
|
DBUG_RETURN(NULL);
|
||||||
|
|
||||||
free_old_query(mysql);
|
free_old_query(mysql);
|
||||||
if (!(result = (MYSQL_RES *) my_malloc(sizeof(MYSQL_RES),
|
if (!(result = (MYSQL_RES *) ma_malloc(sizeof(MYSQL_RES),
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
free_rows(query);
|
free_rows(query);
|
||||||
@@ -2627,7 +2627,7 @@ uchar *ma_get_hash_keyval(const uchar *hash_entry,
|
|||||||
|
|
||||||
void ma_hash_free(void *p)
|
void ma_hash_free(void *p)
|
||||||
{
|
{
|
||||||
my_free(p);
|
ma_free(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
int mariadb_flush_multi_command(MYSQL *mysql)
|
int mariadb_flush_multi_command(MYSQL *mysql)
|
||||||
@@ -2685,20 +2685,20 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
options_add_initcommand(&mysql->options, (char *)arg1);
|
options_add_initcommand(&mysql->options, (char *)arg1);
|
||||||
break;
|
break;
|
||||||
case MYSQL_READ_DEFAULT_FILE:
|
case MYSQL_READ_DEFAULT_FILE:
|
||||||
my_free(mysql->options.my_cnf_file);
|
ma_free(mysql->options.my_cnf_file);
|
||||||
mysql->options.my_cnf_file=my_strdup((char *)arg1,MYF(MY_WME));
|
mysql->options.my_cnf_file=ma_strdup((char *)arg1,MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case MYSQL_READ_DEFAULT_GROUP:
|
case MYSQL_READ_DEFAULT_GROUP:
|
||||||
my_free(mysql->options.my_cnf_group);
|
ma_free(mysql->options.my_cnf_group);
|
||||||
mysql->options.my_cnf_group=my_strdup((char *)arg1,MYF(MY_WME));
|
mysql->options.my_cnf_group=ma_strdup((char *)arg1,MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case MYSQL_SET_CHARSET_DIR:
|
case MYSQL_SET_CHARSET_DIR:
|
||||||
/* not supported in this version. Since all character sets
|
/* not supported in this version. Since all character sets
|
||||||
are internally available, we don't throw an error */
|
are internally available, we don't throw an error */
|
||||||
break;
|
break;
|
||||||
case MYSQL_SET_CHARSET_NAME:
|
case MYSQL_SET_CHARSET_NAME:
|
||||||
my_free(mysql->options.charset_name);
|
ma_free(mysql->options.charset_name);
|
||||||
mysql->options.charset_name=my_strdup((char *)arg1,MYF(MY_WME));
|
mysql->options.charset_name=ma_strdup((char *)arg1,MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case MYSQL_OPT_RECONNECT:
|
case MYSQL_OPT_RECONNECT:
|
||||||
mysql->options.reconnect= *(uint *)arg1;
|
mysql->options.reconnect= *(uint *)arg1;
|
||||||
@@ -2718,7 +2718,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
case MYSQL_PROGRESS_CALLBACK:
|
case MYSQL_PROGRESS_CALLBACK:
|
||||||
if (!mysql->options.extension)
|
if (!mysql->options.extension)
|
||||||
mysql->options.extension= (struct st_mysql_options_extension *)
|
mysql->options.extension= (struct st_mysql_options_extension *)
|
||||||
my_malloc(sizeof(struct st_mysql_options_extension),
|
ma_malloc(sizeof(struct st_mysql_options_extension),
|
||||||
MYF(MY_WME | MY_ZEROFILL));
|
MYF(MY_WME | MY_ZEROFILL));
|
||||||
if (mysql->options.extension)
|
if (mysql->options.extension)
|
||||||
mysql->options.extension->report_progress=
|
mysql->options.extension->report_progress=
|
||||||
@@ -2739,11 +2739,11 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
break;
|
break;
|
||||||
if (!mysql->options.extension)
|
if (!mysql->options.extension)
|
||||||
mysql->options.extension= (struct st_mysql_options_extension *)
|
mysql->options.extension= (struct st_mysql_options_extension *)
|
||||||
my_malloc(sizeof(struct st_mysql_options_extension),
|
ma_malloc(sizeof(struct st_mysql_options_extension),
|
||||||
MYF(MY_WME | MY_ZEROFILL));
|
MYF(MY_WME | MY_ZEROFILL));
|
||||||
if (!mysql->options.extension->db_driver)
|
if (!mysql->options.extension->db_driver)
|
||||||
mysql->options.extension->db_driver= (MARIADB_DB_DRIVER *)
|
mysql->options.extension->db_driver= (MARIADB_DB_DRIVER *)
|
||||||
my_malloc(sizeof(MARIADB_DB_DRIVER), MYF(MY_WME | MY_ZEROFILL));
|
ma_malloc(sizeof(MARIADB_DB_DRIVER), MYF(MY_WME | MY_ZEROFILL));
|
||||||
if (mysql->options.extension &&
|
if (mysql->options.extension &&
|
||||||
mysql->options.extension->db_driver)
|
mysql->options.extension->db_driver)
|
||||||
{
|
{
|
||||||
@@ -2766,10 +2766,10 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
if (ctxt->suspended)
|
if (ctxt->suspended)
|
||||||
goto end;
|
goto end;
|
||||||
my_context_destroy(&ctxt->async_context);
|
my_context_destroy(&ctxt->async_context);
|
||||||
my_free(ctxt);
|
ma_free(ctxt);
|
||||||
}
|
}
|
||||||
if (!(ctxt= (struct mysql_async_context *)
|
if (!(ctxt= (struct mysql_async_context *)
|
||||||
my_malloc(sizeof(*ctxt), MYF(MY_ZEROFILL))))
|
ma_malloc(sizeof(*ctxt), MYF(MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto end;
|
goto end;
|
||||||
@@ -2781,12 +2781,12 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
stacksize= ASYNC_CONTEXT_DEFAULT_STACK_SIZE;
|
stacksize= ASYNC_CONTEXT_DEFAULT_STACK_SIZE;
|
||||||
if (my_context_init(&ctxt->async_context, stacksize))
|
if (my_context_init(&ctxt->async_context, stacksize))
|
||||||
{
|
{
|
||||||
my_free(ctxt);
|
ma_free(ctxt);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if (!mysql->options.extension)
|
if (!mysql->options.extension)
|
||||||
if(!(mysql->options.extension= (struct st_mysql_options_extension *)
|
if(!(mysql->options.extension= (struct st_mysql_options_extension *)
|
||||||
my_malloc(sizeof(struct st_mysql_options_extension),
|
ma_malloc(sizeof(struct st_mysql_options_extension),
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
@@ -2812,24 +2812,24 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
mysql->options.client_flag &= ~CLIENT_SSL_VERIFY_SERVER_CERT;
|
mysql->options.client_flag &= ~CLIENT_SSL_VERIFY_SERVER_CERT;
|
||||||
break;
|
break;
|
||||||
case MYSQL_OPT_SSL_KEY:
|
case MYSQL_OPT_SSL_KEY:
|
||||||
my_free(mysql->options.ssl_key);
|
ma_free(mysql->options.ssl_key);
|
||||||
mysql->options.ssl_key=my_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
mysql->options.ssl_key=ma_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||||
break;
|
break;
|
||||||
case MYSQL_OPT_SSL_CERT:
|
case MYSQL_OPT_SSL_CERT:
|
||||||
my_free(mysql->options.ssl_cert);
|
ma_free(mysql->options.ssl_cert);
|
||||||
mysql->options.ssl_cert=my_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
mysql->options.ssl_cert=ma_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||||
break;
|
break;
|
||||||
case MYSQL_OPT_SSL_CA:
|
case MYSQL_OPT_SSL_CA:
|
||||||
my_free(mysql->options.ssl_ca);
|
ma_free(mysql->options.ssl_ca);
|
||||||
mysql->options.ssl_ca=my_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
mysql->options.ssl_ca=ma_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||||
break;
|
break;
|
||||||
case MYSQL_OPT_SSL_CAPATH:
|
case MYSQL_OPT_SSL_CAPATH:
|
||||||
my_free(mysql->options.ssl_capath);
|
ma_free(mysql->options.ssl_capath);
|
||||||
mysql->options.ssl_capath=my_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
mysql->options.ssl_capath=ma_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||||
break;
|
break;
|
||||||
case MYSQL_OPT_SSL_CIPHER:
|
case MYSQL_OPT_SSL_CIPHER:
|
||||||
my_free(mysql->options.ssl_cipher);
|
ma_free(mysql->options.ssl_cipher);
|
||||||
mysql->options.ssl_cipher=my_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
mysql->options.ssl_cipher=ma_strdup((char *)arg1,MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||||
break;
|
break;
|
||||||
case MYSQL_OPT_SSL_CRL:
|
case MYSQL_OPT_SSL_CRL:
|
||||||
OPT_SET_EXTENDED_VALUE_STR(&mysql->options, ssl_crl, (char *)arg1);
|
OPT_SET_EXTENDED_VALUE_STR(&mysql->options, ssl_crl, (char *)arg1);
|
||||||
@@ -2898,7 +2898,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(buffer= (uchar *)my_malloc(strlen(key) + 1 + sizeof(void *), MYF(MY_ZEROFILL))))
|
if (!(buffer= (uchar *)ma_malloc(strlen(key) + 1 + sizeof(void *), MYF(MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto end;
|
goto end;
|
||||||
@@ -2911,7 +2911,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
|
|
||||||
if (hash_insert(&mysql->options.extension->userdata, buffer))
|
if (hash_insert(&mysql->options.extension->userdata, buffer))
|
||||||
{
|
{
|
||||||
my_free(buffer);
|
ma_free(buffer);
|
||||||
SET_CLIENT_ERROR(mysql, CR_INVALID_PARAMETER_NO, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_INVALID_PARAMETER_NO, SQLSTATE_UNKNOWN, 0);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -2949,7 +2949,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((buffer= (uchar *)my_malloc(key_len + value_len,
|
if ((buffer= (uchar *)ma_malloc(key_len + value_len,
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
uchar *p= buffer;
|
uchar *p= buffer;
|
||||||
@@ -2960,7 +2960,7 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
|
|
||||||
if (hash_insert(&mysql->options.extension->connect_attrs, buffer))
|
if (hash_insert(&mysql->options.extension->connect_attrs, buffer))
|
||||||
{
|
{
|
||||||
my_free(buffer);
|
ma_free(buffer);
|
||||||
SET_CLIENT_ERROR(mysql, CR_INVALID_PARAMETER_NO, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_INVALID_PARAMETER_NO, SQLSTATE_UNKNOWN, 0);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -2979,8 +2979,8 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
|
|||||||
mysql->options.secure_auth= *(my_bool *)arg1;
|
mysql->options.secure_auth= *(my_bool *)arg1;
|
||||||
break;
|
break;
|
||||||
case MYSQL_OPT_BIND:
|
case MYSQL_OPT_BIND:
|
||||||
my_free(mysql->options.bind_address);
|
ma_free(mysql->options.bind_address);
|
||||||
mysql->options.bind_address= my_strdup(arg1, MYF(MY_WME));
|
mysql->options.bind_address= ma_strdup(arg1, MYF(MY_WME));
|
||||||
break;
|
break;
|
||||||
case MARIADB_OPT_SSL_FP:
|
case MARIADB_OPT_SSL_FP:
|
||||||
OPT_SET_EXTENDED_VALUE_STR(&mysql->options, ssl_fp, (char *)arg1);
|
OPT_SET_EXTENDED_VALUE_STR(&mysql->options, ssl_fp, (char *)arg1);
|
||||||
@@ -3418,7 +3418,7 @@ uint STDCALL mysql_thread_safe(void)
|
|||||||
ulong STDCALL
|
ulong STDCALL
|
||||||
mysql_escape_string(char *to,const char *from, ulong length)
|
mysql_escape_string(char *to,const char *from, ulong length)
|
||||||
{
|
{
|
||||||
return (ulong)mysql_cset_escape_slashes(default_charset_info, to, from, length);
|
return (ulong)mysql_cset_escape_slashes(ma_default_charset_info, to, from, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
ulong STDCALL
|
ulong STDCALL
|
||||||
@@ -3467,7 +3467,7 @@ int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname)
|
|||||||
{
|
{
|
||||||
char buff[64];
|
char buff[64];
|
||||||
|
|
||||||
my_snprintf(buff, 63, "SET NAMES %s", cs->csname);
|
ma_snprintf(buff, 63, "SET NAMES %s", cs->csname);
|
||||||
if (!mysql_real_query(mysql, buff, (uint)strlen(buff)))
|
if (!mysql_real_query(mysql, buff, (uint)strlen(buff)))
|
||||||
{
|
{
|
||||||
mysql->charset= cs;
|
mysql->charset= cs;
|
||||||
@@ -3500,7 +3500,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)),
|
|||||||
if (!mysql_client_init)
|
if (!mysql_client_init)
|
||||||
{
|
{
|
||||||
mysql_client_init=1;
|
mysql_client_init=1;
|
||||||
my_init(); /* Will init threads */
|
ma_init(); /* Will init threads */
|
||||||
init_client_errs();
|
init_client_errs();
|
||||||
if (mysql_client_plugin_init())
|
if (mysql_client_plugin_init())
|
||||||
return 1;
|
return 1;
|
||||||
@@ -3545,19 +3545,19 @@ void STDCALL mysql_server_end(void)
|
|||||||
mysql_client_plugin_deinit();
|
mysql_client_plugin_deinit();
|
||||||
|
|
||||||
list_free(pvio_callback, 0);
|
list_free(pvio_callback, 0);
|
||||||
if (my_init_done)
|
if (ma_init_done)
|
||||||
my_end(0);
|
ma_end(0);
|
||||||
#ifdef HAVE_SSL
|
#ifdef HAVE_SSL
|
||||||
ma_pvio_ssl_end();
|
ma_pvio_ssl_end();
|
||||||
#endif
|
#endif
|
||||||
mysql_client_init= 0;
|
mysql_client_init= 0;
|
||||||
my_init_done= 0;
|
ma_init_done= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
my_bool STDCALL mysql_thread_init(void)
|
my_bool STDCALL mysql_thread_init(void)
|
||||||
{
|
{
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
return my_thread_init();
|
return ma_thread_init();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -3565,7 +3565,7 @@ my_bool STDCALL mysql_thread_init(void)
|
|||||||
void STDCALL mysql_thread_end(void)
|
void STDCALL mysql_thread_end(void)
|
||||||
{
|
{
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
my_thread_end();
|
ma_thread_end();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -63,8 +63,8 @@ void list_free(LIST *root, unsigned int free_data)
|
|||||||
{
|
{
|
||||||
next=root->next;
|
next=root->next;
|
||||||
if (free_data)
|
if (free_data)
|
||||||
my_free(root->data);
|
ma_free(root->data);
|
||||||
my_free(root);
|
ma_free(root);
|
||||||
root=next;
|
root=next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@ void list_free(LIST *root, unsigned int free_data)
|
|||||||
|
|
||||||
LIST *list_cons(void *data, LIST *list)
|
LIST *list_cons(void *data, LIST *list)
|
||||||
{
|
{
|
||||||
LIST *new_charset=(LIST*) my_malloc(sizeof(LIST),MYF(MY_FAE));
|
LIST *new_charset=(LIST*) ma_malloc(sizeof(LIST),MYF(MY_FAE));
|
||||||
if (!new_charset)
|
if (!new_charset)
|
||||||
return 0;
|
return 0;
|
||||||
new_charset->data=data;
|
new_charset->data=data;
|
||||||
|
@@ -16,9 +16,9 @@
|
|||||||
MA 02111-1307, USA */
|
MA 02111-1307, USA */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Defines: llstr();
|
Defines: ma_llstr();
|
||||||
|
|
||||||
llstr(value, buff);
|
ma_llstr(value, buff);
|
||||||
|
|
||||||
This function saves a longlong value in a buffer and returns the pointer to
|
This function saves a longlong value in a buffer and returns the pointer to
|
||||||
the buffer. This is useful when trying to portable print longlong
|
the buffer. This is useful when trying to portable print longlong
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include "m_string.h"
|
#include "m_string.h"
|
||||||
|
|
||||||
char *llstr(longlong value,char *buff)
|
char *ma_llstr(longlong value,char *buff)
|
||||||
{
|
{
|
||||||
longlong2str(value,buff,-10);
|
longlong2str(value,buff,-10);
|
||||||
return buff;
|
return buff;
|
||||||
|
@@ -1139,7 +1139,7 @@ static enum enum_dyncol_func_result
|
|||||||
dynamic_column_dyncol_read(DYNAMIC_COLUMN_VALUE *store_it_here,
|
dynamic_column_dyncol_read(DYNAMIC_COLUMN_VALUE *store_it_here,
|
||||||
uchar *data, size_t length)
|
uchar *data, size_t length)
|
||||||
{
|
{
|
||||||
store_it_here->x.string.charset= my_charset_bin;
|
store_it_here->x.string.charset= ma_charset_bin;
|
||||||
store_it_here->x.string.value.length= length;
|
store_it_here->x.string.value.length= length;
|
||||||
store_it_here->x.string.value.str= (char*) data;
|
store_it_here->x.string.value.str= (char*) data;
|
||||||
return ER_DYNCOL_OK;
|
return ER_DYNCOL_OK;
|
||||||
@@ -2440,7 +2440,7 @@ dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint)
|
|||||||
str->length)
|
str->length)
|
||||||
return ER_DYNCOL_FORMAT;
|
return ER_DYNCOL_FORMAT;
|
||||||
|
|
||||||
if (my_init_dynamic_array(array_of_uint, sizeof(uint), header.column_count, 0))
|
if (ma_init_dynamic_array(array_of_uint, sizeof(uint), header.column_count, 0))
|
||||||
return ER_DYNCOL_RESOURCE;
|
return ER_DYNCOL_RESOURCE;
|
||||||
|
|
||||||
for (i= 0, read= header.header;
|
for (i= 0, read= header.header;
|
||||||
@@ -2449,7 +2449,7 @@ dynamic_column_list(DYNAMIC_COLUMN *str, DYNAMIC_ARRAY *array_of_uint)
|
|||||||
{
|
{
|
||||||
uint nm= uint2korr(read);
|
uint nm= uint2korr(read);
|
||||||
/* Insert can't never fail as it's pre-allocated above */
|
/* Insert can't never fail as it's pre-allocated above */
|
||||||
(void) insert_dynamic(array_of_uint, (uchar *)&nm);
|
(void) ma_insert_dynamic(array_of_uint, (uchar *)&nm);
|
||||||
}
|
}
|
||||||
return ER_DYNCOL_OK;
|
return ER_DYNCOL_OK;
|
||||||
}
|
}
|
||||||
@@ -2484,7 +2484,7 @@ mariadb_dyncol_list_num(DYNAMIC_COLUMN *str, uint *count, uint **nums)
|
|||||||
str->length)
|
str->length)
|
||||||
return ER_DYNCOL_FORMAT;
|
return ER_DYNCOL_FORMAT;
|
||||||
|
|
||||||
if (!((*nums)= (uint *)my_malloc(sizeof(uint) * header.column_count, MYF(0))))
|
if (!((*nums)= (uint *)ma_malloc(sizeof(uint) * header.column_count, MYF(0))))
|
||||||
return ER_DYNCOL_RESOURCE;
|
return ER_DYNCOL_RESOURCE;
|
||||||
|
|
||||||
for (i= 0, read= header.header;
|
for (i= 0, read= header.header;
|
||||||
@@ -2532,10 +2532,10 @@ mariadb_dyncol_list_named(DYNAMIC_COLUMN *str, uint *count, LEX_STRING **names)
|
|||||||
return ER_DYNCOL_FORMAT;
|
return ER_DYNCOL_FORMAT;
|
||||||
|
|
||||||
if (header.format == dyncol_fmt_num)
|
if (header.format == dyncol_fmt_num)
|
||||||
*names= (LEX_STRING *)my_malloc(sizeof(LEX_STRING) * header.column_count +
|
*names= (LEX_STRING *)ma_malloc(sizeof(LEX_STRING) * header.column_count +
|
||||||
DYNCOL_NUM_CHAR * header.column_count, MYF(0));
|
DYNCOL_NUM_CHAR * header.column_count, MYF(0));
|
||||||
else
|
else
|
||||||
*names= (LEX_STRING *)my_malloc(sizeof(LEX_STRING) * header.column_count +
|
*names= (LEX_STRING *)ma_malloc(sizeof(LEX_STRING) * header.column_count +
|
||||||
header.nmpool_size + header.column_count, MYF(0));
|
header.nmpool_size + header.column_count, MYF(0));
|
||||||
if (!(*names))
|
if (!(*names))
|
||||||
return ER_DYNCOL_RESOURCE;
|
return ER_DYNCOL_RESOURCE;
|
||||||
@@ -3349,7 +3349,7 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str,
|
|||||||
if (IN_PLACE_PLAN > add_column_count)
|
if (IN_PLACE_PLAN > add_column_count)
|
||||||
plan= in_place_plan;
|
plan= in_place_plan;
|
||||||
else if (!(alloc_plan= plan=
|
else if (!(alloc_plan= plan=
|
||||||
(PLAN *)my_malloc(sizeof(PLAN) * (add_column_count + 1), MYF(0))))
|
(PLAN *)ma_malloc(sizeof(PLAN) * (add_column_count + 1), MYF(0))))
|
||||||
return ER_DYNCOL_RESOURCE;
|
return ER_DYNCOL_RESOURCE;
|
||||||
|
|
||||||
not_null= add_column_count;
|
not_null= add_column_count;
|
||||||
@@ -3606,13 +3606,13 @@ dynamic_column_update_many_fmt(DYNAMIC_COLUMN *str,
|
|||||||
&header, &new_header,
|
&header, &new_header,
|
||||||
convert);
|
convert);
|
||||||
end:
|
end:
|
||||||
my_free(alloc_plan);
|
ma_free(alloc_plan);
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
create_new_string:
|
create_new_string:
|
||||||
/* There is no columns from before, so let's just add the new ones */
|
/* There is no columns from before, so let's just add the new ones */
|
||||||
rc= ER_DYNCOL_OK;
|
rc= ER_DYNCOL_OK;
|
||||||
my_free(alloc_plan);
|
ma_free(alloc_plan);
|
||||||
if (not_null != 0)
|
if (not_null != 0)
|
||||||
rc= dynamic_column_create_many_internal_fmt(str, add_column_count,
|
rc= dynamic_column_create_many_internal_fmt(str, add_column_count,
|
||||||
(uint*)column_keys, values,
|
(uint*)column_keys, values,
|
||||||
@@ -3884,9 +3884,9 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
|
|||||||
if (!conv)
|
if (!conv)
|
||||||
{
|
{
|
||||||
#ifndef LIBMARIADB
|
#ifndef LIBMARIADB
|
||||||
uint dummy_errors;
|
uint dumma_errors;
|
||||||
#else
|
#else
|
||||||
int dummy_errors;
|
int dumma_errors;
|
||||||
#endif
|
#endif
|
||||||
if (!quote)
|
if (!quote)
|
||||||
{
|
{
|
||||||
@@ -3897,24 +3897,24 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
|
|||||||
cs,
|
cs,
|
||||||
from, (uint32)len,
|
from, (uint32)len,
|
||||||
val->x.string.charset,
|
val->x.string.charset,
|
||||||
&dummy_errors);
|
&dumma_errors);
|
||||||
#else
|
#else
|
||||||
mariadb_convert_string(from, &len, val->x.string.charset,
|
mariadb_convert_string(from, &len, val->x.string.charset,
|
||||||
str->str, (size_t *)&bufflen, cs, &dummy_errors);
|
str->str, (size_t *)&bufflen, cs, &dumma_errors);
|
||||||
#endif
|
#endif
|
||||||
return ER_DYNCOL_OK;
|
return ER_DYNCOL_OK;
|
||||||
}
|
}
|
||||||
if ((alloc= (char *)my_malloc(bufflen, MYF(0))))
|
if ((alloc= (char *)ma_malloc(bufflen, MYF(0))))
|
||||||
{
|
{
|
||||||
len=
|
len=
|
||||||
#ifndef LIBMARIADB
|
#ifndef LIBMARIADB
|
||||||
copy_and_convert_extended(alloc, bufflen, cs,
|
copy_and_convert_extended(alloc, bufflen, cs,
|
||||||
from, (uint32)len,
|
from, (uint32)len,
|
||||||
val->x.string.charset,
|
val->x.string.charset,
|
||||||
&dummy_errors);
|
&dumma_errors);
|
||||||
#else
|
#else
|
||||||
mariadb_convert_string(from, &len, val->x.string.charset,
|
mariadb_convert_string(from, &len, val->x.string.charset,
|
||||||
alloc, (size_t *)&bufflen, cs, &dummy_errors);
|
alloc, (size_t *)&bufflen, cs, &dumma_errors);
|
||||||
#endif
|
#endif
|
||||||
from= alloc;
|
from= alloc;
|
||||||
}
|
}
|
||||||
@@ -3927,7 +3927,7 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val,
|
|||||||
if (quote)
|
if (quote)
|
||||||
rc= dynstr_append_mem(str, "e, 1);
|
rc= dynstr_append_mem(str, "e, 1);
|
||||||
if (alloc)
|
if (alloc)
|
||||||
my_free(alloc);
|
ma_free(alloc);
|
||||||
if (rc)
|
if (rc)
|
||||||
return ER_DYNCOL_RESOURCE;
|
return ER_DYNCOL_RESOURCE;
|
||||||
break;
|
break;
|
||||||
@@ -4195,7 +4195,7 @@ mariadb_dyncol_json_internal(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json,
|
|||||||
if (dynstr_realloc(json, DYNCOL_NUM_CHAR + 3))
|
if (dynstr_realloc(json, DYNCOL_NUM_CHAR + 3))
|
||||||
goto err;
|
goto err;
|
||||||
json->str[json->length++]= '"';
|
json->str[json->length++]= '"';
|
||||||
json->length+= (my_snprintf(json->str + json->length,
|
json->length+= (ma_snprintf(json->str + json->length,
|
||||||
DYNCOL_NUM_CHAR, "%u", nm));
|
DYNCOL_NUM_CHAR, "%u", nm));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -4231,7 +4231,7 @@ mariadb_dyncol_json_internal(DYNAMIC_COLUMN *str, DYNAMIC_STRING *json,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((rc= mariadb_dyncol_val_str(json, &val,
|
if ((rc= mariadb_dyncol_val_str(json, &val,
|
||||||
my_charset_utf8_general_ci, '"')) < 0)
|
ma_charset_utf8_general_ci, '"')) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4291,16 +4291,16 @@ mariadb_dyncol_unpack(DYNAMIC_COLUMN *str,
|
|||||||
str->length)
|
str->length)
|
||||||
return ER_DYNCOL_FORMAT;
|
return ER_DYNCOL_FORMAT;
|
||||||
|
|
||||||
*vals= (DYNAMIC_COLUMN_VALUE *)my_malloc(sizeof(DYNAMIC_COLUMN_VALUE)* header.column_count, MYF(0));
|
*vals= (DYNAMIC_COLUMN_VALUE *)ma_malloc(sizeof(DYNAMIC_COLUMN_VALUE)* header.column_count, MYF(0));
|
||||||
if (header.format == dyncol_fmt_num)
|
if (header.format == dyncol_fmt_num)
|
||||||
{
|
{
|
||||||
*names= (LEX_STRING *)my_malloc(sizeof(LEX_STRING) * header.column_count +
|
*names= (LEX_STRING *)ma_malloc(sizeof(LEX_STRING) * header.column_count +
|
||||||
DYNCOL_NUM_CHAR * header.column_count, MYF(0));
|
DYNCOL_NUM_CHAR * header.column_count, MYF(0));
|
||||||
nm= (char *)(names + sizeof(LEX_STRING) * header.column_count);
|
nm= (char *)(names + sizeof(LEX_STRING) * header.column_count);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*names= (LEX_STRING *)my_malloc(sizeof(LEX_STRING) * header.column_count, MYF(0));
|
*names= (LEX_STRING *)ma_malloc(sizeof(LEX_STRING) * header.column_count, MYF(0));
|
||||||
nm= 0;
|
nm= 0;
|
||||||
}
|
}
|
||||||
if (!(*vals) || !(*names))
|
if (!(*vals) || !(*names))
|
||||||
@@ -4352,12 +4352,12 @@ mariadb_dyncol_unpack(DYNAMIC_COLUMN *str,
|
|||||||
err:
|
err:
|
||||||
if (*vals)
|
if (*vals)
|
||||||
{
|
{
|
||||||
my_free(*vals);
|
ma_free(*vals);
|
||||||
*vals= 0;
|
*vals= 0;
|
||||||
}
|
}
|
||||||
if (*names)
|
if (*names)
|
||||||
{
|
{
|
||||||
my_free(*names);
|
ma_free(*names);
|
||||||
*names= 0;
|
*names= 0;
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
|
@@ -74,7 +74,7 @@ MA_FILE *ma_open(const char *location, const char *mode, MYSQL *mysql)
|
|||||||
len= MultiByteToWideChar(CodePage, 0, location, (int)strlen(location), NULL, 0);
|
len= MultiByteToWideChar(CodePage, 0, location, (int)strlen(location), NULL, 0);
|
||||||
if (!len)
|
if (!len)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!(w_filename= (wchar_t *)my_malloc((len + 1) * sizeof(wchar_t), MYF(MY_ZEROFILL))))
|
if (!(w_filename= (wchar_t *)ma_malloc((len + 1) * sizeof(wchar_t), MYF(MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
my_set_error(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
my_set_error(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -84,14 +84,14 @@ MA_FILE *ma_open(const char *location, const char *mode, MYSQL *mysql)
|
|||||||
if (!len)
|
if (!len)
|
||||||
{
|
{
|
||||||
/* todo: error handling */
|
/* todo: error handling */
|
||||||
my_free(w_filename);
|
ma_free(w_filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
len= (int)strlen(mode);
|
len= (int)strlen(mode);
|
||||||
if (!(w_mode= (wchar_t *)my_malloc((len + 1) * sizeof(wchar_t), MYF(MY_ZEROFILL))))
|
if (!(w_mode= (wchar_t *)ma_malloc((len + 1) * sizeof(wchar_t), MYF(MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
my_set_error(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
my_set_error(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
my_free(w_filename);
|
ma_free(w_filename);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
Length= len;
|
Length= len;
|
||||||
@@ -99,20 +99,20 @@ MA_FILE *ma_open(const char *location, const char *mode, MYSQL *mysql)
|
|||||||
if (!len)
|
if (!len)
|
||||||
{
|
{
|
||||||
/* todo: error handling */
|
/* todo: error handling */
|
||||||
my_free(w_filename);
|
ma_free(w_filename);
|
||||||
my_free(w_mode);
|
ma_free(w_mode);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
fp= _wfopen(w_filename, w_mode);
|
fp= _wfopen(w_filename, w_mode);
|
||||||
my_errno= GetLastError();
|
my_errno= GetLastError();
|
||||||
my_free(w_filename);
|
ma_free(w_filename);
|
||||||
my_free(w_mode);
|
ma_free(w_mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
ma_file= (MA_FILE *)my_malloc(sizeof(MA_FILE), MYF(0));
|
ma_file= (MA_FILE *)ma_malloc(sizeof(MA_FILE), MYF(0));
|
||||||
if (!ma_file)
|
if (!ma_file)
|
||||||
{
|
{
|
||||||
my_set_error(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
my_set_error(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
@@ -147,7 +147,7 @@ int ma_close(MA_FILE *file)
|
|||||||
switch (file->type) {
|
switch (file->type) {
|
||||||
case MA_FILE_LOCAL:
|
case MA_FILE_LOCAL:
|
||||||
rc= fclose((FILE *)file->ptr);
|
rc= fclose((FILE *)file->ptr);
|
||||||
my_free(file);
|
ma_free(file);
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_REMOTEIO
|
#ifdef HAVE_REMOTEIO
|
||||||
case MA_FILE_REMOTE:
|
case MA_FILE_REMOTE:
|
||||||
|
@@ -104,7 +104,7 @@ MARIADB_PVIO *ma_pvio_init(MA_PVIO_CINFO *cinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(pvio= (MARIADB_PVIO *)my_malloc(sizeof(MARIADB_PVIO),
|
if (!(pvio= (MARIADB_PVIO *)ma_malloc(sizeof(MARIADB_PVIO),
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0);
|
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0);
|
||||||
@@ -124,7 +124,7 @@ MARIADB_PVIO *ma_pvio_init(MA_PVIO_CINFO *cinfo)
|
|||||||
pvio->methods->set_timeout(pvio, PVIO_WRITE_TIMEOUT, cinfo->mysql->options.write_timeout);
|
pvio->methods->set_timeout(pvio, PVIO_WRITE_TIMEOUT, cinfo->mysql->options.write_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pvio->cache= my_malloc(PVIO_READ_AHEAD_CACHE_SIZE, MYF(MY_ZEROFILL))))
|
if (!(pvio->cache= ma_malloc(PVIO_READ_AHEAD_CACHE_SIZE, MYF(MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0);
|
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -386,19 +386,19 @@ void ma_pvio_close(MARIADB_PVIO *pvio)
|
|||||||
if (pvio && pvio->cssl)
|
if (pvio && pvio->cssl)
|
||||||
{
|
{
|
||||||
ma_pvio_ssl_close(pvio->cssl);
|
ma_pvio_ssl_close(pvio->cssl);
|
||||||
my_free((gptr)pvio->cssl);
|
ma_free((gptr)pvio->cssl);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (pvio && pvio->methods->close)
|
if (pvio && pvio->methods->close)
|
||||||
pvio->methods->close(pvio);
|
pvio->methods->close(pvio);
|
||||||
|
|
||||||
if (pvio->cache)
|
if (pvio->cache)
|
||||||
my_free((gptr)pvio->cache);
|
ma_free((gptr)pvio->cache);
|
||||||
|
|
||||||
if (pvio->fp)
|
if (pvio->fp)
|
||||||
my_fclose(pvio->fp, MYF(0));
|
my_fclose(pvio->fp, MYF(0));
|
||||||
|
|
||||||
my_free((gptr)pvio);
|
ma_free((gptr)pvio);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
@@ -511,7 +511,7 @@ my_bool ma_pvio_start_ssl(MARIADB_PVIO *pvio)
|
|||||||
}
|
}
|
||||||
if (ma_pvio_ssl_connect(pvio->cssl))
|
if (ma_pvio_ssl_connect(pvio->cssl))
|
||||||
{
|
{
|
||||||
my_free(pvio->cssl);
|
ma_free(pvio->cssl);
|
||||||
pvio->cssl= NULL;
|
pvio->cssl= NULL;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ MARIADB_SSL *ma_pvio_ssl_init(MYSQL *mysql)
|
|||||||
if (!ma_ssl_initialized)
|
if (!ma_ssl_initialized)
|
||||||
ma_ssl_start(mysql->net.last_error, MYSQL_ERRMSG_SIZE);
|
ma_ssl_start(mysql->net.last_error, MYSQL_ERRMSG_SIZE);
|
||||||
|
|
||||||
if (!(cssl= (MARIADB_SSL *)my_malloc(sizeof(MARIADB_SSL),
|
if (!(cssl= (MARIADB_SSL *)ma_malloc(sizeof(MARIADB_SSL),
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -70,7 +70,7 @@ MARIADB_SSL *ma_pvio_ssl_init(MYSQL *mysql)
|
|||||||
cssl->pvio= mysql->net.pvio;
|
cssl->pvio= mysql->net.pvio;
|
||||||
if (!(cssl->ssl= ma_ssl_init(mysql)))
|
if (!(cssl->ssl= ma_ssl_init(mysql)))
|
||||||
{
|
{
|
||||||
my_free(cssl);
|
ma_free(cssl);
|
||||||
cssl= NULL;
|
cssl= NULL;
|
||||||
}
|
}
|
||||||
return cssl;
|
return cssl;
|
||||||
|
@@ -62,9 +62,9 @@ my_string fn_format(my_string to, const char *name, const char *dsk,
|
|||||||
convert_dirname(dev); /* Fix to this OS */
|
convert_dirname(dev); /* Fix to this OS */
|
||||||
}
|
}
|
||||||
if (flag & 8)
|
if (flag & 8)
|
||||||
pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
|
ma_pack_dirname(dev,dev); /* Put in ./.. and ~/.. */
|
||||||
if (flag & 4)
|
if (flag & 4)
|
||||||
(void) unpack_dirname(dev,dev); /* Replace ~/.. with dir */
|
(void) unma_pack_dirname(dev,dev); /* Replace ~/.. with dir */
|
||||||
if ((pos=(char*)strchr(name,FN_EXTCHAR)) != NullS)
|
if ((pos=(char*)strchr(name,FN_EXTCHAR)) != NullS)
|
||||||
{
|
{
|
||||||
if ((flag & 2) == 0) /* Skall vi byta extension ? */
|
if ((flag & 2) == 0) /* Skall vi byta extension ? */
|
||||||
|
@@ -32,15 +32,15 @@ static my_string NEAR_F expand_tilde(my_string *path);
|
|||||||
/* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
|
/* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
|
||||||
/* to may be == from */
|
/* to may be == from */
|
||||||
|
|
||||||
void pack_dirname(my_string to, const char *from)
|
void ma_pack_dirname(my_string to, const char *from)
|
||||||
{
|
{
|
||||||
int cwd_err;
|
int cwd_err;
|
||||||
uint d_length,length,buff_length= 0;
|
uint d_length,length,buff_length= 0;
|
||||||
my_string start;
|
my_string start;
|
||||||
char buff[FN_REFLEN];
|
char buff[FN_REFLEN];
|
||||||
DBUG_ENTER("pack_dirname");
|
DBUG_ENTER("ma_pack_dirname");
|
||||||
|
|
||||||
(void) intern_filename(to,from); /* Change to intern name */
|
(void) ma_intern_filename(to,from); /* Change to intern name */
|
||||||
|
|
||||||
#ifdef FN_DEVCHAR
|
#ifdef FN_DEVCHAR
|
||||||
if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skipp device part */
|
if ((start=strrchr(to,FN_DEVCHAR)) != 0) /* Skipp device part */
|
||||||
@@ -62,18 +62,18 @@ void pack_dirname(my_string to, const char *from)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((d_length= cleanup_dirname(to,to)) != 0)
|
if ((d_length= ma_cleanup_dirname(to,to)) != 0)
|
||||||
{
|
{
|
||||||
length=0;
|
length=0;
|
||||||
if (home_dir)
|
if (ma_ma_ma_home_dir)
|
||||||
{
|
{
|
||||||
length= (uint) strlen(home_dir);
|
length= (uint) strlen(ma_ma_ma_home_dir);
|
||||||
if (home_dir[length-1] == FN_LIBCHAR)
|
if (ma_ma_ma_home_dir[length-1] == FN_LIBCHAR)
|
||||||
length--; /* Don't test last '/' */
|
length--; /* Don't test last '/' */
|
||||||
}
|
}
|
||||||
if (length > 1 && length < d_length)
|
if (length > 1 && length < d_length)
|
||||||
{ /* test if /xx/yy -> ~/yy */
|
{ /* test if /xx/yy -> ~/yy */
|
||||||
if (bcmp(to,home_dir,length) == 0 && to[length] == FN_LIBCHAR)
|
if (bcmp(to,ma_ma_ma_home_dir,length) == 0 && to[length] == FN_LIBCHAR)
|
||||||
{
|
{
|
||||||
to[0]=FN_HOMELIB; /* Filename begins with ~ */
|
to[0]=FN_HOMELIB; /* Filename begins with ~ */
|
||||||
(void) strmov_overlapp(to+1,to+length);
|
(void) strmov_overlapp(to+1,to+length);
|
||||||
@@ -83,7 +83,7 @@ void pack_dirname(my_string to, const char *from)
|
|||||||
{ /* Test if cwd is ~/... */
|
{ /* Test if cwd is ~/... */
|
||||||
if (length > 1 && length < buff_length)
|
if (length > 1 && length < buff_length)
|
||||||
{
|
{
|
||||||
if (bcmp(buff,home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
|
if (bcmp(buff,ma_ma_ma_home_dir,length) == 0 && buff[length] == FN_LIBCHAR)
|
||||||
{
|
{
|
||||||
buff[0]=FN_HOMELIB;
|
buff[0]=FN_HOMELIB;
|
||||||
(void) strmov_overlapp(buff+1,buff+length);
|
(void) strmov_overlapp(buff+1,buff+length);
|
||||||
@@ -105,17 +105,17 @@ void pack_dirname(my_string to, const char *from)
|
|||||||
}
|
}
|
||||||
DBUG_PRINT("exit",("to: '%s'",to));
|
DBUG_PRINT("exit",("to: '%s'",to));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
} /* pack_dirname */
|
} /* ma_pack_dirname */
|
||||||
|
|
||||||
|
|
||||||
/* remove unwanted chars from dirname */
|
/* remove unwanted chars from dirname */
|
||||||
/* if "/../" removes prev dir; "/~/" removes all before ~ */
|
/* if "/../" removes prev dir; "/~/" removes all before ~ */
|
||||||
/* "//" is same as "/", except on Win32 at start of a file */
|
/* "//" is same as "/", except on Win32 at start of a file */
|
||||||
/* "/./" is removed */
|
/* "/./" is removed */
|
||||||
/* Unpacks home_dir if "~/.." used */
|
/* Unpacks ma_ma_ma_home_dir if "~/.." used */
|
||||||
/* Unpacks current dir if if "./.." used */
|
/* Unpacks current dir if if "./.." used */
|
||||||
|
|
||||||
uint cleanup_dirname(register my_string to, const char *from)
|
uint ma_cleanup_dirname(register my_string to, const char *from)
|
||||||
/* to may be == from */
|
/* to may be == from */
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -125,7 +125,7 @@ uint cleanup_dirname(register my_string to, const char *from)
|
|||||||
reg4 my_string start;
|
reg4 my_string start;
|
||||||
char parent[5], /* for "FN_PARENTDIR" */
|
char parent[5], /* for "FN_PARENTDIR" */
|
||||||
buff[FN_REFLEN+1],*end_parentdir;
|
buff[FN_REFLEN+1],*end_parentdir;
|
||||||
DBUG_ENTER("cleanup_dirname");
|
DBUG_ENTER("ma_cleanup_dirname");
|
||||||
DBUG_PRINT("enter",("from: '%s'",from));
|
DBUG_PRINT("enter",("from: '%s'",from));
|
||||||
|
|
||||||
start=buff;
|
start=buff;
|
||||||
@@ -154,23 +154,23 @@ uint cleanup_dirname(register my_string to, const char *from)
|
|||||||
pos--;
|
pos--;
|
||||||
if (*pos == FN_HOMELIB && (pos == start || pos[-1] == FN_LIBCHAR))
|
if (*pos == FN_HOMELIB && (pos == start || pos[-1] == FN_LIBCHAR))
|
||||||
{
|
{
|
||||||
if (!home_dir)
|
if (!ma_ma_ma_home_dir)
|
||||||
{
|
{
|
||||||
pos+=length+1; /* Don't unpack ~/.. */
|
pos+=length+1; /* Don't unpack ~/.. */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pos=strmov(buff,home_dir)-1; /* Unpacks ~/.. */
|
pos=strmov(buff,ma_ma_ma_home_dir)-1; /* Unpacks ~/.. */
|
||||||
if (*pos == FN_LIBCHAR)
|
if (*pos == FN_LIBCHAR)
|
||||||
pos--; /* home ended with '/' */
|
pos--; /* home ended with '/' */
|
||||||
}
|
}
|
||||||
if (*pos == FN_CURLIB && (pos == start || pos[-1] == FN_LIBCHAR))
|
if (*pos == FN_CURLIB && (pos == start || pos[-1] == FN_LIBCHAR))
|
||||||
{
|
{
|
||||||
if (my_getwd(curr_dir,FN_REFLEN,MYF(0)))
|
if (my_getwd(ma_cur_dir,FN_REFLEN,MYF(0)))
|
||||||
{
|
{
|
||||||
pos+=length+1; /* Don't unpack ./.. */
|
pos+=length+1; /* Don't unpack ./.. */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pos=strmov(buff,curr_dir)-1; /* Unpacks ./.. */
|
pos=strmov(buff,ma_cur_dir)-1; /* Unpacks ./.. */
|
||||||
if (*pos == FN_LIBCHAR)
|
if (*pos == FN_LIBCHAR)
|
||||||
pos--; /* home ended with '/' */
|
pos--; /* home ended with '/' */
|
||||||
}
|
}
|
||||||
@@ -208,7 +208,7 @@ uint cleanup_dirname(register my_string to, const char *from)
|
|||||||
(void) strmov(to,buff);
|
(void) strmov(to,buff);
|
||||||
DBUG_PRINT("exit",("to: '%s'",to));
|
DBUG_PRINT("exit",("to: '%s'",to));
|
||||||
DBUG_RETURN((uint) (pos-buff));
|
DBUG_RETURN((uint) (pos-buff));
|
||||||
} /* cleanup_dirname */
|
} /* ma_cleanup_dirname */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -220,7 +220,7 @@ uint cleanup_dirname(register my_string to, const char *from)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
my_bool my_use_symdir=0; /* Set this if you want to use symdirs */
|
my_bool ma_use_symdir=0; /* Set this if you want to use symdirs */
|
||||||
|
|
||||||
#ifdef USE_SYMDIR
|
#ifdef USE_SYMDIR
|
||||||
void symdirget(char *dir)
|
void symdirget(char *dir)
|
||||||
@@ -257,18 +257,18 @@ void symdirget(char *dir)
|
|||||||
/* Unpacks dirname to name that can be used by open... */
|
/* Unpacks dirname to name that can be used by open... */
|
||||||
/* Make that last char of to is '/' if from not empty and
|
/* Make that last char of to is '/' if from not empty and
|
||||||
from doesn't end in FN_DEVCHAR */
|
from doesn't end in FN_DEVCHAR */
|
||||||
/* Uses cleanup_dirname and changes ~/.. to home_dir/.. */
|
/* Uses ma_cleanup_dirname and changes ~/.. to ma_ma_ma_home_dir/.. */
|
||||||
/* Returns length of new directory */
|
/* Returns length of new directory */
|
||||||
|
|
||||||
uint unpack_dirname(my_string to, const char *from)
|
uint unma_pack_dirname(my_string to, const char *from)
|
||||||
|
|
||||||
/* to may be == from */
|
/* to may be == from */
|
||||||
{
|
{
|
||||||
uint length,h_length;
|
uint length,h_length;
|
||||||
char buff[FN_REFLEN+1+4],*suffix,*tilde_expansion;
|
char buff[FN_REFLEN+1+4],*suffix,*tilde_expansion;
|
||||||
DBUG_ENTER("unpack_dirname");
|
DBUG_ENTER("unma_pack_dirname");
|
||||||
|
|
||||||
(void) intern_filename(buff,from); /* Change to intern name */
|
(void) ma_intern_filename(buff,from); /* Change to intern name */
|
||||||
length= (uint) strlen(buff); /* Fix that '/' is last */
|
length= (uint) strlen(buff); /* Fix that '/' is last */
|
||||||
if (length &&
|
if (length &&
|
||||||
#ifdef FN_DEVCHAR
|
#ifdef FN_DEVCHAR
|
||||||
@@ -280,7 +280,7 @@ uint unpack_dirname(my_string to, const char *from)
|
|||||||
buff[length+1]= '\0';
|
buff[length+1]= '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
length=cleanup_dirname(buff,buff);
|
length=ma_cleanup_dirname(buff,buff);
|
||||||
if (buff[0] == FN_HOMELIB)
|
if (buff[0] == FN_HOMELIB)
|
||||||
{
|
{
|
||||||
suffix=buff+1; tilde_expansion=expand_tilde(&suffix);
|
suffix=buff+1; tilde_expansion=expand_tilde(&suffix);
|
||||||
@@ -300,11 +300,11 @@ uint unpack_dirname(my_string to, const char *from)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef USE_SYMDIR
|
#ifdef USE_SYMDIR
|
||||||
if (my_use_symdir)
|
if (ma_use_symdir)
|
||||||
symdirget(buff);
|
symdirget(buff);
|
||||||
#endif
|
#endif
|
||||||
DBUG_RETURN(system_filename(to,buff)); /* Fix for open */
|
DBUG_RETURN(ma_system_filename(to,buff)); /* Fix for open */
|
||||||
} /* unpack_dirname */
|
} /* unma_pack_dirname */
|
||||||
|
|
||||||
|
|
||||||
/* Expand tilde to home or user-directory */
|
/* Expand tilde to home or user-directory */
|
||||||
@@ -313,7 +313,7 @@ uint unpack_dirname(my_string to, const char *from)
|
|||||||
static my_string NEAR_F expand_tilde(my_string *path)
|
static my_string NEAR_F expand_tilde(my_string *path)
|
||||||
{
|
{
|
||||||
if (path[0][0] == FN_LIBCHAR)
|
if (path[0][0] == FN_LIBCHAR)
|
||||||
return home_dir; /* ~/ expanded to home */
|
return ma_ma_ma_home_dir; /* ~/ expanded to home */
|
||||||
#ifdef HAVE_GETPWNAM
|
#ifdef HAVE_GETPWNAM
|
||||||
{
|
{
|
||||||
char *str,save;
|
char *str,save;
|
||||||
@@ -339,30 +339,30 @@ static my_string NEAR_F expand_tilde(my_string *path)
|
|||||||
/* to may be == from */
|
/* to may be == from */
|
||||||
/* Returns to */
|
/* Returns to */
|
||||||
|
|
||||||
my_string unpack_filename(my_string to, const char *from)
|
my_string ma_unpack_filename(my_string to, const char *from)
|
||||||
{
|
{
|
||||||
uint length,n_length;
|
uint length,n_length;
|
||||||
char buff[FN_REFLEN];
|
char buff[FN_REFLEN];
|
||||||
DBUG_ENTER("unpack_filename");
|
DBUG_ENTER("ma_unpack_filename");
|
||||||
|
|
||||||
length=dirname_part(buff,from); /* copy & convert dirname */
|
length=dirname_part(buff,from); /* copy & convert dirname */
|
||||||
n_length=unpack_dirname(buff,buff);
|
n_length=unma_pack_dirname(buff,buff);
|
||||||
if (n_length+strlen(from+length) < FN_REFLEN)
|
if (n_length+strlen(from+length) < FN_REFLEN)
|
||||||
{
|
{
|
||||||
(void) strmov(buff+n_length,from+length);
|
(void) strmov(buff+n_length,from+length);
|
||||||
(void) system_filename(to,buff); /* Fix to usably filename */
|
(void) ma_system_filename(to,buff); /* Fix to usably filename */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
(void) system_filename(to,from); /* Fix to usably filename */
|
(void) ma_system_filename(to,from); /* Fix to usably filename */
|
||||||
DBUG_RETURN(to);
|
DBUG_RETURN(to);
|
||||||
} /* unpack_filename */
|
} /* ma_unpack_filename */
|
||||||
|
|
||||||
|
|
||||||
/* Convert filename (unix standard) to system standard */
|
/* Convert filename (unix standard) to system standard */
|
||||||
/* Used before system command's like open(), create() .. */
|
/* Used before system command's like open(), create() .. */
|
||||||
/* Returns to */
|
/* Returns to */
|
||||||
|
|
||||||
uint system_filename(my_string to, const char *from)
|
uint ma_system_filename(my_string to, const char *from)
|
||||||
{
|
{
|
||||||
#ifndef FN_C_BEFORE_DIR
|
#ifndef FN_C_BEFORE_DIR
|
||||||
return (uint) (strmake(to,from,FN_REFLEN-1)-to);
|
return (uint) (strmake(to,from,FN_REFLEN-1)-to);
|
||||||
@@ -378,7 +378,7 @@ uint system_filename(my_string to, const char *from)
|
|||||||
int libchar_found,length;
|
int libchar_found,length;
|
||||||
my_string to_pos,from_pos,pos;
|
my_string to_pos,from_pos,pos;
|
||||||
char buff[FN_REFLEN];
|
char buff[FN_REFLEN];
|
||||||
DBUG_ENTER("system_filename");
|
DBUG_ENTER("ma_system_filename");
|
||||||
|
|
||||||
libchar_found=0;
|
libchar_found=0;
|
||||||
(void) strmov(buff,from); /* If to == from */
|
(void) strmov(buff,from); /* If to == from */
|
||||||
@@ -426,12 +426,12 @@ uint system_filename(my_string to, const char *from)
|
|||||||
DBUG_PRINT("exit",("name: '%s'",to));
|
DBUG_PRINT("exit",("name: '%s'",to));
|
||||||
DBUG_RETURN((uint) length);
|
DBUG_RETURN((uint) length);
|
||||||
#endif
|
#endif
|
||||||
} /* system_filename */
|
} /* ma_system_filename */
|
||||||
|
|
||||||
|
|
||||||
/* Fix a filename to intern (UNIX format) */
|
/* Fix a filename to intern (UNIX format) */
|
||||||
|
|
||||||
my_string intern_filename(my_string to, const char *from)
|
my_string ma_intern_filename(my_string to, const char *from)
|
||||||
{
|
{
|
||||||
#ifndef VMS
|
#ifndef VMS
|
||||||
{
|
{
|
||||||
@@ -529,4 +529,4 @@ my_string intern_filename(my_string to, const char *from)
|
|||||||
(void) strmov(to_pos,from_pos);
|
(void) strmov(to_pos,from_pos);
|
||||||
return (to);
|
return (to);
|
||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
} /* intern_filename */
|
} /* ma_intern_filename */
|
||||||
|
@@ -42,11 +42,11 @@ my_string my_path(my_string to, const char *progname,
|
|||||||
find_file_in_path(to,progname) ||
|
find_file_in_path(to,progname) ||
|
||||||
((prog=getenv("_")) != 0 && dirname_part(to,prog))))
|
((prog=getenv("_")) != 0 && dirname_part(to,prog))))
|
||||||
{
|
{
|
||||||
VOID(intern_filename(to,to));
|
VOID(ma_intern_filename(to,to));
|
||||||
if (!test_if_hard_path(to))
|
if (!test_if_hard_path(to))
|
||||||
{
|
{
|
||||||
if (!my_getwd(curr_dir,FN_REFLEN,MYF(0)))
|
if (!my_getwd(ma_cur_dir,FN_REFLEN,MYF(0)))
|
||||||
bchange(to,0,curr_dir, (uint) strlen(curr_dir), (uint) strlen(to)+1);
|
bchange(to,0,ma_cur_dir, (uint) strlen(ma_cur_dir), (uint) strlen(to)+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -60,7 +60,7 @@ my_string my_path(my_string to, const char *progname,
|
|||||||
end= (char*) "/my/";
|
end= (char*) "/my/";
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
VOID(intern_filename(to,end));
|
VOID(ma_intern_filename(to,end));
|
||||||
to=strend(to);
|
to=strend(to);
|
||||||
if (to != start && to[-1] != FN_LIBCHAR)
|
if (to != start && to[-1] != FN_LIBCHAR)
|
||||||
*to++ = FN_LIBCHAR;
|
*to++ = FN_LIBCHAR;
|
||||||
|
@@ -37,7 +37,7 @@ gptr my_multi_malloc(myf myFlags, ...)
|
|||||||
}
|
}
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
if (!(start=(char *) my_malloc(tot_length,myFlags)))
|
if (!(start=(char *) ma_malloc(tot_length,myFlags)))
|
||||||
DBUG_RETURN(0); /* purecov: inspected */
|
DBUG_RETURN(0); /* purecov: inspected */
|
||||||
|
|
||||||
va_start(args,myFlags);
|
va_start(args,myFlags);
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
|
|
||||||
void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size)
|
void ma_init_ma_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size)
|
||||||
{
|
{
|
||||||
mem_root->free=mem_root->used=0;
|
mem_root->free=mem_root->used=0;
|
||||||
mem_root->min_malloc=32;
|
mem_root->min_malloc=32;
|
||||||
@@ -31,7 +31,7 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_siz
|
|||||||
if (pre_alloc_size)
|
if (pre_alloc_size)
|
||||||
{
|
{
|
||||||
if ((mem_root->free = mem_root->pre_alloc=
|
if ((mem_root->free = mem_root->pre_alloc=
|
||||||
(USED_MEM*) my_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(USED_MEM)),
|
(USED_MEM*) ma_malloc(pre_alloc_size+ ALIGN_SIZE(sizeof(USED_MEM)),
|
||||||
MYF(0))))
|
MYF(0))))
|
||||||
{
|
{
|
||||||
mem_root->free->size=pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM));
|
mem_root->free->size=pre_alloc_size+ALIGN_SIZE(sizeof(USED_MEM));
|
||||||
@@ -42,13 +42,13 @@ void init_alloc_root(MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_siz
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
gptr alloc_root(MEM_ROOT *mem_root, size_t Size)
|
gptr ma_alloc_root(MEM_ROOT *mem_root, size_t Size)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_purify) && defined(EXTRA_DEBUG)
|
#if defined(HAVE_purify) && defined(EXTRA_DEBUG)
|
||||||
reg1 USED_MEM *next;
|
reg1 USED_MEM *next;
|
||||||
Size+=ALIGN_SIZE(sizeof(USED_MEM));
|
Size+=ALIGN_SIZE(sizeof(USED_MEM));
|
||||||
|
|
||||||
if (!(next = (USED_MEM*) my_malloc(Size,MYF(MY_WME))))
|
if (!(next = (USED_MEM*) ma_malloc(Size,MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
if (mem_root->error_handler)
|
if (mem_root->error_handler)
|
||||||
(*mem_root->error_handler)();
|
(*mem_root->error_handler)();
|
||||||
@@ -78,7 +78,7 @@ gptr alloc_root(MEM_ROOT *mem_root, size_t Size)
|
|||||||
if (max_left*4 < mem_root->block_size && get_size < mem_root->block_size)
|
if (max_left*4 < mem_root->block_size && get_size < mem_root->block_size)
|
||||||
get_size=mem_root->block_size; /* Normal alloc */
|
get_size=mem_root->block_size; /* Normal alloc */
|
||||||
|
|
||||||
if (!(next = (USED_MEM*) my_malloc(get_size,MYF(MY_WME | MY_ZEROFILL))))
|
if (!(next = (USED_MEM*) ma_malloc(get_size,MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
if (mem_root->error_handler)
|
if (mem_root->error_handler)
|
||||||
(*mem_root->error_handler)();
|
(*mem_root->error_handler)();
|
||||||
@@ -100,12 +100,12 @@ gptr alloc_root(MEM_ROOT *mem_root, size_t Size)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deallocate everything used by alloc_root */
|
/* deallocate everything used by ma_alloc_root */
|
||||||
|
|
||||||
void free_root(MEM_ROOT *root, myf MyFlags)
|
void ma_free_root(MEM_ROOT *root, myf MyFlags)
|
||||||
{
|
{
|
||||||
reg1 USED_MEM *next,*old;
|
reg1 USED_MEM *next,*old;
|
||||||
DBUG_ENTER("free_root");
|
DBUG_ENTER("ma_free_root");
|
||||||
|
|
||||||
if (!root)
|
if (!root)
|
||||||
DBUG_VOID_RETURN; /* purecov: inspected */
|
DBUG_VOID_RETURN; /* purecov: inspected */
|
||||||
@@ -116,13 +116,13 @@ void free_root(MEM_ROOT *root, myf MyFlags)
|
|||||||
{
|
{
|
||||||
old=next; next= next->next ;
|
old=next; next= next->next ;
|
||||||
if (old != root->pre_alloc)
|
if (old != root->pre_alloc)
|
||||||
my_free(old);
|
ma_free(old);
|
||||||
}
|
}
|
||||||
for (next= root->free ; next ; )
|
for (next= root->free ; next ; )
|
||||||
{
|
{
|
||||||
old=next; next= next->next ;
|
old=next; next= next->next ;
|
||||||
if (old != root->pre_alloc)
|
if (old != root->pre_alloc)
|
||||||
my_free(old);
|
ma_free(old);
|
||||||
}
|
}
|
||||||
root->used=root->free=0;
|
root->used=root->free=0;
|
||||||
if (root->pre_alloc)
|
if (root->pre_alloc)
|
||||||
@@ -135,21 +135,21 @@ void free_root(MEM_ROOT *root, myf MyFlags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *strdup_root(MEM_ROOT *root,const char *str)
|
char *ma_strdup_root(MEM_ROOT *root,const char *str)
|
||||||
{
|
{
|
||||||
size_t len= strlen(str)+1;
|
size_t len= strlen(str)+1;
|
||||||
char *pos;
|
char *pos;
|
||||||
if ((pos=alloc_root(root,len)))
|
if ((pos=ma_alloc_root(root,len)))
|
||||||
memcpy(pos,str,len);
|
memcpy(pos,str,len);
|
||||||
pos[len]= 0;
|
pos[len]= 0;
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *memdup_root(MEM_ROOT *root, const char *str, size_t len)
|
char *ma_memdup_root(MEM_ROOT *root, const char *str, size_t len)
|
||||||
{
|
{
|
||||||
char *pos;
|
char *pos;
|
||||||
if ((pos=alloc_root(root,len)))
|
if ((pos=ma_alloc_root(root,len)))
|
||||||
memcpy(pos,str,len);
|
memcpy(pos,str,len);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
|
||||||
extern int my_snprintf(char* to, size_t n, const char* fmt, ...);
|
extern int ma_snprintf(char* to, size_t n, const char* fmt, ...);
|
||||||
/*
|
/*
|
||||||
+----------------------------------------------------------------------+
|
+----------------------------------------------------------------------+
|
||||||
| PHP Version 5 |
|
| PHP Version 5 |
|
||||||
@@ -1086,7 +1086,7 @@ char *madb_get_os_character_set()
|
|||||||
char *p= NULL;
|
char *p= NULL;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char codepage[FN_REFLEN];
|
char codepage[FN_REFLEN];
|
||||||
my_snprintf(codepage, FN_REFLEN, "%u", GetConsoleWindow() ?
|
ma_snprintf(codepage, FN_REFLEN, "%u", GetConsoleWindow() ?
|
||||||
GetConsoleCP() : GetACP());
|
GetConsoleCP() : GetACP());
|
||||||
p= codepage;
|
p= codepage;
|
||||||
#elif defined(HAVE_NL_LANGINFO) && defined(HAVE_SETLOCALE)
|
#elif defined(HAVE_NL_LANGINFO) && defined(HAVE_SETLOCALE)
|
||||||
|
@@ -39,7 +39,7 @@ my_bool my_compress(unsigned char *packet, size_t *len, size_t *complen)
|
|||||||
if (!compbuf)
|
if (!compbuf)
|
||||||
return *complen ? 0 : 1;
|
return *complen ? 0 : 1;
|
||||||
memcpy(packet,compbuf,*len);
|
memcpy(packet,compbuf,*len);
|
||||||
my_free(compbuf);
|
ma_free(compbuf);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -49,18 +49,18 @@ unsigned char *my_compress_alloc(const unsigned char *packet, size_t *len, size_
|
|||||||
{
|
{
|
||||||
unsigned char *compbuf;
|
unsigned char *compbuf;
|
||||||
*complen = *len * 120 / 100 + 12;
|
*complen = *len * 120 / 100 + 12;
|
||||||
if (!(compbuf = (unsigned char *) my_malloc(*complen,MYF(MY_WME))))
|
if (!(compbuf = (unsigned char *) ma_malloc(*complen,MYF(MY_WME))))
|
||||||
return 0; /* Not enough memory */
|
return 0; /* Not enough memory */
|
||||||
if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet,
|
if (compress((Bytef*) compbuf,(ulong *) complen, (Bytef*) packet,
|
||||||
(uLong) *len ) != Z_OK)
|
(uLong) *len ) != Z_OK)
|
||||||
{
|
{
|
||||||
my_free(compbuf);
|
ma_free(compbuf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (*complen >= *len)
|
if (*complen >= *len)
|
||||||
{
|
{
|
||||||
*complen=0;
|
*complen=0;
|
||||||
my_free(compbuf);
|
ma_free(compbuf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
swap(size_t,*len,*complen); /* *len is now packet length */
|
swap(size_t,*len,*complen); /* *len is now packet length */
|
||||||
@@ -71,17 +71,17 @@ my_bool my_uncompress (unsigned char *packet, size_t *len, size_t *complen)
|
|||||||
{
|
{
|
||||||
if (*complen) /* If compressed */
|
if (*complen) /* If compressed */
|
||||||
{
|
{
|
||||||
unsigned char *compbuf = (unsigned char *) my_malloc (*complen,MYF(MY_WME));
|
unsigned char *compbuf = (unsigned char *) ma_malloc (*complen,MYF(MY_WME));
|
||||||
if (!compbuf)
|
if (!compbuf)
|
||||||
return 1; /* Not enough memory */
|
return 1; /* Not enough memory */
|
||||||
if (uncompress((Bytef*) compbuf, (uLongf *)complen, (Bytef*) packet, (uLongf)*len) != Z_OK)
|
if (uncompress((Bytef*) compbuf, (uLongf *)complen, (Bytef*) packet, (uLongf)*len) != Z_OK)
|
||||||
{ /* Probably wrong packet */
|
{ /* Probably wrong packet */
|
||||||
my_free (compbuf);
|
ma_free (compbuf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*len = *complen;
|
*len = *complen;
|
||||||
memcpy(packet,compbuf,*len);
|
memcpy(packet,compbuf,*len);
|
||||||
my_free(compbuf);
|
ma_free(compbuf);
|
||||||
}
|
}
|
||||||
else *complen= *len;
|
else *complen= *len;
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -22,9 +22,9 @@ my_string my_filename(File fd)
|
|||||||
DBUG_ENTER("my_filename");
|
DBUG_ENTER("my_filename");
|
||||||
if (fd >= MY_NFILE)
|
if (fd >= MY_NFILE)
|
||||||
DBUG_RETURN((char*) "UNKNOWN");
|
DBUG_RETURN((char*) "UNKNOWN");
|
||||||
if (fd >= 0 && my_file_info[fd].type != UNOPEN)
|
if (fd >= 0 && ma_file_info[fd].type != UNOPEN)
|
||||||
{
|
{
|
||||||
DBUG_RETURN(my_file_info[fd].name);
|
DBUG_RETURN(ma_file_info[fd].name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
DBUG_RETURN((char*) "UNOPENED"); /* Debug message */
|
DBUG_RETURN((char*) "UNOPENED"); /* Debug message */
|
||||||
|
@@ -29,7 +29,7 @@ char NEAR errbuff[NRERRBUFFS][ERRMSGSIZE];
|
|||||||
/* Error message to user */
|
/* Error message to user */
|
||||||
/*VARARGS2*/
|
/*VARARGS2*/
|
||||||
|
|
||||||
int my_error(int nr,myf MyFlags, ...)
|
int ma_error(int nr,myf MyFlags, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
uint olen, plen;
|
uint olen, plen;
|
||||||
@@ -37,13 +37,13 @@ int my_error(int nr,myf MyFlags, ...)
|
|||||||
reg2 char *endpos;
|
reg2 char *endpos;
|
||||||
char * par;
|
char * par;
|
||||||
char ebuff[ERRMSGSIZE+20];
|
char ebuff[ERRMSGSIZE+20];
|
||||||
DBUG_ENTER("my_error");
|
DBUG_ENTER("ma_error");
|
||||||
|
|
||||||
va_start(ap,MyFlags);
|
va_start(ap,MyFlags);
|
||||||
DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
|
DBUG_PRINT("my", ("nr: %d MyFlags: %d errno: %d", nr, MyFlags, errno));
|
||||||
|
|
||||||
if (nr / ERRMOD == GLOB && my_errmsg[GLOB] == 0)
|
if (nr / ERRMOD == GLOB && my_errmsg[GLOB] == 0)
|
||||||
init_glob_errs();
|
ma_init_glob_errs();
|
||||||
|
|
||||||
olen=(uint) strlen(tpos=my_errmsg[nr / ERRMOD][nr % ERRMOD - EE_FIRSTERROR]);
|
olen=(uint) strlen(tpos=my_errmsg[nr / ERRMOD][nr % ERRMOD - EE_FIRSTERROR]);
|
||||||
endpos=ebuff;
|
endpos=ebuff;
|
||||||
@@ -100,12 +100,12 @@ int my_error(int nr,myf MyFlags, ...)
|
|||||||
}
|
}
|
||||||
*endpos='\0'; /* End of errmessage */
|
*endpos='\0'; /* End of errmessage */
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
DBUG_RETURN((*error_handler_hook)(nr, ebuff, MyFlags));
|
DBUG_RETURN((*ma_error_handler_hook)(nr, ebuff, MyFlags));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Error as printf */
|
/* Error as printf */
|
||||||
|
|
||||||
int my_printf_error (uint error, const char *format, myf MyFlags, ...)
|
int ma_printf_error (uint error, const char *format, myf MyFlags, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char ebuff[ERRMSGSIZE+20];
|
char ebuff[ERRMSGSIZE+20];
|
||||||
@@ -113,12 +113,12 @@ int my_printf_error (uint error, const char *format, myf MyFlags, ...)
|
|||||||
va_start(args,MyFlags);
|
va_start(args,MyFlags);
|
||||||
(void) vsprintf (ebuff,format,args);
|
(void) vsprintf (ebuff,format,args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return (*error_handler_hook)(error, ebuff, MyFlags);
|
return (*ma_error_handler_hook)(error, ebuff, MyFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Give message using error_handler_hook */
|
/* Give message using ma_error_handler_hook */
|
||||||
|
|
||||||
int my_message(uint error, const char *str, register myf MyFlags)
|
int ma_message(uint error, const char *str, register myf MyFlags)
|
||||||
{
|
{
|
||||||
return (*error_handler_hook)(error, str, MyFlags);
|
return (*ma_error_handler_hook)(error, str, MyFlags);
|
||||||
}
|
}
|
||||||
|
@@ -49,15 +49,15 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags)
|
|||||||
*/
|
*/
|
||||||
if ((uint) fileno(fd) >= MY_NFILE)
|
if ((uint) fileno(fd) >= MY_NFILE)
|
||||||
{
|
{
|
||||||
thread_safe_increment(my_stream_opened,&THR_LOCK_open);
|
thread_safe_increment(ma_stream_opened,&THR_LOCK_open);
|
||||||
DBUG_RETURN(fd); /* safeguard */
|
DBUG_RETURN(fd); /* safeguard */
|
||||||
}
|
}
|
||||||
pthread_mutex_lock(&THR_LOCK_open);
|
pthread_mutex_lock(&THR_LOCK_open);
|
||||||
if ((my_file_info[fileno(fd)].name = (char*)
|
if ((ma_file_info[fileno(fd)].name = (char*)
|
||||||
my_strdup(FileName,MyFlags)))
|
ma_strdup(FileName,MyFlags)))
|
||||||
{
|
{
|
||||||
my_stream_opened++;
|
ma_stream_opened++;
|
||||||
my_file_info[fileno(fd)].type = STREAM_BY_FOPEN;
|
ma_file_info[fileno(fd)].type = STREAM_BY_FOPEN;
|
||||||
pthread_mutex_unlock(&THR_LOCK_open);
|
pthread_mutex_unlock(&THR_LOCK_open);
|
||||||
DBUG_PRINT("exit",("stream: %lx",fd));
|
DBUG_PRINT("exit",("stream: %lx",fd));
|
||||||
DBUG_RETURN(fd);
|
DBUG_RETURN(fd);
|
||||||
@@ -70,7 +70,7 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags)
|
|||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
DBUG_PRINT("error",("Got error %d on open",my_errno));
|
DBUG_PRINT("error",("Got error %d on open",my_errno));
|
||||||
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
|
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
|
||||||
my_error((Flags & O_RDONLY) || (Flags == O_RDONLY ) ? EE_FILENOTFOUND :
|
ma_error((Flags & O_RDONLY) || (Flags == O_RDONLY ) ? EE_FILENOTFOUND :
|
||||||
EE_CANTCREATEFILE,
|
EE_CANTCREATEFILE,
|
||||||
MYF(ME_BELL+ME_WAITTANG), FileName,my_errno);
|
MYF(ME_BELL+ME_WAITTANG), FileName,my_errno);
|
||||||
DBUG_RETURN((FILE*) 0);
|
DBUG_RETURN((FILE*) 0);
|
||||||
@@ -91,15 +91,15 @@ int my_fclose(FILE *fd, myf MyFlags)
|
|||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & (MY_FAE | MY_WME))
|
if (MyFlags & (MY_FAE | MY_WME))
|
||||||
my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),
|
||||||
my_filename(file),errno);
|
my_filename(file),errno);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
my_stream_opened--;
|
ma_stream_opened--;
|
||||||
if ((uint) file < MY_NFILE && my_file_info[file].type != UNOPEN)
|
if ((uint) file < MY_NFILE && ma_file_info[file].type != UNOPEN)
|
||||||
{
|
{
|
||||||
my_file_info[file].type = UNOPEN;
|
ma_file_info[file].type = UNOPEN;
|
||||||
my_free(my_file_info[file].name);
|
ma_free(ma_file_info[file].name);
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&THR_LOCK_open);
|
pthread_mutex_unlock(&THR_LOCK_open);
|
||||||
DBUG_RETURN(err);
|
DBUG_RETURN(err);
|
||||||
@@ -122,23 +122,23 @@ FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags)
|
|||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & (MY_FAE | MY_WME))
|
if (MyFlags & (MY_FAE | MY_WME))
|
||||||
my_error(EE_CANT_OPEN_STREAM, MYF(ME_BELL+ME_WAITTANG),errno);
|
ma_error(EE_CANT_OPEN_STREAM, MYF(ME_BELL+ME_WAITTANG),errno);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pthread_mutex_lock(&THR_LOCK_open);
|
pthread_mutex_lock(&THR_LOCK_open);
|
||||||
my_stream_opened++;
|
ma_stream_opened++;
|
||||||
if (Filedes < MY_NFILE)
|
if (Filedes < MY_NFILE)
|
||||||
{
|
{
|
||||||
if (my_file_info[Filedes].type != UNOPEN)
|
if (ma_file_info[Filedes].type != UNOPEN)
|
||||||
{
|
{
|
||||||
my_file_opened--; /* File is opened with my_open ! */
|
ma_file_opened--; /* File is opened with my_open ! */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
my_file_info[Filedes].name= my_strdup(name,MyFlags);
|
ma_file_info[Filedes].name= ma_strdup(name,MyFlags);
|
||||||
}
|
}
|
||||||
my_file_info[Filedes].type = STREAM_BY_FDOPEN;
|
ma_file_info[Filedes].type = STREAM_BY_FDOPEN;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&THR_LOCK_open);
|
pthread_mutex_unlock(&THR_LOCK_open);
|
||||||
}
|
}
|
||||||
|
@@ -50,11 +50,11 @@ uint my_fread(FILE *stream, unsigned char *Buffer, uint Count, myf MyFlags)
|
|||||||
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
||||||
{
|
{
|
||||||
if (ferror(stream))
|
if (ferror(stream))
|
||||||
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
|
||||||
my_filename(fileno(stream)),errno);
|
my_filename(fileno(stream)),errno);
|
||||||
else
|
else
|
||||||
if (MyFlags & (MY_NABP | MY_FNABP))
|
if (MyFlags & (MY_NABP | MY_FNABP))
|
||||||
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
|
||||||
my_filename(fileno(stream)),errno);
|
my_filename(fileno(stream)),errno);
|
||||||
}
|
}
|
||||||
my_errno=errno ? errno : -1;
|
my_errno=errno ? errno : -1;
|
||||||
@@ -118,7 +118,7 @@ uint my_fwrite(FILE *stream, const unsigned char *Buffer, uint Count, myf MyFlag
|
|||||||
if (errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL))
|
if (errno == ENOSPC && (MyFlags & MY_WAIT_IF_FULL))
|
||||||
{
|
{
|
||||||
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
|
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
|
||||||
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH));
|
ma_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH));
|
||||||
sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
|
sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC);
|
||||||
VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)));
|
VOID(my_fseek(stream,seekptr,MY_SEEK_SET,MYF(0)));
|
||||||
continue;
|
continue;
|
||||||
@@ -128,7 +128,7 @@ uint my_fwrite(FILE *stream, const unsigned char *Buffer, uint Count, myf MyFlag
|
|||||||
{
|
{
|
||||||
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
||||||
{
|
{
|
||||||
my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
|
||||||
my_filename(fileno(stream)),errno);
|
my_filename(fileno(stream)),errno);
|
||||||
}
|
}
|
||||||
writenbytes=(uint) -1; /* Return that we got error */
|
writenbytes=(uint) -1; /* Return that we got error */
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
MA 02111-1307, USA */
|
MA 02111-1307, USA */
|
||||||
|
|
||||||
/* my_setwd() and my_getwd() works with intern_filenames !! */
|
/* my_setwd() and my_getwd() works with ma_intern_filenames !! */
|
||||||
|
|
||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
/* Gets current working directory in buff. Directory is allways ended
|
/* Gets current working directory in buff. Directory is allways ended
|
||||||
with FN_LIBCHAR */
|
with FN_LIBCHAR */
|
||||||
/* One must pass a buffer to my_getwd. One can allways use
|
/* One must pass a buffer to my_getwd. One can allways use
|
||||||
curr_dir[] */
|
ma_cur_dir[] */
|
||||||
|
|
||||||
int my_getwd(my_string buf, uint size, myf MyFlags)
|
int my_getwd(my_string buf, uint size, myf MyFlags)
|
||||||
{
|
{
|
||||||
@@ -49,8 +49,8 @@ int my_getwd(my_string buf, uint size, myf MyFlags)
|
|||||||
DBUG_PRINT("my",("buf: %lx size: %d MyFlags %d", buf,size,MyFlags));
|
DBUG_PRINT("my",("buf: %lx size: %d MyFlags %d", buf,size,MyFlags));
|
||||||
|
|
||||||
#if ! defined(MSDOS)
|
#if ! defined(MSDOS)
|
||||||
if (curr_dir[0]) /* Current pos is saved here */
|
if (ma_cur_dir[0]) /* Current pos is saved here */
|
||||||
VOID(strmake(buf,&curr_dir[0],size-1));
|
VOID(strmake(buf,&ma_cur_dir[0],size-1));
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@@ -62,7 +62,7 @@ int my_getwd(my_string buf, uint size, myf MyFlags)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
|
ma_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_GETWD)
|
#elif defined(HAVE_GETWD)
|
||||||
@@ -75,10 +75,10 @@ int my_getwd(my_string buf, uint size, myf MyFlags)
|
|||||||
if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
|
if (!getcwd(buf,size-2,1) && MyFlags & MY_WME)
|
||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
|
ma_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
intern_filename(buf,buf);
|
ma_intern_filename(buf,buf);
|
||||||
#else
|
#else
|
||||||
#error "No way to get current directory"
|
#error "No way to get current directory"
|
||||||
#endif
|
#endif
|
||||||
@@ -87,7 +87,7 @@ int my_getwd(my_string buf, uint size, myf MyFlags)
|
|||||||
pos[0]= FN_LIBCHAR;
|
pos[0]= FN_LIBCHAR;
|
||||||
pos[1]=0;
|
pos[1]=0;
|
||||||
}
|
}
|
||||||
(void) strmake(&curr_dir[0],buf,(size_s) (FN_REFLEN-1));
|
(void) strmake(&ma_cur_dir[0],buf,(size_s) (FN_REFLEN-1));
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
} /* my_getwd */
|
} /* my_getwd */
|
||||||
@@ -129,7 +129,7 @@ int my_setwd(const char *dir, myf MyFlags)
|
|||||||
{
|
{
|
||||||
*pos='\0'; /* Dir is now only drive */
|
*pos='\0'; /* Dir is now only drive */
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),dir,ENOENT);
|
ma_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),dir,ENOENT);
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
dir=pos; /* drive changed, change now path */
|
dir=pos; /* drive changed, change now path */
|
||||||
@@ -151,7 +151,7 @@ int my_setwd(const char *dir, myf MyFlags)
|
|||||||
pos[0]=FN_LIBCHAR; /* Mark as directory */
|
pos[0]=FN_LIBCHAR; /* Mark as directory */
|
||||||
pos[1]=0;
|
pos[1]=0;
|
||||||
}
|
}
|
||||||
system_filename(buff,buff); /* Change to VMS format */
|
ma_system_filename(buff,buff); /* Change to VMS format */
|
||||||
dir=buff;
|
dir=buff;
|
||||||
}
|
}
|
||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
@@ -163,22 +163,22 @@ int my_setwd(const char *dir, myf MyFlags)
|
|||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & MY_WME)
|
if (MyFlags & MY_WME)
|
||||||
my_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),start,errno);
|
ma_error(EE_SETWD,MYF(ME_BELL+ME_WAITTANG),start,errno);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (test_if_hard_path(start))
|
if (test_if_hard_path(start))
|
||||||
{ /* Hard pathname */
|
{ /* Hard pathname */
|
||||||
pos=strmake(&curr_dir[0],start,(size_s) FN_REFLEN-1);
|
pos=strmake(&ma_cur_dir[0],start,(size_s) FN_REFLEN-1);
|
||||||
if (pos[-1] != FN_LIBCHAR)
|
if (pos[-1] != FN_LIBCHAR)
|
||||||
{
|
{
|
||||||
length=(uint) (pos-(char*) curr_dir);
|
length=(uint) (pos-(char*) ma_cur_dir);
|
||||||
curr_dir[length]=FN_LIBCHAR; /* must end with '/' */
|
ma_cur_dir[length]=FN_LIBCHAR; /* must end with '/' */
|
||||||
curr_dir[length+1]='\0';
|
ma_cur_dir[length+1]='\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
curr_dir[0]='\0'; /* Don't save name */
|
ma_cur_dir[0]='\0'; /* Don't save name */
|
||||||
}
|
}
|
||||||
DBUG_RETURN(res);
|
DBUG_RETURN(res);
|
||||||
} /* my_setwd */
|
} /* my_setwd */
|
||||||
@@ -191,7 +191,7 @@ int my_setwd(const char *dir, myf MyFlags)
|
|||||||
int test_if_hard_path(register const char *dir_name)
|
int test_if_hard_path(register const char *dir_name)
|
||||||
{
|
{
|
||||||
if (dir_name[0] == FN_HOMELIB && dir_name[1] == FN_LIBCHAR)
|
if (dir_name[0] == FN_HOMELIB && dir_name[1] == FN_LIBCHAR)
|
||||||
return (home_dir != NullS && test_if_hard_path(home_dir));
|
return (ma_ma_ma_home_dir != NullS && test_if_hard_path(ma_ma_ma_home_dir));
|
||||||
if (dir_name[0] == FN_LIBCHAR)
|
if (dir_name[0] == FN_LIBCHAR)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
#ifdef FN_DEVCHAR
|
#ifdef FN_DEVCHAR
|
||||||
|
@@ -43,7 +43,7 @@ static my_bool win32_init_tcp_ip();
|
|||||||
#define my_win_init()
|
#define my_win_init()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
my_bool my_init_done=0;
|
my_bool ma_init_done=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -61,17 +61,17 @@ static ulong atoi_octal(const char *str)
|
|||||||
|
|
||||||
/* Init my_sys functions and my_sys variabels */
|
/* Init my_sys functions and my_sys variabels */
|
||||||
|
|
||||||
void my_init(void)
|
void ma_init(void)
|
||||||
{
|
{
|
||||||
my_string str;
|
my_string str;
|
||||||
if (my_init_done)
|
if (ma_init_done)
|
||||||
return;
|
return;
|
||||||
my_init_done=1;
|
ma_init_done=1;
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
#if defined(HAVE_PTHREAD_INIT)
|
#if defined(HAVE_PTHREAD_INIT)
|
||||||
pthread_init(); /* Must be called before DBUG_ENTER */
|
pthread_init(); /* Must be called before DBUG_ENTER */
|
||||||
#endif
|
#endif
|
||||||
my_thread_global_init();
|
ma_thread_global_init();
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
|
sigfillset(&my_signals); /* signals blocked by mf_brkhant */
|
||||||
#endif
|
#endif
|
||||||
@@ -80,46 +80,46 @@ void my_init(void)
|
|||||||
(void) isatty(0); /* Go around connect() bug in UW7 */
|
(void) isatty(0); /* Go around connect() bug in UW7 */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
DBUG_ENTER("my_init");
|
DBUG_ENTER("ma_init");
|
||||||
DBUG_PROCESS(my_progname ? my_progname : (char*) "unknown");
|
DBUG_PROCESS(ma_progname ? ma_progname : (char*) "unknown");
|
||||||
if (!home_dir)
|
if (!ma_ma_ma_home_dir)
|
||||||
{ /* Don't initialize twice */
|
{ /* Don't initialize twice */
|
||||||
if ((home_dir=getenv("HOME")) != 0)
|
if ((ma_ma_ma_home_dir=getenv("HOME")) != 0)
|
||||||
home_dir=intern_filename(home_dir_buff,home_dir);
|
ma_ma_ma_home_dir=ma_intern_filename(ma_ma_ma_ma_ma_ma_home_dir_buff,ma_ma_ma_home_dir);
|
||||||
#ifndef VMS
|
#ifndef VMS
|
||||||
/* Default creation of new files */
|
/* Default creation of new files */
|
||||||
if ((str=getenv("UMASK")) != 0)
|
if ((str=getenv("UMASK")) != 0)
|
||||||
my_umask=(int) (atoi_octal(str) | 0600);
|
ma_umask=(int) (atoi_octal(str) | 0600);
|
||||||
/* Default creation of new dir's */
|
/* Default creation of new dir's */
|
||||||
if ((str=getenv("UMASK_DIR")) != 0)
|
if ((str=getenv("UMASK_DIR")) != 0)
|
||||||
my_umask_dir=(int) (atoi_octal(str) | 0700);
|
ma_umask_dir=(int) (atoi_octal(str) | 0700);
|
||||||
#endif
|
#endif
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
init_ctype(); /* Stupid linker don't link _ctype.c */
|
init_ctype(); /* Stupid linker don't link _ctype.c */
|
||||||
#endif
|
#endif
|
||||||
DBUG_PRINT("exit",("home: '%s'",home_dir));
|
DBUG_PRINT("exit",("home: '%s'",ma_ma_ma_home_dir));
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
my_win_init();
|
my_win_init();
|
||||||
#endif
|
#endif
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
} /* my_init */
|
} /* ma_init */
|
||||||
|
|
||||||
|
|
||||||
/* End my_sys */
|
/* End my_sys */
|
||||||
|
|
||||||
void my_end(int infoflag)
|
void ma_end(int infoflag)
|
||||||
{
|
{
|
||||||
FILE *info_file;
|
FILE *info_file;
|
||||||
if (!(info_file=DBUG_FILE))
|
if (!(info_file=DBUG_FILE))
|
||||||
info_file=stderr;
|
info_file=stderr;
|
||||||
if (infoflag & MY_CHECK_ERROR || info_file != stderr)
|
if (infoflag & MY_CHECK_ERROR || info_file != stderr)
|
||||||
{ /* Test if some file is left open */
|
{ /* Test if some file is left open */
|
||||||
if (my_file_opened | my_stream_opened)
|
if (ma_file_opened | ma_stream_opened)
|
||||||
{
|
{
|
||||||
sprintf(errbuff[0],EE(EE_OPEN_WARNING),my_file_opened,my_stream_opened);
|
sprintf(errbuff[0],EE(EE_OPEN_WARNING),ma_file_opened,ma_stream_opened);
|
||||||
(void) my_message_no_curses(EE_OPEN_WARNING,errbuff[0],ME_BELL);
|
(void) ma_message_no_curses(EE_OPEN_WARNING,errbuff[0],ME_BELL);
|
||||||
DBUG_PRINT("error",("%s",errbuff[0]));
|
DBUG_PRINT("error",("%s",errbuff[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -164,16 +164,16 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
|
|||||||
pthread_mutex_destroy(&THR_LOCK_malloc);
|
pthread_mutex_destroy(&THR_LOCK_malloc);
|
||||||
pthread_mutex_destroy(&THR_LOCK_open);
|
pthread_mutex_destroy(&THR_LOCK_open);
|
||||||
pthread_mutex_destroy(&THR_LOCK_net);
|
pthread_mutex_destroy(&THR_LOCK_net);
|
||||||
DBUG_END(); /* Must be done before my_thread_end */
|
DBUG_END(); /* Must be done before ma_thread_end */
|
||||||
my_thread_end();
|
ma_thread_end();
|
||||||
my_thread_global_end();
|
ma_thread_global_end();
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (have_tcpip);
|
if (have_tcpip);
|
||||||
WSACleanup( );
|
WSACleanup( );
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
my_init_done=0;
|
ma_init_done=0;
|
||||||
} /* my_end */
|
} /* ma_end */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
|
@@ -75,7 +75,7 @@ void my_dirend(MY_DIR *buffer)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("my_dirend");
|
DBUG_ENTER("my_dirend");
|
||||||
if (buffer)
|
if (buffer)
|
||||||
my_free(buffer);
|
ma_free(buffer);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
} /* my_dirend */
|
} /* my_dirend */
|
||||||
|
|
||||||
@@ -112,7 +112,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||||||
|
|
||||||
dirp = opendir(directory_file_name(tmp_path,(my_string) path));
|
dirp = opendir(directory_file_name(tmp_path,(my_string) path));
|
||||||
size = STARTSIZE;
|
size = STARTSIZE;
|
||||||
if (dirp == NULL || ! (buffer = (char *) my_malloc(size, MyFlags)))
|
if (dirp == NULL || ! (buffer = (char *) ma_malloc(size, MyFlags)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
fcnt = 0;
|
fcnt = 0;
|
||||||
@@ -146,7 +146,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||||||
if (eof)
|
if (eof)
|
||||||
break;
|
break;
|
||||||
size += STARTSIZE; obuffer = buffer;
|
size += STARTSIZE; obuffer = buffer;
|
||||||
if (!(buffer = (char *) my_realloc((gptr) buffer, size,
|
if (!(buffer = (char *) ma_realloc((gptr) buffer, size,
|
||||||
MyFlags | MY_FREE_ON_ERROR)))
|
MyFlags | MY_FREE_ON_ERROR)))
|
||||||
goto error; /* No memory */
|
goto error; /* No memory */
|
||||||
length= (uint) (sizeof(struct fileinfo ) * firstfcnt);
|
length= (uint) (sizeof(struct fileinfo ) * firstfcnt);
|
||||||
@@ -184,7 +184,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||||||
if (dirp)
|
if (dirp)
|
||||||
(void) closedir(dirp);
|
(void) closedir(dirp);
|
||||||
if (MyFlags & (MY_FAE+MY_WME))
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,my_errno);
|
ma_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,my_errno);
|
||||||
DBUG_RETURN((MY_DIR *) NULL);
|
DBUG_RETURN((MY_DIR *) NULL);
|
||||||
} /* my_dir */
|
} /* my_dir */
|
||||||
|
|
||||||
@@ -392,7 +392,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||||||
size = STARTSIZE;
|
size = STARTSIZE;
|
||||||
firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
|
firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
|
||||||
(sizeof(struct fileinfo) + FN_LEN);
|
(sizeof(struct fileinfo) + FN_LEN);
|
||||||
if ((buffer = (char *) my_malloc(size, MyFlags)) == 0)
|
if ((buffer = (char *) ma_malloc(size, MyFlags)) == 0)
|
||||||
goto error;
|
goto error;
|
||||||
fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
|
fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
|
||||||
tempptr = (char *) (fnames + maxfcnt);
|
tempptr = (char *) (fnames + maxfcnt);
|
||||||
@@ -435,7 +435,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags)
|
|||||||
if (eof)
|
if (eof)
|
||||||
break;
|
break;
|
||||||
size += STARTSIZE; obuffer = buffer;
|
size += STARTSIZE; obuffer = buffer;
|
||||||
if (!(buffer = (char *) my_realloc((gptr) buffer, size,
|
if (!(buffer = (char *) ma_realloc((gptr) buffer, size,
|
||||||
MyFlags | MY_FREE_ON_ERROR)))
|
MyFlags | MY_FREE_ON_ERROR)))
|
||||||
goto error;
|
goto error;
|
||||||
length= sizeof(struct fileinfo ) * firstfcnt;
|
length= sizeof(struct fileinfo ) * firstfcnt;
|
||||||
@@ -469,7 +469,7 @@ error:
|
|||||||
_findclose(handle);
|
_findclose(handle);
|
||||||
#endif
|
#endif
|
||||||
if (MyFlags & MY_FAE+MY_WME)
|
if (MyFlags & MY_FAE+MY_WME)
|
||||||
my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
|
ma_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
|
||||||
DBUG_RETURN((MY_DIR *) NULL);
|
DBUG_RETURN((MY_DIR *) NULL);
|
||||||
} /* my_dir */
|
} /* my_dir */
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ MY_DIR *my_dir(const char* path, myf MyFlags)
|
|||||||
size = STARTSIZE;
|
size = STARTSIZE;
|
||||||
firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
|
firstfcnt = maxfcnt = (size - sizeof(MY_DIR)) /
|
||||||
(sizeof(struct fileinfo) + FN_LEN);
|
(sizeof(struct fileinfo) + FN_LEN);
|
||||||
if ((buffer = (char *) my_malloc(size, MyFlags)) == 0)
|
if ((buffer = (char *) ma_malloc(size, MyFlags)) == 0)
|
||||||
goto error;
|
goto error;
|
||||||
fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
|
fnames= (struct fileinfo *) (buffer + sizeof(MY_DIR));
|
||||||
tempptr = (char *) (fnames + maxfcnt);
|
tempptr = (char *) (fnames + maxfcnt);
|
||||||
@@ -543,7 +543,7 @@ MY_DIR *my_dir(const char* path, myf MyFlags)
|
|||||||
if (eof)
|
if (eof)
|
||||||
break;
|
break;
|
||||||
size += STARTSIZE; obuffer = buffer;
|
size += STARTSIZE; obuffer = buffer;
|
||||||
if (!(buffer = (char *) my_realloc((gptr) buffer, size,
|
if (!(buffer = (char *) ma_realloc((gptr) buffer, size,
|
||||||
MyFlags | MY_FREE_ON_ERROR)))
|
MyFlags | MY_FREE_ON_ERROR)))
|
||||||
goto error;
|
goto error;
|
||||||
length= sizeof(struct fileinfo ) * firstfcnt;
|
length= sizeof(struct fileinfo ) * firstfcnt;
|
||||||
@@ -569,7 +569,7 @@ MY_DIR *my_dir(const char* path, myf MyFlags)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
if (MyFlags & MY_FAE+MY_WME)
|
if (MyFlags & MY_FAE+MY_WME)
|
||||||
my_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
|
ma_error(EE_DIR,MYF(ME_BELL+ME_WAITTANG),path,errno);
|
||||||
DBUG_RETURN((MY_DIR *) NULL);
|
DBUG_RETURN((MY_DIR *) NULL);
|
||||||
} /* my_dir */
|
} /* my_dir */
|
||||||
|
|
||||||
@@ -595,18 +595,18 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags)
|
|||||||
(unsigned char *) stat_area, my_flags));
|
(unsigned char *) stat_area, my_flags));
|
||||||
|
|
||||||
if ((m_used= (stat_area == NULL)))
|
if ((m_used= (stat_area == NULL)))
|
||||||
if (!(stat_area = (MY_STAT *) my_malloc(sizeof(MY_STAT), my_flags)))
|
if (!(stat_area = (MY_STAT *) ma_malloc(sizeof(MY_STAT), my_flags)))
|
||||||
goto error;
|
goto error;
|
||||||
if ( ! stat((my_string) path, (struct stat *) stat_area) )
|
if ( ! stat((my_string) path, (struct stat *) stat_area) )
|
||||||
DBUG_RETURN(stat_area);
|
DBUG_RETURN(stat_area);
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (m_used) /* Free if new area */
|
if (m_used) /* Free if new area */
|
||||||
my_free(stat_area);
|
ma_free(stat_area);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (my_flags & (MY_FAE+MY_WME))
|
if (my_flags & (MY_FAE+MY_WME))
|
||||||
{
|
{
|
||||||
my_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),path,my_errno);
|
ma_error(EE_STAT, MYF(ME_BELL+ME_WAITTANG),path,my_errno);
|
||||||
DBUG_RETURN((MY_STAT *) NULL);
|
DBUG_RETURN((MY_STAT *) NULL);
|
||||||
}
|
}
|
||||||
DBUG_RETURN((MY_STAT *) NULL);
|
DBUG_RETURN((MY_STAT *) NULL);
|
||||||
|
@@ -68,7 +68,7 @@ int mysql_local_infile_init(void **ptr, const char *filename, void *userdata)
|
|||||||
MYSQL *mysql= (MYSQL *)userdata;
|
MYSQL *mysql= (MYSQL *)userdata;
|
||||||
DBUG_ENTER("mysql_local_infile_init");
|
DBUG_ENTER("mysql_local_infile_init");
|
||||||
|
|
||||||
info = (MYSQL_INFILE_INFO *)my_malloc(sizeof(MYSQL_INFILE_INFO), MYF(MY_ZEROFILL));
|
info = (MYSQL_INFILE_INFO *)ma_malloc(sizeof(MYSQL_INFILE_INFO), MYF(MY_ZEROFILL));
|
||||||
if (!info) {
|
if (!info) {
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ int mysql_local_infile_init(void **ptr, const char *filename, void *userdata)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
info->error_no = my_errno;
|
info->error_no = my_errno;
|
||||||
my_snprintf((char *)info->error_msg, sizeof(info->error_msg),
|
ma_snprintf((char *)info->error_msg, sizeof(info->error_msg),
|
||||||
EE(EE_FILENOTFOUND), filename, info->error_no);
|
EE(EE_FILENOTFOUND), filename, info->error_no);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@@ -153,7 +153,7 @@ void mysql_local_infile_end(void *ptr)
|
|||||||
{
|
{
|
||||||
if (info->fp)
|
if (info->fp)
|
||||||
ma_close(info->fp);
|
ma_close(info->fp);
|
||||||
my_free(ptr);
|
ma_free(ptr);
|
||||||
}
|
}
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ my_bool mysql_handle_local_infile(MYSQL *conn, const char *filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* allocate buffer for reading data */
|
/* allocate buffer for reading data */
|
||||||
buf = (uchar *)my_malloc(buflen, MYF(0));
|
buf = (uchar *)ma_malloc(buflen, MYF(0));
|
||||||
|
|
||||||
/* init handler: allocate read buffer and open file */
|
/* init handler: allocate read buffer and open file */
|
||||||
if (conn->options.local_infile_init(&info, filename,
|
if (conn->options.local_infile_init(&info, filename,
|
||||||
@@ -264,7 +264,7 @@ my_bool mysql_handle_local_infile(MYSQL *conn, const char *filename)
|
|||||||
|
|
||||||
infile_error:
|
infile_error:
|
||||||
conn->options.local_infile_end(info);
|
conn->options.local_infile_end(info);
|
||||||
my_free(buf);
|
ma_free(buf);
|
||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
@@ -25,10 +25,10 @@
|
|||||||
|
|
||||||
/* My memory allocator */
|
/* My memory allocator */
|
||||||
|
|
||||||
gptr my_malloc(size_t Size, myf MyFlags)
|
gptr ma_malloc(size_t Size, myf MyFlags)
|
||||||
{
|
{
|
||||||
gptr point;
|
gptr point;
|
||||||
DBUG_ENTER("my_malloc");
|
DBUG_ENTER("ma_malloc");
|
||||||
DBUG_PRINT("my",("Size: %u MyFlags: %d",Size, MyFlags));
|
DBUG_PRINT("my",("Size: %u MyFlags: %d",Size, MyFlags));
|
||||||
|
|
||||||
if (!Size)
|
if (!Size)
|
||||||
@@ -37,9 +37,9 @@ gptr my_malloc(size_t Size, myf MyFlags)
|
|||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & MY_FAE)
|
if (MyFlags & MY_FAE)
|
||||||
error_handler_hook=fatal_error_handler_hook;
|
ma_error_handler_hook=fatal_ma_error_handler_hook;
|
||||||
if (MyFlags & (MY_FAE+MY_WME))
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size);
|
ma_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size);
|
||||||
if (MyFlags & MY_FAE)
|
if (MyFlags & MY_FAE)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -47,34 +47,34 @@ gptr my_malloc(size_t Size, myf MyFlags)
|
|||||||
bzero(point,Size);
|
bzero(point,Size);
|
||||||
DBUG_PRINT("exit",("ptr: %lx",point));
|
DBUG_PRINT("exit",("ptr: %lx",point));
|
||||||
DBUG_RETURN(point);
|
DBUG_RETURN(point);
|
||||||
} /* my_malloc */
|
} /* ma_malloc */
|
||||||
|
|
||||||
|
|
||||||
/* Free memory allocated with my_malloc */
|
/* Free memory allocated with ma_malloc */
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
|
|
||||||
void my_no_flags_free(void *ptr)
|
void my_no_flags_free(void *ptr)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("my_free");
|
DBUG_ENTER("ma_free");
|
||||||
DBUG_PRINT("my",("ptr: %lx",ptr));
|
DBUG_PRINT("my",("ptr: %lx",ptr));
|
||||||
if (ptr)
|
if (ptr)
|
||||||
free(ptr);
|
free(ptr);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
} /* my_free */
|
} /* ma_free */
|
||||||
|
|
||||||
|
|
||||||
/* malloc and copy */
|
/* malloc and copy */
|
||||||
|
|
||||||
gptr my_memdup(const unsigned char *from, size_t length, myf MyFlags)
|
gptr ma_memdup(const unsigned char *from, size_t length, myf MyFlags)
|
||||||
{
|
{
|
||||||
gptr ptr;
|
gptr ptr;
|
||||||
if ((ptr=my_malloc(length,MyFlags)) != 0)
|
if ((ptr=ma_malloc(length,MyFlags)) != 0)
|
||||||
memcpy((unsigned char*) ptr, (unsigned char*) from,(size_t) length);
|
memcpy((unsigned char*) ptr, (unsigned char*) from,(size_t) length);
|
||||||
return(ptr);
|
return(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
my_string my_strdup(const char *from, myf MyFlags)
|
my_string ma_strdup(const char *from, myf MyFlags)
|
||||||
{
|
{
|
||||||
gptr ptr;
|
gptr ptr;
|
||||||
uint length;
|
uint length;
|
||||||
@@ -83,16 +83,16 @@ my_string my_strdup(const char *from, myf MyFlags)
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
length=(uint) strlen(from)+1;
|
length=(uint) strlen(from)+1;
|
||||||
if ((ptr=my_malloc(length,MyFlags)) != 0)
|
if ((ptr=ma_malloc(length,MyFlags)) != 0)
|
||||||
memcpy((unsigned char*) ptr, (unsigned char*) from,(size_t) length);
|
memcpy((unsigned char*) ptr, (unsigned char*) from,(size_t) length);
|
||||||
return((my_string) ptr);
|
return((my_string) ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
my_string my_strndup(const char *src, size_t length, myf MyFlags)
|
my_string ma_strndup(const char *src, size_t length, myf MyFlags)
|
||||||
{
|
{
|
||||||
gptr ptr;
|
gptr ptr;
|
||||||
|
|
||||||
if ((ptr= my_malloc(length+1, MyFlags))) {
|
if ((ptr= ma_malloc(length+1, MyFlags))) {
|
||||||
memcpy(ptr, src, length);
|
memcpy(ptr, src, length);
|
||||||
ptr[length] = 0;
|
ptr[length] = 0;
|
||||||
}
|
}
|
||||||
|
@@ -17,17 +17,17 @@
|
|||||||
|
|
||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
|
|
||||||
int my_message_no_curses(uint error __attribute__((unused)),
|
int ma_message_no_curses(uint error __attribute__((unused)),
|
||||||
const char *str, myf MyFlags)
|
const char *str, myf MyFlags)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("my_message_no_curses");
|
DBUG_ENTER("ma_message_no_curses");
|
||||||
DBUG_PRINT("enter",("message: %s",str));
|
DBUG_PRINT("enter",("message: %s",str));
|
||||||
(void) fflush(stdout);
|
(void) fflush(stdout);
|
||||||
if (MyFlags & ME_BELL)
|
if (MyFlags & ME_BELL)
|
||||||
(void) fputc('\007',stderr); /* Bell */
|
(void) fputc('\007',stderr); /* Bell */
|
||||||
if (my_progname)
|
if (ma_progname)
|
||||||
{
|
{
|
||||||
(void)fputs(my_progname,stderr); (void)fputs(": ",stderr);
|
(void)fputs(ma_progname,stderr); (void)fputs(": ",stderr);
|
||||||
}
|
}
|
||||||
(void)fputs(str,stderr);
|
(void)fputs(str,stderr);
|
||||||
(void)fputc('\n',stderr);
|
(void)fputc('\n',stderr);
|
||||||
|
@@ -36,9 +36,9 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags)
|
|||||||
reg2 USED_MEM **prev;
|
reg2 USED_MEM **prev;
|
||||||
|
|
||||||
Size= ALIGN_SIZE(Size);
|
Size= ALIGN_SIZE(Size);
|
||||||
prev= &my_once_root_block;
|
prev= &ma_once_root_block;
|
||||||
max_left=0;
|
max_left=0;
|
||||||
for (next=my_once_root_block ; next && next->left < Size ; next= next->next)
|
for (next=ma_once_root_block ; next && next->left < Size ; next= next->next)
|
||||||
{
|
{
|
||||||
if (next->left > max_left)
|
if (next->left > max_left)
|
||||||
max_left=next->left;
|
max_left=next->left;
|
||||||
@@ -47,14 +47,14 @@ gptr my_once_alloc(unsigned int Size, myf MyFlags)
|
|||||||
if (! next)
|
if (! next)
|
||||||
{ /* Time to alloc new block */
|
{ /* Time to alloc new block */
|
||||||
get_size= Size+ALIGN_SIZE(sizeof(USED_MEM));
|
get_size= Size+ALIGN_SIZE(sizeof(USED_MEM));
|
||||||
if (max_left*4 < my_once_extra && get_size < my_once_extra)
|
if (max_left*4 < ma_once_extra && get_size < ma_once_extra)
|
||||||
get_size=my_once_extra; /* Normal alloc */
|
get_size=ma_once_extra; /* Normal alloc */
|
||||||
|
|
||||||
if ((next = (USED_MEM*) malloc(get_size)) == 0)
|
if ((next = (USED_MEM*) malloc(get_size)) == 0)
|
||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & (MY_FAE+MY_WME))
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size);
|
ma_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),get_size);
|
||||||
return((gptr) 0);
|
return((gptr) 0);
|
||||||
}
|
}
|
||||||
DBUG_PRINT("test",("my_once_malloc %u byte malloced",get_size));
|
DBUG_PRINT("test",("my_once_malloc %u byte malloced",get_size));
|
||||||
@@ -77,12 +77,12 @@ void my_once_free(void)
|
|||||||
reg1 USED_MEM *next,*old;
|
reg1 USED_MEM *next,*old;
|
||||||
DBUG_ENTER("my_once_free");
|
DBUG_ENTER("my_once_free");
|
||||||
|
|
||||||
for (next=my_once_root_block ; next ; )
|
for (next=ma_once_root_block ; next ; )
|
||||||
{
|
{
|
||||||
old=next; next= next->next ;
|
old=next; next= next->next ;
|
||||||
free((gptr) old);
|
free((gptr) old);
|
||||||
}
|
}
|
||||||
my_once_root_block=0;
|
ma_once_root_block=0;
|
||||||
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
} /* my_once_free */
|
} /* my_once_free */
|
||||||
|
@@ -43,7 +43,7 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
|
|||||||
fd = open((my_string) FileName, Flags | O_BINARY,
|
fd = open((my_string) FileName, Flags | O_BINARY,
|
||||||
MY_S_IREAD | MY_S_IWRITE);
|
MY_S_IREAD | MY_S_IWRITE);
|
||||||
#elif !defined(NO_OPEN_3)
|
#elif !defined(NO_OPEN_3)
|
||||||
fd = open(FileName, Flags, my_umask); /* Normal unix */
|
fd = open(FileName, Flags, ma_umask); /* Normal unix */
|
||||||
#else
|
#else
|
||||||
fd = open((my_string) FileName, Flags);
|
fd = open((my_string) FileName, Flags);
|
||||||
#endif
|
#endif
|
||||||
@@ -66,17 +66,17 @@ int my_close(File fd, myf MyFlags)
|
|||||||
DBUG_PRINT("error",("Got error %d on close",err));
|
DBUG_PRINT("error",("Got error %d on close",err));
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & (MY_FAE | MY_WME))
|
if (MyFlags & (MY_FAE | MY_WME))
|
||||||
my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),my_filename(fd),errno);
|
ma_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),my_filename(fd),errno);
|
||||||
}
|
}
|
||||||
if ((uint) fd < MY_NFILE && my_file_info[fd].type != UNOPEN)
|
if ((uint) fd < MY_NFILE && ma_file_info[fd].type != UNOPEN)
|
||||||
{
|
{
|
||||||
my_free(my_file_info[fd].name);
|
ma_free(ma_file_info[fd].name);
|
||||||
#if defined(THREAD) && !defined(HAVE_PREAD)
|
#if defined(THREAD) && !defined(HAVE_PREAD)
|
||||||
pthread_mutex_destroy(&my_file_info[fd].mutex);
|
pthread_mutex_destroy(&ma_file_info[fd].mutex);
|
||||||
#endif
|
#endif
|
||||||
my_file_info[fd].type = UNOPEN;
|
ma_file_info[fd].type = UNOPEN;
|
||||||
}
|
}
|
||||||
my_file_opened--;
|
ma_file_opened--;
|
||||||
pthread_mutex_unlock(&THR_LOCK_open);
|
pthread_mutex_unlock(&THR_LOCK_open);
|
||||||
DBUG_RETURN(err);
|
DBUG_RETURN(err);
|
||||||
} /* my_close */
|
} /* my_close */
|
||||||
@@ -93,20 +93,20 @@ File my_register_filename(File fd, const char *FileName, enum file_type
|
|||||||
(void) my_close(fd,MyFlags);
|
(void) my_close(fd,MyFlags);
|
||||||
my_errno=EMFILE;
|
my_errno=EMFILE;
|
||||||
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
|
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
|
||||||
my_error(EE_OUT_OF_FILERESOURCES, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(EE_OUT_OF_FILERESOURCES, MYF(ME_BELL+ME_WAITTANG),
|
||||||
FileName, my_errno);
|
FileName, my_errno);
|
||||||
return(-1);
|
return(-1);
|
||||||
#endif
|
#endif
|
||||||
thread_safe_increment(my_file_opened,&THR_LOCK_open);
|
thread_safe_increment(ma_file_opened,&THR_LOCK_open);
|
||||||
return(fd); /* safeguard */
|
return(fd); /* safeguard */
|
||||||
}
|
}
|
||||||
pthread_mutex_lock(&THR_LOCK_open);
|
pthread_mutex_lock(&THR_LOCK_open);
|
||||||
if ((my_file_info[fd].name = (char*) my_strdup(FileName,MyFlags)))
|
if ((ma_file_info[fd].name = (char*) ma_strdup(FileName,MyFlags)))
|
||||||
{
|
{
|
||||||
my_file_opened++;
|
ma_file_opened++;
|
||||||
my_file_info[fd].type = type_of_file;
|
ma_file_info[fd].type = type_of_file;
|
||||||
#if defined(THREAD) && !defined(HAVE_PREAD)
|
#if defined(THREAD) && !defined(HAVE_PREAD)
|
||||||
pthread_mutex_init(&my_file_info[fd].mutex,MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&ma_file_info[fd].mutex,MY_MUTEX_INIT_FAST);
|
||||||
#endif
|
#endif
|
||||||
pthread_mutex_unlock(&THR_LOCK_open);
|
pthread_mutex_unlock(&THR_LOCK_open);
|
||||||
DBUG_PRINT("exit",("fd: %d",fd));
|
DBUG_PRINT("exit",("fd: %d",fd));
|
||||||
@@ -120,7 +120,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
|
|||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
DBUG_PRINT("error",("Got error %d on open",my_errno));
|
DBUG_PRINT("error",("Got error %d on open",my_errno));
|
||||||
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
|
if (MyFlags & (MY_FFNF | MY_FAE | MY_WME))
|
||||||
my_error(error_message_number, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(error_message_number, MYF(ME_BELL+ME_WAITTANG),
|
||||||
FileName, my_errno);
|
FileName, my_errno);
|
||||||
return(fd);
|
return(fd);
|
||||||
}
|
}
|
||||||
|
@@ -48,10 +48,10 @@ uint my_read(File Filedes, unsigned char *Buffer, uint Count, myf MyFlags)
|
|||||||
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
||||||
{
|
{
|
||||||
if ((int) readbytes == -1)
|
if ((int) readbytes == -1)
|
||||||
my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
|
||||||
my_filename(Filedes),my_errno);
|
my_filename(Filedes),my_errno);
|
||||||
else if (MyFlags & (MY_NABP | MY_FNABP))
|
else if (MyFlags & (MY_NABP | MY_FNABP))
|
||||||
my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
|
||||||
my_filename(Filedes),my_errno);
|
my_filename(Filedes),my_errno);
|
||||||
}
|
}
|
||||||
if ((int) readbytes == -1 || (MyFlags & (MY_FNABP | MY_NABP)))
|
if ((int) readbytes == -1 || (MyFlags & (MY_FNABP | MY_NABP)))
|
||||||
|
@@ -24,24 +24,24 @@
|
|||||||
|
|
||||||
/* My memory re allocator */
|
/* My memory re allocator */
|
||||||
|
|
||||||
gptr my_realloc(gptr oldpoint, size_t Size, myf MyFlags)
|
gptr ma_realloc(gptr oldpoint, size_t Size, myf MyFlags)
|
||||||
{
|
{
|
||||||
gptr point;
|
gptr point;
|
||||||
DBUG_ENTER("my_realloc");
|
DBUG_ENTER("ma_realloc");
|
||||||
DBUG_PRINT("my",("ptr: %lx Size: %u MyFlags: %d",oldpoint, Size, MyFlags));
|
DBUG_PRINT("my",("ptr: %lx Size: %u MyFlags: %d",oldpoint, Size, MyFlags));
|
||||||
|
|
||||||
if (!oldpoint && (MyFlags & MY_ALLOW_ZERO_PTR))
|
if (!oldpoint && (MyFlags & MY_ALLOW_ZERO_PTR))
|
||||||
DBUG_RETURN(my_malloc(Size,MyFlags));
|
DBUG_RETURN(ma_malloc(Size,MyFlags));
|
||||||
#ifdef USE_HALLOC
|
#ifdef USE_HALLOC
|
||||||
if (!(point = malloc(Size)))
|
if (!(point = malloc(Size)))
|
||||||
{
|
{
|
||||||
if (MyFlags & MY_FREE_ON_ERROR)
|
if (MyFlags & MY_FREE_ON_ERROR)
|
||||||
my_free(oldpoint);
|
ma_free(oldpoint);
|
||||||
if (MyFlags & MY_HOLD_ON_ERROR)
|
if (MyFlags & MY_HOLD_ON_ERROR)
|
||||||
DBUG_RETURN(oldpoint);
|
DBUG_RETURN(oldpoint);
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & MY_FAE+MY_WME)
|
if (MyFlags & MY_FAE+MY_WME)
|
||||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size);
|
ma_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG),Size);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -52,14 +52,14 @@ gptr my_realloc(gptr oldpoint, size_t Size, myf MyFlags)
|
|||||||
if ((point = (char*)realloc(oldpoint,Size)) == NULL)
|
if ((point = (char*)realloc(oldpoint,Size)) == NULL)
|
||||||
{
|
{
|
||||||
if (MyFlags & MY_FREE_ON_ERROR)
|
if (MyFlags & MY_FREE_ON_ERROR)
|
||||||
my_free(oldpoint);
|
ma_free(oldpoint);
|
||||||
if (MyFlags & MY_HOLD_ON_ERROR)
|
if (MyFlags & MY_HOLD_ON_ERROR)
|
||||||
DBUG_RETURN(oldpoint);
|
DBUG_RETURN(oldpoint);
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & (MY_FAE+MY_WME))
|
if (MyFlags & (MY_FAE+MY_WME))
|
||||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), Size);
|
ma_error(EE_OUTOFMEMORY, MYF(ME_BELL+ME_WAITTANG), Size);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
DBUG_PRINT("exit",("ptr: %lx",point));
|
DBUG_PRINT("exit",("ptr: %lx",point));
|
||||||
DBUG_RETURN(point);
|
DBUG_RETURN(point);
|
||||||
} /* my_realloc */
|
} /* ma_realloc */
|
||||||
|
@@ -26,21 +26,21 @@
|
|||||||
#include "my_alarm.h"
|
#include "my_alarm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* from my_init */
|
/* from ma_init */
|
||||||
my_string home_dir=0,my_progname=0;
|
my_string ma_ma_ma_home_dir=0,ma_progname=0;
|
||||||
char NEAR curr_dir[FN_REFLEN]= {0},
|
char NEAR ma_cur_dir[FN_REFLEN]= {0},
|
||||||
NEAR home_dir_buff[FN_REFLEN]= {0};
|
NEAR ma_ma_ma_ma_ma_ma_home_dir_buff[FN_REFLEN]= {0};
|
||||||
ulong my_stream_opened=0,my_file_opened=0, my_tmp_file_created=0;
|
ulong ma_stream_opened=0,ma_file_opened=0, ma_tmp_file_created=0;
|
||||||
int NEAR my_umask=0664, NEAR my_umask_dir=0777;
|
int NEAR ma_umask=0664, NEAR ma_umask_dir=0777;
|
||||||
#ifndef THREAD
|
#ifndef THREAD
|
||||||
int NEAR my_errno=0;
|
int NEAR my_errno=0;
|
||||||
#endif
|
#endif
|
||||||
struct my_file_info my_file_info[MY_NFILE]= {{0,UNOPEN}};
|
struct ma_file_info ma_file_info[MY_NFILE]= {{0,UNOPEN}};
|
||||||
|
|
||||||
/* From mf_brkhant */
|
/* From mf_brkhant */
|
||||||
int NEAR my_dont_interrupt=0;
|
int NEAR ma_dont_interrupt=0;
|
||||||
volatile int _my_signals=0;
|
volatile int _ma_signals=0;
|
||||||
struct st_remember _my_sig_remember[MAX_SIGNALS]={{0,0}};
|
struct st_remember _ma_sig_remember[MAX_SIGNALS]={{0,0}};
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
sigset_t my_signals; /* signals blocked by mf_brkhant */
|
sigset_t my_signals; /* signals blocked by mf_brkhant */
|
||||||
#endif
|
#endif
|
||||||
@@ -49,16 +49,16 @@ sigset_t my_signals; /* signals blocked by mf_brkhant */
|
|||||||
my_bool key_cache_inited=0;
|
my_bool key_cache_inited=0;
|
||||||
|
|
||||||
/* from mf_reccache.c */
|
/* from mf_reccache.c */
|
||||||
ulong my_default_record_cache_size=RECORD_CACHE_SIZE;
|
ulong ma_default_record_cache_size=RECORD_CACHE_SIZE;
|
||||||
|
|
||||||
/* from soundex.c */
|
/* from soundex.c */
|
||||||
/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
|
/* ABCDEFGHIJKLMNOPQRSTUVWXYZ */
|
||||||
/* :::::::::::::::::::::::::: */
|
/* :::::::::::::::::::::::::: */
|
||||||
const char *soundex_map= "01230120022455012623010202";
|
const char *ma_soundex_map= "01230120022455012623010202";
|
||||||
|
|
||||||
/* from my_malloc */
|
/* from ma_malloc */
|
||||||
USED_MEM* my_once_root_block=0; /* pointer to first block */
|
USED_MEM* ma_once_root_block=0; /* pointer to first block */
|
||||||
uint my_once_extra=ONCE_ALLOC_INIT; /* Memory to alloc / block */
|
uint ma_once_extra=ONCE_ALLOC_INIT; /* Memory to alloc / block */
|
||||||
|
|
||||||
/* from my_tempnam */
|
/* from my_tempnam */
|
||||||
#if !defined(HAVE_TEMPNAM) || defined(HPUX11)
|
#if !defined(HAVE_TEMPNAM) || defined(HPUX11)
|
||||||
@@ -78,22 +78,22 @@ uint cNewCount = 0; /* Number of times NEW() was called */
|
|||||||
struct remember *pRememberRoot = NULL;
|
struct remember *pRememberRoot = NULL;
|
||||||
|
|
||||||
/* from my_alarm */
|
/* from my_alarm */
|
||||||
int volatile my_have_got_alarm=0; /* declare variable to reset */
|
int volatile ma_have_got_alarm=0; /* declare variable to reset */
|
||||||
ulong my_time_to_wait_for_lock=2; /* In seconds */
|
ulong ma_time_to_wait_for_lock=2; /* In seconds */
|
||||||
|
|
||||||
/* from errors.c */
|
/* from errors.c */
|
||||||
#ifdef SHARED_LIBRARY
|
#ifdef SHARED_LIBRARY
|
||||||
char * NEAR globerrs[GLOBERRS]; /* my_error_messages is here */
|
char * NEAR ma_globerrs[GLOBERRS]; /* ma_error_messages is here */
|
||||||
#endif
|
#endif
|
||||||
void (*my_abort_hook)(int) = (void(*)(int)) exit;
|
void (*my_abort_hook)(int) = (void(*)(int)) exit;
|
||||||
int (*error_handler_hook)(uint error,const char *str,myf MyFlags)=
|
int (*ma_error_handler_hook)(uint error,const char *str,myf MyFlags)=
|
||||||
my_message_no_curses;
|
ma_message_no_curses;
|
||||||
int (*fatal_error_handler_hook)(uint error,const char *str,myf MyFlags)=
|
int (*fatal_ma_error_handler_hook)(uint error,const char *str,myf MyFlags)=
|
||||||
my_message_no_curses;
|
ma_message_no_curses;
|
||||||
|
|
||||||
/* How to disable options */
|
/* How to disable options */
|
||||||
my_bool NEAR my_disable_locking=0;
|
my_bool NEAR ma_disable_locking=0;
|
||||||
my_bool NEAR my_disable_async_io=0;
|
my_bool NEAR ma_disable_async_io=0;
|
||||||
my_bool NEAR my_disable_flush_key_blocks=0;
|
my_bool NEAR ma_disable_flush_key_blocks=0;
|
||||||
my_bool NEAR my_disable_symlinks=0;
|
my_bool NEAR ma_disable_symlinks=0;
|
||||||
my_bool NEAR mysys_uses_curses=0;
|
my_bool NEAR mysys_uses_curses=0;
|
||||||
|
@@ -47,15 +47,15 @@ struct remember {
|
|||||||
char aData[1];
|
char aData[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern char NEAR curr_dir[FN_REFLEN],NEAR home_dir_buff[FN_REFLEN];
|
extern char NEAR ma_cur_dir[FN_REFLEN],NEAR ma_ma_ma_ma_ma_ma_home_dir_buff[FN_REFLEN];
|
||||||
|
|
||||||
extern volatile int _my_signals;
|
extern volatile int _ma_signals;
|
||||||
extern struct st_remember _my_sig_remember[MAX_SIGNALS];
|
extern struct st_remember _ma_sig_remember[MAX_SIGNALS];
|
||||||
|
|
||||||
extern const char *soundex_map;
|
extern const char *ma_soundex_map;
|
||||||
|
|
||||||
extern USED_MEM* my_once_root_block;
|
extern USED_MEM* ma_once_root_block;
|
||||||
extern uint my_once_extra;
|
extern uint ma_once_extra;
|
||||||
|
|
||||||
#if !defined(HAVE_TEMPNAM) || defined(HPUX11)
|
#if !defined(HAVE_TEMPNAM) || defined(HPUX11)
|
||||||
extern int _my_tempnam_used;
|
extern int _my_tempnam_used;
|
||||||
|
@@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
MEM_ROOT fields_alloc_root;
|
MEM_ROOT fields_ma_alloc_root;
|
||||||
} MADB_STMT_EXTENSION;
|
} MADB_STMT_EXTENSION;
|
||||||
|
|
||||||
static my_bool is_not_null= 0;
|
static my_bool is_not_null= 0;
|
||||||
@@ -178,7 +178,7 @@ int mthd_stmt_read_all_rows(MYSQL_STMT *stmt)
|
|||||||
if (packet_len > 7 || p[0] != 254)
|
if (packet_len > 7 || p[0] != 254)
|
||||||
{
|
{
|
||||||
/* allocate space for rows */
|
/* allocate space for rows */
|
||||||
if (!(current= (MYSQL_ROWS *)alloc_root(&result->alloc, sizeof(MYSQL_ROWS) + packet_len)))
|
if (!(current= (MYSQL_ROWS *)ma_alloc_root(&result->alloc, sizeof(MYSQL_ROWS) + packet_len)))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@@ -285,7 +285,7 @@ static int stmt_cursor_fetch(MYSQL_STMT *stmt, uchar **row)
|
|||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
/* free previously allocated buffer */
|
/* free previously allocated buffer */
|
||||||
free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
|
ma_free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
|
||||||
result->data= 0;
|
result->data= 0;
|
||||||
result->rows= 0;
|
result->rows= 0;
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ unsigned char* mysql_stmt_execute_generate_request(MYSQL_STMT *stmt, size_t *req
|
|||||||
DBUG_ENTER("mysql_stmt_execute_generate_request");
|
DBUG_ENTER("mysql_stmt_execute_generate_request");
|
||||||
|
|
||||||
/* preallocate length bytes */
|
/* preallocate length bytes */
|
||||||
if (!(start= p= (uchar *)my_malloc(length, MYF(MY_WME | MY_ZEROFILL))))
|
if (!(start= p= (uchar *)ma_malloc(length, MYF(MY_WME | MY_ZEROFILL))))
|
||||||
goto mem_error;
|
goto mem_error;
|
||||||
|
|
||||||
int4store(p, stmt->stmt_id);
|
int4store(p, stmt->stmt_id);
|
||||||
@@ -597,7 +597,7 @@ unsigned char* mysql_stmt_execute_generate_request(MYSQL_STMT *stmt, size_t *req
|
|||||||
{
|
{
|
||||||
size_t offset= p - start;
|
size_t offset= p - start;
|
||||||
length+= offset + null_count + 20;
|
length+= offset + null_count + 20;
|
||||||
if (!(start= (uchar *)my_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL))))
|
if (!(start= (uchar *)ma_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL))))
|
||||||
goto mem_error;
|
goto mem_error;
|
||||||
p= start + offset;
|
p= start + offset;
|
||||||
}
|
}
|
||||||
@@ -621,7 +621,7 @@ unsigned char* mysql_stmt_execute_generate_request(MYSQL_STMT *stmt, size_t *req
|
|||||||
{
|
{
|
||||||
size_t offset= p - start;
|
size_t offset= p - start;
|
||||||
length= offset + stmt->param_count * 2 + 20;
|
length= offset + stmt->param_count * 2 + 20;
|
||||||
if (!(start= (uchar *)my_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL))))
|
if (!(start= (uchar *)ma_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL))))
|
||||||
goto mem_error;
|
goto mem_error;
|
||||||
p= start + offset;
|
p= start + offset;
|
||||||
}
|
}
|
||||||
@@ -676,7 +676,7 @@ unsigned char* mysql_stmt_execute_generate_request(MYSQL_STMT *stmt, size_t *req
|
|||||||
{
|
{
|
||||||
size_t offset= p - start;
|
size_t offset= p - start;
|
||||||
length= offset + data_size + 20;
|
length= offset + data_size + 20;
|
||||||
if (!(start= (uchar *)my_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL))))
|
if (!(start= (uchar *)ma_realloc((gptr)start, length, MYF(MY_WME | MY_ZEROFILL))))
|
||||||
goto mem_error;
|
goto mem_error;
|
||||||
p= start + offset;
|
p= start + offset;
|
||||||
}
|
}
|
||||||
@@ -702,7 +702,7 @@ unsigned char* mysql_stmt_execute_generate_request(MYSQL_STMT *stmt, size_t *req
|
|||||||
|
|
||||||
mem_error:
|
mem_error:
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
my_free(start);
|
ma_free(start);
|
||||||
*request_len= 0;
|
*request_len= 0;
|
||||||
DBUG_RETURN(NULL);
|
DBUG_RETURN(NULL);
|
||||||
}
|
}
|
||||||
@@ -798,7 +798,7 @@ my_bool STDCALL mysql_stmt_bind_param(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
|||||||
stmt->param_count= param_count;
|
stmt->param_count= param_count;
|
||||||
if (stmt->param_count)
|
if (stmt->param_count)
|
||||||
{
|
{
|
||||||
if (!(stmt->params= (MYSQL_BIND *)alloc_root(&stmt->mem_root, stmt->param_count * sizeof(MYSQL_BIND))))
|
if (!(stmt->params= (MYSQL_BIND *)ma_alloc_root(&stmt->mem_root, stmt->param_count * sizeof(MYSQL_BIND))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@@ -913,10 +913,10 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
|||||||
|
|
||||||
if (stmt->field_count && !stmt->bind)
|
if (stmt->field_count && !stmt->bind)
|
||||||
{
|
{
|
||||||
MEM_ROOT *fields_alloc_root=
|
MEM_ROOT *fields_ma_alloc_root=
|
||||||
&((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root;
|
&((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
|
||||||
// free_root(fields_alloc_root, MYF(0));
|
// ma_free_root(fields_ma_alloc_root, MYF(0));
|
||||||
if (!(stmt->bind= (MYSQL_BIND *)alloc_root(fields_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
|
if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@@ -981,12 +981,12 @@ my_bool STDCALL mysql_stmt_bind_result(MYSQL_STMT *stmt, MYSQL_BIND *bind)
|
|||||||
static my_bool net_stmt_close(MYSQL_STMT *stmt, my_bool remove)
|
static my_bool net_stmt_close(MYSQL_STMT *stmt, my_bool remove)
|
||||||
{
|
{
|
||||||
char stmt_id[STMT_ID_LENGTH];
|
char stmt_id[STMT_ID_LENGTH];
|
||||||
MEM_ROOT *fields_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root;
|
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
|
||||||
|
|
||||||
/* clear memory */
|
/* clear memory */
|
||||||
free_root(&stmt->result.alloc, MYF(0)); /* allocated in mysql_stmt_store_result */
|
ma_free_root(&stmt->result.alloc, MYF(0)); /* allocated in mysql_stmt_store_result */
|
||||||
free_root(&stmt->mem_root,MYF(0));
|
ma_free_root(&stmt->mem_root,MYF(0));
|
||||||
free_root(fields_alloc_root, MYF(0));
|
ma_free_root(fields_ma_alloc_root, MYF(0));
|
||||||
|
|
||||||
if (stmt->mysql)
|
if (stmt->mysql)
|
||||||
{
|
{
|
||||||
@@ -1025,8 +1025,8 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
|
|||||||
|
|
||||||
net_stmt_close(stmt, 1);
|
net_stmt_close(stmt, 1);
|
||||||
|
|
||||||
my_free(stmt->extension);
|
ma_free(stmt->extension);
|
||||||
my_free(stmt);
|
ma_free(stmt);
|
||||||
|
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
@@ -1162,11 +1162,11 @@ MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql)
|
|||||||
MYSQL_STMT *stmt;
|
MYSQL_STMT *stmt;
|
||||||
DBUG_ENTER("mysql_stmt_init");
|
DBUG_ENTER("mysql_stmt_init");
|
||||||
|
|
||||||
if (!(stmt= (MYSQL_STMT *)my_malloc(sizeof(MYSQL_STMT), MYF(MY_WME | MY_ZEROFILL))) ||
|
if (!(stmt= (MYSQL_STMT *)ma_malloc(sizeof(MYSQL_STMT), MYF(MY_WME | MY_ZEROFILL))) ||
|
||||||
!(stmt->extension= (MADB_STMT_EXTENSION *)my_malloc(sizeof(MADB_STMT_EXTENSION),
|
!(stmt->extension= (MADB_STMT_EXTENSION *)ma_malloc(sizeof(MADB_STMT_EXTENSION),
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
my_free(stmt);
|
ma_free(stmt);
|
||||||
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
DBUG_RETURN(NULL);
|
DBUG_RETURN(NULL);
|
||||||
}
|
}
|
||||||
@@ -1187,9 +1187,9 @@ MYSQL_STMT * STDCALL mysql_stmt_init(MYSQL *mysql)
|
|||||||
/* set default */
|
/* set default */
|
||||||
stmt->prefetch_rows= 1;
|
stmt->prefetch_rows= 1;
|
||||||
|
|
||||||
init_alloc_root(&stmt->mem_root, 2048, 0);
|
ma_init_ma_alloc_root(&stmt->mem_root, 2048, 0);
|
||||||
init_alloc_root(&stmt->result.alloc, 4096, 0);
|
ma_init_ma_alloc_root(&stmt->result.alloc, 4096, 0);
|
||||||
init_alloc_root(&((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root, 2048, 0);
|
ma_init_ma_alloc_root(&((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root, 2048, 0);
|
||||||
|
|
||||||
DBUG_RETURN(stmt);
|
DBUG_RETURN(stmt);
|
||||||
}
|
}
|
||||||
@@ -1243,12 +1243,12 @@ my_bool mthd_stmt_get_param_metadata(MYSQL_STMT *stmt)
|
|||||||
my_bool mthd_stmt_get_result_metadata(MYSQL_STMT *stmt)
|
my_bool mthd_stmt_get_result_metadata(MYSQL_STMT *stmt)
|
||||||
{
|
{
|
||||||
MYSQL_DATA *result;
|
MYSQL_DATA *result;
|
||||||
MEM_ROOT *fields_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root;
|
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
|
||||||
DBUG_ENTER("stmt_read_result_metadata");
|
DBUG_ENTER("stmt_read_result_metadata");
|
||||||
|
|
||||||
if (!(result= stmt->mysql->methods->db_read_rows(stmt->mysql, (MYSQL_FIELD *)0, 7)))
|
if (!(result= stmt->mysql->methods->db_read_rows(stmt->mysql, (MYSQL_FIELD *)0, 7)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (!(stmt->fields= unpack_fields(result,fields_alloc_root,
|
if (!(stmt->fields= unpack_fields(result,fields_ma_alloc_root,
|
||||||
stmt->field_count, 0,
|
stmt->field_count, 0,
|
||||||
stmt->mysql->server_capabilities & CLIENT_LONG_FLAG)))
|
stmt->mysql->server_capabilities & CLIENT_LONG_FLAG)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@@ -1289,8 +1289,8 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t lengt
|
|||||||
if (mysql_stmt_reset(stmt))
|
if (mysql_stmt_reset(stmt))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
free_root(&stmt->mem_root, MYF(MY_KEEP_PREALLOC));
|
ma_free_root(&stmt->mem_root, MYF(MY_KEEP_PREALLOC));
|
||||||
free_root(&((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root, MYF(0));
|
ma_free_root(&((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root, MYF(0));
|
||||||
|
|
||||||
stmt->param_count= 0;
|
stmt->param_count= 0;
|
||||||
stmt->field_count= 0;
|
stmt->field_count= 0;
|
||||||
@@ -1326,7 +1326,7 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t lengt
|
|||||||
}
|
}
|
||||||
if (stmt->param_count)
|
if (stmt->param_count)
|
||||||
{
|
{
|
||||||
if (!(stmt->params= (MYSQL_BIND *)alloc_root(&stmt->mem_root, stmt->param_count * sizeof(MYSQL_BIND))))
|
if (!(stmt->params= (MYSQL_BIND *)ma_alloc_root(&stmt->mem_root, stmt->param_count * sizeof(MYSQL_BIND))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -1336,8 +1336,8 @@ int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t lengt
|
|||||||
/* allocated bind buffer for result */
|
/* allocated bind buffer for result */
|
||||||
if (stmt->field_count)
|
if (stmt->field_count)
|
||||||
{
|
{
|
||||||
MEM_ROOT *fields_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root;
|
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
|
||||||
if (!(stmt->bind= (MYSQL_BIND *)alloc_root(fields_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
|
if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto fail;
|
goto fail;
|
||||||
@@ -1402,7 +1402,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
|
|||||||
if (stmt->mysql->methods->db_stmt_read_all_rows(stmt))
|
if (stmt->mysql->methods->db_stmt_read_all_rows(stmt))
|
||||||
{
|
{
|
||||||
/* error during read - reset stmt->data */
|
/* error during read - reset stmt->data */
|
||||||
free_root(&stmt->result.alloc, 0);
|
ma_free_root(&stmt->result.alloc, 0);
|
||||||
stmt->result.data= NULL;
|
stmt->result.data= NULL;
|
||||||
stmt->result.rows= 0;
|
stmt->result.rows= 0;
|
||||||
stmt->mysql->status= MYSQL_STATUS_READY;
|
stmt->mysql->status= MYSQL_STATUS_READY;
|
||||||
@@ -1436,14 +1436,14 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
|
|||||||
static int madb_alloc_stmt_fields(MYSQL_STMT *stmt)
|
static int madb_alloc_stmt_fields(MYSQL_STMT *stmt)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
MEM_ROOT *fields_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root;
|
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
|
||||||
|
|
||||||
DBUG_ENTER("madb_alloc_stmt_fields");
|
DBUG_ENTER("madb_alloc_stmt_fields");
|
||||||
|
|
||||||
if (stmt->mysql->field_count)
|
if (stmt->mysql->field_count)
|
||||||
{
|
{
|
||||||
free_root(fields_alloc_root, MYF(0));
|
ma_free_root(fields_ma_alloc_root, MYF(0));
|
||||||
if (!(stmt->fields= (MYSQL_FIELD *)alloc_root(fields_alloc_root,
|
if (!(stmt->fields= (MYSQL_FIELD *)ma_alloc_root(fields_ma_alloc_root,
|
||||||
sizeof(MYSQL_FIELD) * stmt->mysql->field_count)))
|
sizeof(MYSQL_FIELD) * stmt->mysql->field_count)))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
@@ -1454,18 +1454,18 @@ static int madb_alloc_stmt_fields(MYSQL_STMT *stmt)
|
|||||||
for (i=0; i < stmt->field_count; i++)
|
for (i=0; i < stmt->field_count; i++)
|
||||||
{
|
{
|
||||||
if (stmt->mysql->fields[i].db)
|
if (stmt->mysql->fields[i].db)
|
||||||
stmt->fields[i].db= strdup_root(fields_alloc_root, stmt->mysql->fields[i].db);
|
stmt->fields[i].db= ma_strdup_root(fields_ma_alloc_root, stmt->mysql->fields[i].db);
|
||||||
if (stmt->mysql->fields[i].table)
|
if (stmt->mysql->fields[i].table)
|
||||||
stmt->fields[i].table= strdup_root(fields_alloc_root, stmt->mysql->fields[i].table);
|
stmt->fields[i].table= ma_strdup_root(fields_ma_alloc_root, stmt->mysql->fields[i].table);
|
||||||
if (stmt->mysql->fields[i].org_table)
|
if (stmt->mysql->fields[i].org_table)
|
||||||
stmt->fields[i].org_table= strdup_root(fields_alloc_root, stmt->mysql->fields[i].org_table);
|
stmt->fields[i].org_table= ma_strdup_root(fields_ma_alloc_root, stmt->mysql->fields[i].org_table);
|
||||||
if (stmt->mysql->fields[i].name)
|
if (stmt->mysql->fields[i].name)
|
||||||
stmt->fields[i].name= strdup_root(fields_alloc_root, stmt->mysql->fields[i].name);
|
stmt->fields[i].name= ma_strdup_root(fields_ma_alloc_root, stmt->mysql->fields[i].name);
|
||||||
if (stmt->mysql->fields[i].org_name)
|
if (stmt->mysql->fields[i].org_name)
|
||||||
stmt->fields[i].org_name= strdup_root(fields_alloc_root, stmt->mysql->fields[i].org_name);
|
stmt->fields[i].org_name= ma_strdup_root(fields_ma_alloc_root, stmt->mysql->fields[i].org_name);
|
||||||
if (stmt->mysql->fields[i].catalog)
|
if (stmt->mysql->fields[i].catalog)
|
||||||
stmt->fields[i].catalog= strdup_root(fields_alloc_root, stmt->mysql->fields[i].catalog);
|
stmt->fields[i].catalog= ma_strdup_root(fields_ma_alloc_root, stmt->mysql->fields[i].catalog);
|
||||||
stmt->fields[i].def= stmt->mysql->fields[i].def ? strdup_root(fields_alloc_root, stmt->mysql->fields[i].def) : NULL;
|
stmt->fields[i].def= stmt->mysql->fields[i].def ? ma_strdup_root(fields_ma_alloc_root, stmt->mysql->fields[i].def) : NULL;
|
||||||
stmt->fields[i].type= stmt->mysql->fields[i].type;
|
stmt->fields[i].type= stmt->mysql->fields[i].type;
|
||||||
stmt->fields[i].length= stmt->mysql->fields[i].length;
|
stmt->fields[i].length= stmt->mysql->fields[i].length;
|
||||||
stmt->fields[i].flags= stmt->mysql->fields[i].flags;
|
stmt->fields[i].flags= stmt->mysql->fields[i].flags;
|
||||||
@@ -1473,7 +1473,7 @@ static int madb_alloc_stmt_fields(MYSQL_STMT *stmt)
|
|||||||
stmt->fields[i].charsetnr= stmt->mysql->fields[i].charsetnr;
|
stmt->fields[i].charsetnr= stmt->mysql->fields[i].charsetnr;
|
||||||
stmt->fields[i].max_length= stmt->mysql->fields[i].max_length;
|
stmt->fields[i].max_length= stmt->mysql->fields[i].max_length;
|
||||||
}
|
}
|
||||||
if (!(stmt->bind= (MYSQL_BIND *)alloc_root(fields_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
|
if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
@@ -1526,14 +1526,14 @@ int stmt_read_execute_response(MYSQL_STMT *stmt)
|
|||||||
if (!stmt->field_count ||
|
if (!stmt->field_count ||
|
||||||
mysql->server_status & SERVER_MORE_RESULTS_EXIST) /* fix for ps_bug: test_misc */
|
mysql->server_status & SERVER_MORE_RESULTS_EXIST) /* fix for ps_bug: test_misc */
|
||||||
{
|
{
|
||||||
MEM_ROOT *fields_alloc_root=
|
MEM_ROOT *fields_ma_alloc_root=
|
||||||
&((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root;
|
&((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
|
||||||
uint i;
|
uint i;
|
||||||
|
|
||||||
free_root(fields_alloc_root, MYF(0));
|
ma_free_root(fields_ma_alloc_root, MYF(0));
|
||||||
if (!(stmt->bind= (MYSQL_BIND *)alloc_root(fields_alloc_root,
|
if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root,
|
||||||
sizeof(MYSQL_BIND) * mysql->field_count)) ||
|
sizeof(MYSQL_BIND) * mysql->field_count)) ||
|
||||||
!(stmt->fields= (MYSQL_FIELD *)alloc_root(fields_alloc_root,
|
!(stmt->fields= (MYSQL_FIELD *)ma_alloc_root(fields_ma_alloc_root,
|
||||||
sizeof(MYSQL_FIELD) * mysql->field_count)))
|
sizeof(MYSQL_FIELD) * mysql->field_count)))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
@@ -1544,18 +1544,18 @@ int stmt_read_execute_response(MYSQL_STMT *stmt)
|
|||||||
for (i=0; i < stmt->field_count; i++)
|
for (i=0; i < stmt->field_count; i++)
|
||||||
{
|
{
|
||||||
if (mysql->fields[i].db)
|
if (mysql->fields[i].db)
|
||||||
stmt->fields[i].db= strdup_root(fields_alloc_root, mysql->fields[i].db);
|
stmt->fields[i].db= ma_strdup_root(fields_ma_alloc_root, mysql->fields[i].db);
|
||||||
if (mysql->fields[i].table)
|
if (mysql->fields[i].table)
|
||||||
stmt->fields[i].table= strdup_root(fields_alloc_root, mysql->fields[i].table);
|
stmt->fields[i].table= ma_strdup_root(fields_ma_alloc_root, mysql->fields[i].table);
|
||||||
if (mysql->fields[i].org_table)
|
if (mysql->fields[i].org_table)
|
||||||
stmt->fields[i].org_table= strdup_root(fields_alloc_root, mysql->fields[i].org_table);
|
stmt->fields[i].org_table= ma_strdup_root(fields_ma_alloc_root, mysql->fields[i].org_table);
|
||||||
if (mysql->fields[i].name)
|
if (mysql->fields[i].name)
|
||||||
stmt->fields[i].name= strdup_root(fields_alloc_root, mysql->fields[i].name);
|
stmt->fields[i].name= ma_strdup_root(fields_ma_alloc_root, mysql->fields[i].name);
|
||||||
if (mysql->fields[i].org_name)
|
if (mysql->fields[i].org_name)
|
||||||
stmt->fields[i].org_name= strdup_root(fields_alloc_root, mysql->fields[i].org_name);
|
stmt->fields[i].org_name= ma_strdup_root(fields_ma_alloc_root, mysql->fields[i].org_name);
|
||||||
if (mysql->fields[i].catalog)
|
if (mysql->fields[i].catalog)
|
||||||
stmt->fields[i].catalog= strdup_root(fields_alloc_root, mysql->fields[i].catalog);
|
stmt->fields[i].catalog= ma_strdup_root(fields_ma_alloc_root, mysql->fields[i].catalog);
|
||||||
stmt->fields[i].def= mysql->fields[i].def ? strdup_root(fields_alloc_root, mysql->fields[i].def) : NULL;
|
stmt->fields[i].def= mysql->fields[i].def ? ma_strdup_root(fields_ma_alloc_root, mysql->fields[i].def) : NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1657,7 +1657,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
|
|||||||
/* clear data, in case mysql_stmt_store_result was called */
|
/* clear data, in case mysql_stmt_store_result was called */
|
||||||
if (stmt->result.data)
|
if (stmt->result.data)
|
||||||
{
|
{
|
||||||
free_root(&stmt->result.alloc, MYF(MY_KEEP_PREALLOC));
|
ma_free_root(&stmt->result.alloc, MYF(MY_KEEP_PREALLOC));
|
||||||
stmt->result_cursor= stmt->result.data= 0;
|
stmt->result_cursor= stmt->result.data= 0;
|
||||||
stmt->result.rows= 0;
|
stmt->result.rows= 0;
|
||||||
}
|
}
|
||||||
@@ -1668,7 +1668,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
|
|||||||
request_len, 1, stmt);
|
request_len, 1, stmt);
|
||||||
|
|
||||||
if (request)
|
if (request)
|
||||||
my_free(request);
|
ma_free(request);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
@@ -1710,7 +1710,7 @@ static my_bool madb_reset_stmt(MYSQL_STMT *stmt, unsigned int flags)
|
|||||||
if (flags & MADB_RESET_STORED &&
|
if (flags & MADB_RESET_STORED &&
|
||||||
stmt->result_cursor)
|
stmt->result_cursor)
|
||||||
{
|
{
|
||||||
free_root(&stmt->result.alloc, MYF(MY_KEEP_PREALLOC));
|
ma_free_root(&stmt->result.alloc, MYF(MY_KEEP_PREALLOC));
|
||||||
stmt->result.data= NULL;
|
stmt->result.data= NULL;
|
||||||
stmt->result.rows= 0;
|
stmt->result.rows= 0;
|
||||||
stmt->result_cursor= NULL;
|
stmt->result_cursor= NULL;
|
||||||
@@ -1833,7 +1833,7 @@ MYSQL_RES * STDCALL mysql_stmt_result_metadata(MYSQL_STMT *stmt)
|
|||||||
DBUG_RETURN(NULL);
|
DBUG_RETURN(NULL);
|
||||||
|
|
||||||
/* aloocate result set structutr and copy stmt information */
|
/* aloocate result set structutr and copy stmt information */
|
||||||
if (!(res= (MYSQL_RES *)my_malloc(sizeof(MYSQL_RES), MYF(MY_WME | MY_ZEROFILL))))
|
if (!(res= (MYSQL_RES *)ma_malloc(sizeof(MYSQL_RES), MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
DBUG_RETURN(NULL);
|
DBUG_RETURN(NULL);
|
||||||
@@ -1901,14 +1901,14 @@ my_bool STDCALL mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
size_t packet_len;
|
size_t packet_len;
|
||||||
uchar *cmd_buff= (uchar *)my_malloc(packet_len= STMT_ID_LENGTH + 2 + length, MYF(MY_WME | MY_ZEROFILL));
|
uchar *cmd_buff= (uchar *)ma_malloc(packet_len= STMT_ID_LENGTH + 2 + length, MYF(MY_WME | MY_ZEROFILL));
|
||||||
int4store(cmd_buff, stmt->stmt_id);
|
int4store(cmd_buff, stmt->stmt_id);
|
||||||
int2store(cmd_buff + STMT_ID_LENGTH, param_number);
|
int2store(cmd_buff + STMT_ID_LENGTH, param_number);
|
||||||
memcpy(cmd_buff + STMT_ID_LENGTH + 2, data, length);
|
memcpy(cmd_buff + STMT_ID_LENGTH + 2, data, length);
|
||||||
stmt->params[param_number].long_data_used= 1;
|
stmt->params[param_number].long_data_used= 1;
|
||||||
ret= stmt->mysql->methods->db_command(stmt->mysql, COM_STMT_SEND_LONG_DATA,
|
ret= stmt->mysql->methods->db_command(stmt->mysql, COM_STMT_SEND_LONG_DATA,
|
||||||
(char *)cmd_buff, packet_len, 1, stmt);
|
(char *)cmd_buff, packet_len, 1, stmt);
|
||||||
my_free(cmd_buff);
|
ma_free(cmd_buff);
|
||||||
DBUG_RETURN(ret);
|
DBUG_RETURN(ret);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
@@ -2049,8 +2049,8 @@ int STDCALL mariadb_stmt_execute_direct(MYSQL_STMT *stmt,
|
|||||||
/* allocated bind buffer for result */
|
/* allocated bind buffer for result */
|
||||||
if (stmt->field_count)
|
if (stmt->field_count)
|
||||||
{
|
{
|
||||||
MEM_ROOT *fields_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root;
|
MEM_ROOT *fields_ma_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_ma_alloc_root;
|
||||||
if (!(stmt->bind= (MYSQL_BIND *)alloc_root(fields_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
|
if (!(stmt->bind= (MYSQL_BIND *)ma_alloc_root(fields_ma_alloc_root, stmt->field_count * sizeof(MYSQL_BIND))))
|
||||||
{
|
{
|
||||||
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
SET_CLIENT_STMT_ERROR(stmt, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@@ -53,7 +53,7 @@ int my_readlink(char *to, const char *filename, myf MyFlags)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (MyFlags & MY_WME)
|
if (MyFlags & MY_WME)
|
||||||
my_error(EE_CANT_READLINK, MYF(0), filename, errno);
|
ma_error(EE_CANT_READLINK, MYF(0), filename, errno);
|
||||||
result= -1;
|
result= -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ int my_symlink(const char *content, const char *linkname, myf MyFlags)
|
|||||||
result= -1;
|
result= -1;
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & MY_WME)
|
if (MyFlags & MY_WME)
|
||||||
my_error(EE_CANT_SYMLINK, MYF(0), linkname, content, errno);
|
ma_error(EE_CANT_SYMLINK, MYF(0), linkname, content, errno);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result);
|
||||||
#endif /* HAVE_READLINK */
|
#endif /* HAVE_READLINK */
|
||||||
@@ -123,7 +123,7 @@ int my_realpath(char *to, const char *filename, myf MyFlags)
|
|||||||
/* Realpath didn't work; Use original name */
|
/* Realpath didn't work; Use original name */
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & MY_WME)
|
if (MyFlags & MY_WME)
|
||||||
my_error(EE_REALPATH, MYF(0), filename, my_errno);
|
ma_error(EE_REALPATH, MYF(0), filename, my_errno);
|
||||||
if (to != filename)
|
if (to != filename)
|
||||||
strmov(to,filename);
|
strmov(to,filename);
|
||||||
result= -1;
|
result= -1;
|
||||||
|
@@ -26,9 +26,9 @@
|
|||||||
|
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
#ifdef USE_TLS
|
#ifdef USE_TLS
|
||||||
pthread_key(struct st_my_thread_var*, THR_KEY_mysys);
|
pthread_key(struct st_ma_thread_var*, THR_KEY_mysys);
|
||||||
#else
|
#else
|
||||||
pthread_key(struct st_my_thread_var, THR_KEY_mysys);
|
pthread_key(struct st_ma_thread_var, THR_KEY_mysys);
|
||||||
#endif /* USE_TLS */
|
#endif /* USE_TLS */
|
||||||
pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,
|
pthread_mutex_t THR_LOCK_malloc,THR_LOCK_open,
|
||||||
THR_LOCK_lock, THR_LOCK_net, THR_LOCK_mysys;
|
THR_LOCK_lock, THR_LOCK_net, THR_LOCK_mysys;
|
||||||
@@ -50,7 +50,7 @@ my_bool THR_KEY_mysys_initialized= FALSE;
|
|||||||
the function my_thread_global_free must be called from
|
the function my_thread_global_free must be called from
|
||||||
somewhere before final exit of the library */
|
somewhere before final exit of the library */
|
||||||
|
|
||||||
my_bool my_thread_global_init(void)
|
my_bool ma_thread_global_init(void)
|
||||||
{
|
{
|
||||||
if (pthread_key_create(&THR_KEY_mysys,free))
|
if (pthread_key_create(&THR_KEY_mysys,free))
|
||||||
{
|
{
|
||||||
@@ -80,10 +80,10 @@ my_bool my_thread_global_init(void)
|
|||||||
#ifndef HAVE_LOCALTIME_R
|
#ifndef HAVE_LOCALTIME_R
|
||||||
pthread_mutex_init(&LOCK_localtime_r,MY_MUTEX_INIT_SLOW);
|
pthread_mutex_init(&LOCK_localtime_r,MY_MUTEX_INIT_SLOW);
|
||||||
#endif
|
#endif
|
||||||
return my_thread_init();
|
return ma_thread_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void my_thread_global_end(void)
|
void ma_thread_global_end(void)
|
||||||
{
|
{
|
||||||
#if defined(USE_TLS)
|
#if defined(USE_TLS)
|
||||||
(void) TlsFree(THR_KEY_mysys);
|
(void) TlsFree(THR_KEY_mysys);
|
||||||
@@ -108,19 +108,19 @@ static long thread_id=0;
|
|||||||
the pthread_self thread specific variable is initialized.
|
the pthread_self thread specific variable is initialized.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
my_bool my_thread_init(void)
|
my_bool ma_thread_init(void)
|
||||||
{
|
{
|
||||||
struct st_my_thread_var *tmp;
|
struct st_ma_thread_var *tmp;
|
||||||
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
|
if (my_pthread_getspecific(struct st_ma_thread_var *,THR_KEY_mysys))
|
||||||
{
|
{
|
||||||
DBUG_PRINT("info", ("my_thread_init was already called. Thread id: %lu",
|
DBUG_PRINT("info", ("ma_thread_init was already called. Thread id: %lu",
|
||||||
pthread_self()));
|
pthread_self()));
|
||||||
return 0; /* Safequard */
|
return 0; /* Safequard */
|
||||||
}
|
}
|
||||||
/* We must have many calloc() here because these are freed on
|
/* We must have many calloc() here because these are freed on
|
||||||
pthread_exit */
|
pthread_exit */
|
||||||
if (!(tmp=(struct st_my_thread_var *)
|
if (!(tmp=(struct st_ma_thread_var *)
|
||||||
calloc(1,sizeof(struct st_my_thread_var))))
|
calloc(1,sizeof(struct st_ma_thread_var))))
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -140,10 +140,10 @@ my_bool my_thread_init(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void my_thread_end(void)
|
void ma_thread_end(void)
|
||||||
{
|
{
|
||||||
struct st_my_thread_var *tmp=
|
struct st_ma_thread_var *tmp=
|
||||||
my_pthread_getspecific(struct st_my_thread_var *, THR_KEY_mysys);
|
my_pthread_getspecific(struct st_ma_thread_var *, THR_KEY_mysys);
|
||||||
|
|
||||||
if (tmp && tmp->initialized)
|
if (tmp && tmp->initialized)
|
||||||
{
|
{
|
||||||
@@ -173,15 +173,15 @@ void my_thread_end(void)
|
|||||||
pthread_setspecific(THR_KEY_mysys,0);
|
pthread_setspecific(THR_KEY_mysys,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct st_my_thread_var *_my_thread_var(void)
|
struct st_ma_thread_var *_ma_thread_var(void)
|
||||||
{
|
{
|
||||||
struct st_my_thread_var *tmp=
|
struct st_ma_thread_var *tmp=
|
||||||
my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
|
my_pthread_getspecific(struct st_ma_thread_var*,THR_KEY_mysys);
|
||||||
#if defined(USE_TLS)
|
#if defined(USE_TLS)
|
||||||
if (!tmp)
|
if (!tmp)
|
||||||
{
|
{
|
||||||
my_thread_init();
|
ma_thread_init();
|
||||||
tmp=my_pthread_getspecific(struct st_my_thread_var*,THR_KEY_mysys);
|
tmp=my_pthread_getspecific(struct st_ma_thread_var*,THR_KEY_mysys);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return tmp;
|
return tmp;
|
||||||
@@ -205,17 +205,17 @@ long my_thread_id()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DBUG_OFF
|
#ifdef DBUG_OFF
|
||||||
const char *my_thread_name(void)
|
const char *ma_thread_name(void)
|
||||||
{
|
{
|
||||||
return "no_name";
|
return "no_name";
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
const char *my_thread_name(void)
|
const char *ma_thread_name(void)
|
||||||
{
|
{
|
||||||
char name_buff[100];
|
char name_buff[100];
|
||||||
struct st_my_thread_var *tmp=my_thread_var;
|
struct st_ma_thread_var *tmp=my_thread_var;
|
||||||
if (!tmp->name[0])
|
if (!tmp->name[0])
|
||||||
{
|
{
|
||||||
long id=my_thread_id();
|
long id=my_thread_id();
|
||||||
@@ -227,7 +227,7 @@ const char *my_thread_name(void)
|
|||||||
|
|
||||||
extern void **my_thread_var_dbug()
|
extern void **my_thread_var_dbug()
|
||||||
{
|
{
|
||||||
struct st_my_thread_var *tmp;
|
struct st_ma_thread_var *tmp;
|
||||||
/*
|
/*
|
||||||
Instead of enforcing DBUG_ASSERT(THR_KEY_mysys_initialized) here,
|
Instead of enforcing DBUG_ASSERT(THR_KEY_mysys_initialized) here,
|
||||||
which causes any DBUG_ENTER and related traces to fail when
|
which causes any DBUG_ENTER and related traces to fail when
|
||||||
@@ -237,7 +237,7 @@ extern void **my_thread_var_dbug()
|
|||||||
*/
|
*/
|
||||||
if (! THR_KEY_mysys_initialized)
|
if (! THR_KEY_mysys_initialized)
|
||||||
return NULL;
|
return NULL;
|
||||||
tmp= _my_thread_var();
|
tmp= _ma_thread_var();
|
||||||
return tmp && tmp->initialized ? (void **)&tmp->dbug : 0;
|
return tmp && tmp->initialized ? (void **)&tmp->dbug : 0;
|
||||||
}
|
}
|
||||||
#endif /* DBUG_OFF */
|
#endif /* DBUG_OFF */
|
||||||
|
@@ -22,18 +22,18 @@
|
|||||||
#include <m_ctype.h>
|
#include <m_ctype.h>
|
||||||
|
|
||||||
|
|
||||||
int my_snprintf(char* to, size_t n, const char* fmt, ...)
|
int ma_snprintf(char* to, size_t n, const char* fmt, ...)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args,fmt);
|
va_start(args,fmt);
|
||||||
result= my_vsnprintf(to, n, fmt, args);
|
result= ma_vsnprintf(to, n, fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
|
int ma_vsnprintf(char *to, size_t n, const char* fmt, va_list ap)
|
||||||
{
|
{
|
||||||
char *start=to, *end=to+n-1;
|
char *start=to, *end=to+n-1;
|
||||||
for (; *fmt ; fmt++)
|
for (; *fmt ; fmt++)
|
||||||
@@ -92,7 +92,7 @@ static void my_printf(const char * fmt, ...)
|
|||||||
int n;
|
int n;
|
||||||
va_list ar;
|
va_list ar;
|
||||||
va_start(ar, fmt);
|
va_start(ar, fmt);
|
||||||
n = my_vsnprintf(buf, sizeof(buf),fmt, ar);
|
n = ma_vsnprintf(buf, sizeof(buf),fmt, ar);
|
||||||
printf(buf);
|
printf(buf);
|
||||||
printf("n=%d, strlen=%d\n", n, strlen(buf));
|
printf("n=%d, strlen=%d\n", n, strlen(buf));
|
||||||
va_end(ar);
|
va_end(ar);
|
||||||
|
@@ -53,7 +53,7 @@ uint my_write(int Filedes, const unsigned char *Buffer, uint Count, myf MyFlags)
|
|||||||
(uint) writenbytes != (uint) -1)
|
(uint) writenbytes != (uint) -1)
|
||||||
{
|
{
|
||||||
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
|
if (!(errors++ % MY_WAIT_GIVE_USER_A_MESSAGE))
|
||||||
my_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
|
ma_error(EE_DISK_FULL,MYF(ME_BELL | ME_NOREFRESH),
|
||||||
my_filename(Filedes));
|
my_filename(Filedes));
|
||||||
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
|
VOID(sleep(MY_WAIT_FOR_USER_TO_FIX_PANIC));
|
||||||
continue;
|
continue;
|
||||||
@@ -76,7 +76,7 @@ uint my_write(int Filedes, const unsigned char *Buffer, uint Count, myf MyFlags)
|
|||||||
{
|
{
|
||||||
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
||||||
{
|
{
|
||||||
my_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
|
ma_error(EE_WRITE, MYF(ME_BELL+ME_WAITTANG),
|
||||||
my_filename(Filedes),my_errno);
|
my_filename(Filedes),my_errno);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(MY_FILE_ERROR); /* Error on read */
|
DBUG_RETURN(MY_FILE_ERROR); /* Error on read */
|
||||||
|
@@ -114,7 +114,7 @@ static int net_write_buff(NET *net,const char *packet, size_t len);
|
|||||||
|
|
||||||
int my_net_init(NET *net, MARIADB_PVIO* pvio)
|
int my_net_init(NET *net, MARIADB_PVIO* pvio)
|
||||||
{
|
{
|
||||||
if (!(net->buff=(uchar*) my_malloc(net_buffer_length,MYF(MY_WME | MY_ZEROFILL))))
|
if (!(net->buff=(uchar*) ma_malloc(net_buffer_length,MYF(MY_WME | MY_ZEROFILL))))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* We don't allocate memory for multi buffer, since we don't know in advance if the server
|
/* We don't allocate memory for multi buffer, since we don't know in advance if the server
|
||||||
@@ -144,8 +144,8 @@ int my_net_init(NET *net, MARIADB_PVIO* pvio)
|
|||||||
|
|
||||||
void net_end(NET *net)
|
void net_end(NET *net)
|
||||||
{
|
{
|
||||||
my_free(net->buff);
|
ma_free(net->buff);
|
||||||
my_free(net->mbuff);
|
ma_free(net->mbuff);
|
||||||
net->buff=0;
|
net->buff=0;
|
||||||
net->mbuff= 0;
|
net->mbuff= 0;
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ static my_bool net_realloc(NET *net, my_bool is_multi, size_t length)
|
|||||||
pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1);
|
pkt_length = (length+IO_SIZE-1) & ~(IO_SIZE-1);
|
||||||
/* reallocate buffer:
|
/* reallocate buffer:
|
||||||
size= pkt_length + NET_HEADER_SIZE + COMP_HEADER_SIZE */
|
size= pkt_length + NET_HEADER_SIZE + COMP_HEADER_SIZE */
|
||||||
if (!(buff=(uchar*) my_realloc(is_multi ? net->mbuff : net->buff,
|
if (!(buff=(uchar*) ma_realloc(is_multi ? net->mbuff : net->buff,
|
||||||
pkt_length + NET_HEADER_SIZE + COMP_HEADER_SIZE,
|
pkt_length + NET_HEADER_SIZE + COMP_HEADER_SIZE,
|
||||||
MYF(MY_WME))))
|
MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
@@ -353,7 +353,7 @@ int net_add_multi_command(NET *net, uchar command, const uchar *packet,
|
|||||||
if (!net->mbuff)
|
if (!net->mbuff)
|
||||||
{
|
{
|
||||||
size_t alloc_size= (required_length + IO_SIZE - 1) & ~(IO_SIZE - 1);
|
size_t alloc_size= (required_length + IO_SIZE - 1) & ~(IO_SIZE - 1);
|
||||||
if (!(net->mbuff= (char *)my_malloc(alloc_size, MYF(MY_WME))))
|
if (!(net->mbuff= (char *)ma_malloc(alloc_size, MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
net->last_errno=ER_OUT_OF_RESOURCES;
|
net->last_errno=ER_OUT_OF_RESOURCES;
|
||||||
net->error=2;
|
net->error=2;
|
||||||
@@ -384,7 +384,7 @@ int net_add_multi_command(NET *net, uchar command, const uchar *packet,
|
|||||||
error:
|
error:
|
||||||
if (net->mbuff)
|
if (net->mbuff)
|
||||||
{
|
{
|
||||||
my_free(net->mbuff);
|
ma_free(net->mbuff);
|
||||||
net->mbuff= net->mbuff_pos= net->mbuff_end= 0;
|
net->mbuff= net->mbuff_pos= net->mbuff_end= 0;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -409,7 +409,7 @@ net_real_write(NET *net,const char *packet,size_t len)
|
|||||||
size_t complen;
|
size_t complen;
|
||||||
uchar *b;
|
uchar *b;
|
||||||
uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE;
|
uint header_length=NET_HEADER_SIZE+COMP_HEADER_SIZE;
|
||||||
if (!(b=(uchar*) my_malloc(len + NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
|
if (!(b=(uchar*) ma_malloc(len + NET_HEADER_SIZE + COMP_HEADER_SIZE + 1,
|
||||||
MYF(MY_WME))))
|
MYF(MY_WME))))
|
||||||
{
|
{
|
||||||
net->last_errno=ER_OUT_OF_RESOURCES;
|
net->last_errno=ER_OUT_OF_RESOURCES;
|
||||||
@@ -448,7 +448,7 @@ net_real_write(NET *net,const char *packet,size_t len)
|
|||||||
}
|
}
|
||||||
#ifdef HAVE_COMPRESS
|
#ifdef HAVE_COMPRESS
|
||||||
if (net->compress)
|
if (net->compress)
|
||||||
my_free((char*) packet);
|
ma_free((char*) packet);
|
||||||
#endif
|
#endif
|
||||||
net->reading_or_writing=0;
|
net->reading_or_writing=0;
|
||||||
DBUG_RETURN(((int) (pos != end)));
|
DBUG_RETURN(((int) (pos != end)));
|
||||||
|
@@ -58,7 +58,7 @@ static void ma_ssl_set_error(MYSQL *mysql, int ssl_errno)
|
|||||||
ssl_error_reason);
|
ssl_error_reason);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my_snprintf(ssl_error, MAX_SSL_ERR_LEN, "SSL errno=%lu", ssl_errno, mysql->charset);
|
ma_snprintf(ssl_error, MAX_SSL_ERR_LEN, "SSL errno=%lu", ssl_errno, mysql->charset);
|
||||||
pvio->set_error(mysql, CR_SSL_CONNECTION_ERROR, SQLSTATE_UNKNOWN,
|
pvio->set_error(mysql, CR_SSL_CONNECTION_ERROR, SQLSTATE_UNKNOWN,
|
||||||
ssl_error);
|
ssl_error);
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ static int ma_ssl_set_certs(MYSQL *mysql)
|
|||||||
|
|
||||||
error:
|
error:
|
||||||
if (cipher)
|
if (cipher)
|
||||||
my_free(cipher);
|
ma_free(cipher);
|
||||||
return ssl_error;
|
return ssl_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,8 +47,8 @@ typedef void VOID;
|
|||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_SCHANNEL_DEFAULT
|
#ifndef HAVE_SCHANNEL_DEFAULT
|
||||||
#define my_snprintf snprintf
|
#define ma_snprintf snprintf
|
||||||
#define my_vsnprintf vsnprintf
|
#define ma_vsnprintf vsnprintf
|
||||||
#undef SAFE_MUTEX
|
#undef SAFE_MUTEX
|
||||||
#endif
|
#endif
|
||||||
#include <my_pthread.h>
|
#include <my_pthread.h>
|
||||||
|
@@ -31,11 +31,11 @@
|
|||||||
|
|
||||||
#ifndef HAVE_OPENSSL_DEFAULT
|
#ifndef HAVE_OPENSSL_DEFAULT
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#define my_malloc(A,B) malloc((A))
|
#define ma_malloc(A,B) malloc((A))
|
||||||
#undef my_free
|
#undef ma_free
|
||||||
#define my_free(A) free((A))
|
#define ma_free(A) free((A))
|
||||||
#define my_snprintf snprintf
|
#define ma_snprintf snprintf
|
||||||
#define my_vsnprintf vsnprintf
|
#define ma_vsnprintf vsnprintf
|
||||||
#undef SAFE_MUTEX
|
#undef SAFE_MUTEX
|
||||||
#endif
|
#endif
|
||||||
#include <my_pthread.h>
|
#include <my_pthread.h>
|
||||||
@@ -126,7 +126,7 @@ static int ssl_thread_init()
|
|||||||
if (LOCK_crypto == NULL)
|
if (LOCK_crypto == NULL)
|
||||||
{
|
{
|
||||||
if (!(LOCK_crypto=
|
if (!(LOCK_crypto=
|
||||||
(pthread_mutex_t *)my_malloc(sizeof(pthread_mutex_t) * max, MYF(0))))
|
(pthread_mutex_t *)ma_malloc(sizeof(pthread_mutex_t) * max, MYF(0))))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (i=0; i < max; i++)
|
for (i=0; i < max; i++)
|
||||||
@@ -219,7 +219,7 @@ void ma_ssl_end()
|
|||||||
for (i=0; i < CRYPTO_num_locks(); i++)
|
for (i=0; i < CRYPTO_num_locks(); i++)
|
||||||
pthread_mutex_destroy(&LOCK_crypto[i]);
|
pthread_mutex_destroy(&LOCK_crypto[i]);
|
||||||
|
|
||||||
my_free((gptr)LOCK_crypto);
|
ma_free((gptr)LOCK_crypto);
|
||||||
LOCK_crypto= NULL;
|
LOCK_crypto= NULL;
|
||||||
|
|
||||||
if (SSL_context)
|
if (SSL_context)
|
||||||
@@ -572,7 +572,7 @@ unsigned int ma_ssl_get_finger_print(MARIADB_SSL *cssl, unsigned char *fp, unsig
|
|||||||
fp_len= len;
|
fp_len= len;
|
||||||
if (!X509_digest(cert, digest, fp, &fp_len))
|
if (!X509_digest(cert, digest, fp, &fp_len))
|
||||||
{
|
{
|
||||||
my_free(fp);
|
ma_free(fp);
|
||||||
my_set_error(mysql, CR_SSL_CONNECTION_ERROR, SQLSTATE_UNKNOWN,
|
my_set_error(mysql, CR_SSL_CONNECTION_ERROR, SQLSTATE_UNKNOWN,
|
||||||
ER(CR_SSL_CONNECTION_ERROR),
|
ER(CR_SSL_CONNECTION_ERROR),
|
||||||
"invalid finger print of server certificate");
|
"invalid finger print of server certificate");
|
||||||
|
@@ -38,7 +38,7 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
|
|||||||
if (!init_alloc)
|
if (!init_alloc)
|
||||||
init_alloc=alloc_increment;
|
init_alloc=alloc_increment;
|
||||||
|
|
||||||
if (!(str->str=(char*) my_malloc(init_alloc,MYF(MY_WME))))
|
if (!(str->str=(char*) ma_malloc(init_alloc,MYF(MY_WME))))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
str->length=length-1;
|
str->length=length-1;
|
||||||
if (init_str)
|
if (init_str)
|
||||||
@@ -60,7 +60,7 @@ my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
|
|||||||
str->alloc_increment;
|
str->alloc_increment;
|
||||||
if (!str->max_length)
|
if (!str->max_length)
|
||||||
str->max_length=str->alloc_increment;
|
str->max_length=str->alloc_increment;
|
||||||
if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME))))
|
if (!(str->str=(char*) ma_realloc(str->str,str->max_length,MYF(MY_WME))))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
if (init_str)
|
if (init_str)
|
||||||
@@ -83,7 +83,7 @@ my_bool dynstr_realloc(DYNAMIC_STRING *str, size_t additional_size)
|
|||||||
{
|
{
|
||||||
str->max_length=((str->length + additional_size+str->alloc_increment-1)/
|
str->max_length=((str->length + additional_size+str->alloc_increment-1)/
|
||||||
str->alloc_increment)*str->alloc_increment;
|
str->alloc_increment)*str->alloc_increment;
|
||||||
if (!(str->str=(char*) my_realloc(str->str,str->max_length,MYF(MY_WME))))
|
if (!(str->str=(char*) ma_realloc(str->str,str->max_length,MYF(MY_WME))))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
@@ -105,7 +105,7 @@ my_bool dynstr_append_mem(DYNAMIC_STRING *str, const char *append,
|
|||||||
size_t new_length=(str->length+length+str->alloc_increment)/
|
size_t new_length=(str->length+length+str->alloc_increment)/
|
||||||
str->alloc_increment;
|
str->alloc_increment;
|
||||||
new_length*=str->alloc_increment;
|
new_length*=str->alloc_increment;
|
||||||
if (!(new_ptr=(char*) my_realloc(str->str,new_length,MYF(MY_WME))))
|
if (!(new_ptr=(char*) ma_realloc(str->str,new_length,MYF(MY_WME))))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
str->str=new_ptr;
|
str->str=new_ptr;
|
||||||
str->max_length=new_length;
|
str->max_length=new_length;
|
||||||
@@ -121,7 +121,7 @@ void dynstr_free(DYNAMIC_STRING *str)
|
|||||||
{
|
{
|
||||||
if (str->str)
|
if (str->str)
|
||||||
{
|
{
|
||||||
my_free(str->str);
|
ma_free(str->str);
|
||||||
str->str=0;
|
str->str=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -31,12 +31,12 @@
|
|||||||
** If & 4 allow #number# as type
|
** If & 4 allow #number# as type
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int find_type(my_string x, TYPELIB *typelib, uint full_name)
|
int ma_find_type(my_string x, TYPELIB *typelib, uint full_name)
|
||||||
{
|
{
|
||||||
int find,pos,findpos= 0;
|
int find,pos,findpos= 0;
|
||||||
reg1 my_string i;
|
reg1 my_string i;
|
||||||
reg2 const char *j;
|
reg2 const char *j;
|
||||||
DBUG_ENTER("find_type");
|
DBUG_ENTER("ma_find_type");
|
||||||
DBUG_PRINT("enter",("x: '%s' lib: %lx",x,typelib));
|
DBUG_PRINT("enter",("x: '%s' lib: %lx",x,typelib));
|
||||||
|
|
||||||
if (!typelib->count)
|
if (!typelib->count)
|
||||||
@@ -78,27 +78,27 @@ int find_type(my_string x, TYPELIB *typelib, uint full_name)
|
|||||||
if (!(full_name & 2))
|
if (!(full_name & 2))
|
||||||
(void) strmov(x,typelib->type_names[findpos]);
|
(void) strmov(x,typelib->type_names[findpos]);
|
||||||
DBUG_RETURN(findpos+1);
|
DBUG_RETURN(findpos+1);
|
||||||
} /* find_type */
|
} /* ma_find_type */
|
||||||
|
|
||||||
|
|
||||||
/* Get name of type nr 'nr' */
|
/* Get name of type nr 'nr' */
|
||||||
/* Warning first type is 1, 0 = empty field */
|
/* Warning first type is 1, 0 = empty field */
|
||||||
|
|
||||||
void make_type(register my_string to, register uint nr, register TYPELIB *typelib)
|
void ma_make_type(register my_string to, register uint nr, register TYPELIB *typelib)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("make_type");
|
DBUG_ENTER("ma_make_type");
|
||||||
if (!nr)
|
if (!nr)
|
||||||
to[0]=0;
|
to[0]=0;
|
||||||
else
|
else
|
||||||
(void) strmov(to,get_type(typelib,nr-1));
|
(void) strmov(to,ma_get_type(typelib,nr-1));
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
} /* make_type */
|
} /* ma_make_type */
|
||||||
|
|
||||||
|
|
||||||
/* Get type */
|
/* Get type */
|
||||||
/* Warning first type is 0 */
|
/* Warning first type is 0 */
|
||||||
|
|
||||||
const char *get_type(TYPELIB *typelib, uint nr)
|
const char *ma_get_type(TYPELIB *typelib, uint nr)
|
||||||
{
|
{
|
||||||
if (nr < (uint) typelib->count && typelib->type_names)
|
if (nr < (uint) typelib->count && typelib->type_names)
|
||||||
return(typelib->type_names[nr]);
|
return(typelib->type_names[nr]);
|
||||||
|
@@ -44,7 +44,7 @@ void usage(void)
|
|||||||
int i=0;
|
int i=0;
|
||||||
puts("Copyright 2011-2015 MariaDB Corporation AB");
|
puts("Copyright 2011-2015 MariaDB Corporation AB");
|
||||||
puts("Get compiler flags for using the MariaDB Connector/C.");
|
puts("Get compiler flags for using the MariaDB Connector/C.");
|
||||||
printf("Usage: %s [OPTIONS]\n", my_progname);
|
printf("Usage: %s [OPTIONS]\n", ma_progname);
|
||||||
while (long_options[i].name)
|
while (long_options[i].name)
|
||||||
{
|
{
|
||||||
if (values[i])
|
if (values[i])
|
||||||
@@ -57,7 +57,7 @@ void usage(void)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int c;
|
int c;
|
||||||
my_progname= argv[0];
|
ma_progname= argv[0];
|
||||||
|
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
{
|
{
|
||||||
|
@@ -293,7 +293,7 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
|
|||||||
if (mpvio->db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
|
if (mpvio->db && (mysql->server_capabilities & CLIENT_CONNECT_WITH_DB))
|
||||||
{
|
{
|
||||||
end= strmake(end, mpvio->db, NAME_LEN) + 1;
|
end= strmake(end, mpvio->db, NAME_LEN) + 1;
|
||||||
mysql->db= my_strdup(mpvio->db, MYF(MY_WME));
|
mysql->db= ma_strdup(mpvio->db, MYF(MY_WME));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH)
|
if (mysql->server_capabilities & CLIENT_PLUGIN_AUTH)
|
||||||
|
@@ -687,7 +687,7 @@ my_bool pvio_socket_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
if (!pvio || !cinfo)
|
if (!pvio || !cinfo)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (!(csock= (struct st_pvio_socket *)my_malloc(sizeof(struct st_pvio_socket),
|
if (!(csock= (struct st_pvio_socket *)ma_malloc(sizeof(struct st_pvio_socket),
|
||||||
MYF(MY_WME | MY_ZEROFILL))))
|
MYF(MY_WME | MY_ZEROFILL))))
|
||||||
{
|
{
|
||||||
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0, "");
|
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, unknown_sqlstate, 0, "");
|
||||||
@@ -734,7 +734,7 @@ my_bool pvio_socket_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
int rc= 0;
|
int rc= 0;
|
||||||
|
|
||||||
bzero(&server_port, NI_MAXSERV);
|
bzero(&server_port, NI_MAXSERV);
|
||||||
my_snprintf(server_port, NI_MAXSERV, "%d", cinfo->port);
|
ma_snprintf(server_port, NI_MAXSERV, "%d", cinfo->port);
|
||||||
|
|
||||||
/* set hints for getaddrinfo */
|
/* set hints for getaddrinfo */
|
||||||
bzero(&hints, sizeof(hints));
|
bzero(&hints, sizeof(hints));
|
||||||
@@ -838,7 +838,7 @@ my_bool pvio_socket_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
|
|||||||
error:
|
error:
|
||||||
if (pvio->data)
|
if (pvio->data)
|
||||||
{
|
{
|
||||||
my_free((gptr)pvio->data);
|
ma_free((gptr)pvio->data);
|
||||||
pvio->data= NULL;
|
pvio->data= NULL;
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
@@ -862,7 +862,7 @@ my_bool pvio_socket_close(MARIADB_PVIO *pvio)
|
|||||||
r= closesocket(csock->socket);
|
r= closesocket(csock->socket);
|
||||||
csock->socket= -1;
|
csock->socket= -1;
|
||||||
}
|
}
|
||||||
my_free((gptr)pvio->data);
|
ma_free((gptr)pvio->data);
|
||||||
pvio->data= NULL;
|
pvio->data= NULL;
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
/*
|
/*
|
||||||
Visual Studio 2003 does not know vsnprintf but knows _vsnprintf.
|
Visual Studio 2003 does not know vsnprintf but knows _vsnprintf.
|
||||||
We don't put this #define in config-win.h because we prefer
|
We don't put this #define in config-win.h because we prefer
|
||||||
my_vsnprintf everywhere instead, except when linking with libmysys
|
ma_vsnprintf everywhere instead, except when linking with libmysys
|
||||||
is not desirable - the case here.
|
is not desirable - the case here.
|
||||||
*/
|
*/
|
||||||
#if defined(_MSC_VER) && ( _MSC_VER == 1310 )
|
#if defined(_MSC_VER) && ( _MSC_VER == 1310 )
|
||||||
|
Reference in New Issue
Block a user