diff options
author | Alexander Ivanov <alexi1952@yandex.ru> | 2009-10-16 15:20:09 +0400 |
---|---|---|
committer | Alexander Ivanov <alexi1952@yandex.ru> | 2009-10-16 15:20:09 +0400 |
commit | 6bc7eab161508115168359460b9d52aff153dbaf (patch) | |
tree | 51ca9db10993d7cc1a7697149266bbaf702e0657 | |
parent | 8ea19fa73e86a3c27917a92affd6a9e43763c7ce (diff) | |
download | mariadb-git-6bc7eab161508115168359460b9d52aff153dbaf.tar.gz |
MWL#36: Add a mysqlbinlog option to change the used database.
Make sql_alloc() declaration "public" for a client context.
The reason is that sql_alloc() is used in definition of some common
purpose stuff (e.g. sql_list.*). To make this stuff available for a
client context we declare sql_alloc() as a "virtual function", i.e.
as a function that is already declared but must be defined in this
context (note that definition of sql_alloc() in thr_malloc.cc is
#ifndef'ed for MYSQL_CLIENT).
Also make sql_string.h repeatedly includable.
-rw-r--r-- | client/sql_string.cc | 9 | ||||
-rw-r--r-- | sql/mysql_priv.h | 4 | ||||
-rw-r--r-- | sql/sql_string.cc | 9 | ||||
-rw-r--r-- | sql/sql_string.h | 4 | ||||
-rw-r--r-- | sql/thr_malloc.cc | 2 |
5 files changed, 10 insertions, 18 deletions
diff --git a/client/sql_string.cc b/client/sql_string.cc index dc6147b563f..9fa8fae2860 100644 --- a/client/sql_string.cc +++ b/client/sql_string.cc @@ -26,15 +26,6 @@ #ifdef HAVE_FCONVERT #include <floatingpoint.h> #endif - -/* - The following extern declarations are ok as these are interface functions - required by the string function -*/ - -extern void sql_alloc(size_t size); -extern void sql_element_free(void *ptr); - #include "sql_string.h" /***************************************************************************** diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h index 63d5621742e..50399d441a7 100644 --- a/sql/mysql_priv.h +++ b/sql/mysql_priv.h @@ -92,12 +92,16 @@ extern MYSQL_PLUGIN_IMPORT const char *primary_key_name; #include "unireg.h" void init_sql_alloc(MEM_ROOT *root, uint block_size, uint pre_alloc_size); +#endif // MYSQL_CLIENT + void *sql_alloc(size_t); void *sql_calloc(size_t); char *sql_strdup(const char *str); char *sql_strmake(const char *str, size_t len); void *sql_memdup(const void * ptr, size_t size); void sql_element_free(void *ptr); + +#ifndef MYSQL_CLIENT char *sql_strmake_with_convert(const char *str, size_t arg_length, CHARSET_INFO *from_cs, size_t max_res_length, diff --git a/sql/sql_string.cc b/sql/sql_string.cc index e9927c8e85c..a326e8a7ef0 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -26,15 +26,6 @@ #ifdef HAVE_FCONVERT #include <floatingpoint.h> #endif - -/* - The following extern declarations are ok as these are interface functions - required by the string function -*/ - -extern uchar* sql_alloc(unsigned size); -extern void sql_element_free(void *ptr); - #include "sql_string.h" /***************************************************************************** diff --git a/sql/sql_string.h b/sql/sql_string.h index 9e22f7b6a27..fbce21a966a 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -1,3 +1,5 @@ +#ifndef MYSQL_SQL_STRING_H_INCLUDED +#define MYSQL_SQL_STRING_H_INCLUDED /* Copyright (C) 2000 MySQL AB This program is free software; you can redistribute it and/or modify @@ -394,3 +396,5 @@ static inline bool check_if_only_end_space(CHARSET_INFO *cs, char *str, { return str+ cs->cset->scan(cs, str, end, MY_SEQ_SPACES) == end; } + +#endif // MYSQL_SQL_STRING_H_INCLUDED diff --git a/sql/thr_malloc.cc b/sql/thr_malloc.cc index 0764fe8be33..83c4a8ee2a0 100644 --- a/sql/thr_malloc.cc +++ b/sql/thr_malloc.cc @@ -59,11 +59,13 @@ void init_sql_alloc(MEM_ROOT *mem_root, uint block_size, uint pre_alloc) } +#ifndef MYSQL_CLIENT void *sql_alloc(size_t Size) { MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**,THR_MALLOC); return alloc_root(root,Size); } +#endif void *sql_calloc(size_t size) |