Skip to content

Commit e409d6f

Browse files
author
Mats Kindahl
committed
WL#5030: Split and remove mysql_priv.h
This patch: - Moves all definitions from the mysql_priv.h file into header files for the component where the variable is defined - Creates header files if the component lacks one - Eliminates all include directives from mysql_priv.h - Eliminates all circular include cycles - Rename time.cc to sql_time.cc - Rename mysql_priv.h to sql_priv.h
1 parent 36430c5 commit e409d6f

File tree

325 files changed

+13308
-3166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+13308
-3166
lines changed

.bzrignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ client/rpl_tblmap.cc
394394
client/rpl_utility.h
395395
client/rpl_utility.cc
396396
client/select_test
397+
client/sql_const.h
397398
client/sql_string.cpp
398399
client/ssl_test
399400
client/thimble
@@ -1209,7 +1210,7 @@ libmysqld/stacktrace.c
12091210
libmysqld/strfunc.cc
12101211
libmysqld/table.cc
12111212
libmysqld/thr_malloc.cc
1212-
libmysqld/time.cc
1213+
libmysqld/sql_time.cc
12131214
libmysqld/tztime.cc
12141215
libmysqld/uniques.cc
12151216
libmysqld/unireg.cc
@@ -1414,7 +1415,7 @@ mysql-test/var/*
14141415
mysql-test/windows_sys_vars.inc
14151416
mysql.kdevprj
14161417
mysql.proj
1417-
mysql_priv.h
1418+
sql_priv.h
14181419
mysqlbinlog/*.ds?
14191420
mysqlbinlog/*.vcproj
14201421
mysqlcheck/*.ds?

client/Makefile.am

+2-2
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ DEFS = -DMYSQL_CLIENT_NO_THREADS \
103103
-DDEFAULT_MYSQL_HOME="\"$(prefix)\"" \
104104
-DMYSQL_DATADIR="\"$(localstatedir)\""
105105

106-
sql_src=log_event.h mysql_priv.h rpl_constants.h \
106+
sql_src=log_event.h sql_priv.h rpl_constants.h \
107107
rpl_tblmap.h rpl_tblmap.cc \
108108
log_event.cc my_decimal.h my_decimal.cc \
109109
log_event_old.h log_event_old.cc \
110110
rpl_record_old.h rpl_record_old.cc \
111111
rpl_utility.h rpl_utility.cc \
112-
transaction.h
112+
transaction.h sql_const.h
113113
strings_src=decimal.c dtoa.c
114114

115115
link_sources:

client/client_priv.h

-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <my_sys.h>
2020
#include <m_string.h>
2121
#include <mysql.h>
22-
#include <mysql_embed.h>
2322
#include <errmsg.h>
2423
#include <my_getopt.h>
2524

client/mysqlbinlog.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include "client_priv.h"
3232
#include <my_time.h>
3333
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
34-
#include "mysql_priv.h"
34+
#include "sql_priv.h"
3535
#include "log_event.h"
3636
#include "sql_common.h"
3737

include/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pkginclude_HEADERS = $(HEADERS_ABI) my_dbug.h m_string.h my_sys.h \
3434
$(HEADERS_GEN_MAKE) probes_mysql.h probes_mysql_nodtrace.h
3535

3636
noinst_HEADERS = config-win.h config-netware.h lf.h my_bit.h \
37-
heap.h my_bitmap.h my_uctype.h \
37+
heap.h my_bitmap.h my_uctype.h password.h \
3838
myisam.h myisampack.h myisammrg.h ft_global.h\
3939
mysys_err.h my_base.h help_start.h help_end.h \
4040
my_nosys.h my_alarm.h queues.h rijndael.h sha1.h \

include/hash.h

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,21 @@
1717

1818
#ifndef _hash_h
1919
#define _hash_h
20+
21+
#include "my_global.h" /* uchar */
22+
#include "my_sys.h" /* DYNAMIC_ARRAY */
23+
24+
/*
25+
This forward declaration is used from C files where the real
26+
definition is included before. Since C does not allow repeated
27+
typedef declarations, even when identical, the definition may not be
28+
repeated.
29+
*/
30+
#ifndef CHARSET_INFO_DEFINED
31+
#define CHARSET_INFO_DEFINED
32+
typedef struct charset_info_st CHARSET_INFO;
33+
#endif /* CHARSET_INFO_DEFINED */
34+
2035
#ifdef __cplusplus
2136
extern "C" {
2237
#endif

include/keycache.h

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
#ifndef _keycache_h
1919
#define _keycache_h
20+
21+
#include "my_sys.h" /* flush_type */
22+
2023
C_MODE_START
2124

2225
/* declare structures that is used by st_key_cache */

include/m_ctype.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515

1616
/*
1717
A better inplementation of the UNIX ctype(3) library.
18-
Notes: my_global.h should be included before ctype.h
1918
*/
2019

2120
#ifndef _m_ctype_h
2221
#define _m_ctype_h
2322

2423
#include <my_attribute.h>
24+
#include "my_global.h" /* uint16, uchar */
2525

2626
#ifdef __cplusplus
2727
extern "C" {
@@ -265,6 +265,12 @@ extern MY_CHARSET_HANDLER my_charset_8bit_handler;
265265
extern MY_CHARSET_HANDLER my_charset_ucs2_handler;
266266

267267

268+
/*
269+
We define this CHARSET_INFO_DEFINED here to prevent a repeat of the
270+
typedef in hash.c, which will cause a compiler error.
271+
*/
272+
#define CHARSET_INFO_DEFINED
273+
268274
/* See strings/CHARSET_INFO.txt about information on this structure */
269275
typedef struct charset_info_st
270276
{

include/m_string.h

+9-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
#ifndef _m_string_h
2222
#define _m_string_h
23+
24+
#include "my_global.h" /* HAVE_* */
25+
2326
#ifndef __USE_GNU
2427
#define __USE_GNU /* We want to use stpcpy */
2528
#endif
@@ -266,13 +269,6 @@ extern ulonglong strtoull(const char *str, char **ptr, int base);
266269
#endif
267270
#define longlong2str(A,B,C) ll2str((A),(B),(C),1)
268271

269-
/* my_vsnprintf.c */
270-
271-
extern size_t my_vsnprintf(char *str, size_t n,
272-
const char *format, va_list ap);
273-
extern size_t my_snprintf(char *to, size_t n, const char *fmt, ...)
274-
ATTRIBUTE_FORMAT(printf, 3, 4);
275-
276272
#if defined(__cplusplus)
277273
}
278274
#endif
@@ -365,4 +361,10 @@ static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len)
365361
return (end);
366362
}
367363

364+
static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str)
365+
{
366+
lex_str->str= (char *) c_str;
367+
lex_str->length= strlen(c_str);
368+
}
369+
368370
#endif

include/my_dbug.h

+17-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,23 @@ extern const char* _db_get_func_(void);
145145
#define DBUG_CRASH_VOID_RETURN do { return; } while(0)
146146

147147
#endif
148-
#ifdef __cplusplus
148+
149+
#ifdef EXTRA_DEBUG
150+
/**
151+
Sync points allow us to force the server to reach a certain line of code
152+
and block there until the client tells the server it is ok to go on.
153+
The client tells the server to block with SELECT GET_LOCK()
154+
and unblocks it with SELECT RELEASE_LOCK(). Used for debugging difficult
155+
concurrency problems
156+
*/
157+
#define DBUG_SYNC_POINT(lock_name,lock_timeout) \
158+
debug_sync_point(lock_name,lock_timeout)
159+
void debug_sync_point(const char* lock_name, uint lock_timeout);
160+
#else
161+
#define DBUG_SYNC_POINT(lock_name,lock_timeout)
162+
#endif /* EXTRA_DEBUG */
163+
164+
#ifdef __cplusplus
149165
}
150166
#endif
151167
#endif

include/my_dir.h

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ extern "C" {
2222
#ifndef MY_DIR_H
2323
#define MY_DIR_H
2424

25+
#include "my_global.h"
26+
2527
#include <sys/stat.h>
2628

2729
/* Defines for my_dir and my_stat */

include/my_getopt.h

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#ifndef _my_getopt_h
1717
#define _my_getopt_h
1818

19+
#include "my_sys.h" /* loglevel */
20+
1921
C_MODE_START
2022

2123
#define GET_NO_ARG 1

include/my_global.h

+29-1
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,12 @@ typedef unsigned long my_off_t;
12051205
#endif /*_WIN32*/
12061206
#define MY_FILEPOS_ERROR (~(my_off_t) 0)
12071207

1208+
/*
1209+
TODO Convert these to use Bitmap class.
1210+
*/
1211+
typedef ulonglong table_map; /* Used for table bits in join */
1212+
typedef ulong nesting_map; /* Used for flags of nesting constructs */
1213+
12081214
#if defined(__WIN__)
12091215
#define socket_errno WSAGetLastError()
12101216
#define SOCKET_EINTR WSAEINTR
@@ -1675,7 +1681,13 @@ inline void operator delete[](void*, void*) { /* Do nothing */ }
16751681
#if !defined(max)
16761682
#define max(a, b) ((a) > (b) ? (a) : (b))
16771683
#define min(a, b) ((a) < (b) ? (a) : (b))
1678-
#endif
1684+
#endif
1685+
1686+
#define x_free(A) \
1687+
do { my_free((uchar*)(A), MYF(MY_WME|MY_FAE|MY_ALLOW_ZERO_PTR)); } while (0)
1688+
#define safeFree(X) \
1689+
do { if (X) { my_free((uchar*)(X), MYF(0)); (X) = NULL; } } while (0)
1690+
16791691
/*
16801692
Only Linux is known to need an explicit sync of the directory to make sure a
16811693
file creation/deletion/renaming in(from,to) this directory durable.
@@ -1755,4 +1767,20 @@ static inline double rint(double x)
17551767
#endif
17561768
#endif
17571769

1770+
/* Defines that are unique to the embedded version of MySQL */
1771+
1772+
#ifdef EMBEDDED_LIBRARY
1773+
1774+
/* Things we don't need in the embedded version of MySQL */
1775+
/* TODO HF add #undef HAVE_VIO if we don't want client in embedded library */
1776+
1777+
#undef HAVE_PSTACK /* No stacktrace */
1778+
#undef HAVE_OPENSSL
1779+
#undef HAVE_SMEM /* No shared memory */
1780+
#undef HAVE_NDBCLUSTER_DB /* No NDB cluster */
1781+
1782+
#define DONT_USE_RAID
1783+
1784+
#endif /* EMBEDDED_LIBRARY */
1785+
17581786
#endif /* my_global_h */

include/my_handler.h

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
extern "C" {
2424
#endif
2525

26+
#include "m_ctype.h" /* CHARSET_INFO */
27+
2628
/*
2729
There is a hard limit for the maximum number of keys as there are only
2830
8 bits in the index file header for the number of keys in a table.

include/my_net.h

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
#ifndef _my_net_h
2626
#define _my_net_h
27+
28+
#include "my_global.h" /* C_MODE_START, C_MODE_END */
29+
2730
C_MODE_START
2831

2932
#include <errno.h>

include/my_pthread.h

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#ifndef _my_pthread_h
1919
#define _my_pthread_h
2020

21+
#include "my_global.h" /* myf */
22+
2123
#ifndef ETIME
2224
#define ETIME ETIMEDOUT /* For FreeBSD */
2325
#endif

include/my_sys.h

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
#ifndef _my_sys_h
1717
#define _my_sys_h
18+
19+
#include "my_global.h" /* C_MODE_START, C_MODE_END */
20+
1821
C_MODE_START
1922

2023
#ifdef HAVE_AIOWAIT

include/my_tree.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern "C" {
2020
#endif
2121

2222
#include "my_base.h" /* get 'enum ha_rkey_function' */
23+
#include "my_alloc.h" /* MEM_ROOT */
2324

2425
/* Worst case tree is half full. This gives use 2^(MAX_TREE_HEIGHT/2) leafs */
2526
#define MAX_TREE_HEIGHT 64

include/mysql/psi/mysql_file.h

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <string.h>
2121
/* For MY_STAT */
2222
#include <my_dir.h>
23+
/* For my_chsize */
24+
#include <my_sys.h>
2325

2426
/**
2527
@file mysql/psi/mysql_file.h

include/mysys_err.h

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#ifndef _mysys_err_h
1717
#define _mysys_err_h
1818
#ifdef __cplusplus
19+
20+
#include "my_global.h" /* NEAR */
21+
1922
extern "C" {
2023
#endif
2124

include/password.h

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/* Copyright 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
2+
3+
This program is free software; you can redistribute it and/or modify
4+
it under the terms of the GNU General Public License as published by
5+
the Free Software Foundation; version 2 of the License.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
GNU General Public License for more details.
11+
12+
You should have received a copy of the GNU General Public License
13+
along with this program; if not, write to the Free Software
14+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15+
16+
#ifndef PASSWORD_INCLUDED
17+
#define PASSWORD_INCLUDED
18+
19+
#include "my_global.h"
20+
21+
C_MODE_START
22+
23+
void my_make_scrambled_password_323(char *to, const char *password,
24+
size_t pass_len);
25+
void my_make_scrambled_password(char *to, const char *password,
26+
size_t pass_len);
27+
28+
void hash_password(ulong *result, const char *password, uint password_len);
29+
30+
C_MODE_END
31+
32+
#endif /* PASSWORD_INCLUDED */

include/queues.h

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
#ifndef _queues_h
2424
#define _queues_h
25+
26+
#include "my_global.h" /* uchar */
27+
2528
#ifdef __cplusplus
2629
extern "C" {
2730
#endif

include/violite.h

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
extern "C" {
3131
#endif /* __cplusplus */
3232

33+
#ifdef __cplusplus
34+
typedef struct st_vio Vio;
35+
#endif /* __cplusplus */
36+
3337
enum enum_vio_type
3438
{
3539
VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE,

libmysql/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ link_sources:
8383
#
8484
# A list of needed headers collected from the deps information 000213
8585
nh = my_global.h config-win32.h dbug.h errmsg.h \
86-
m_ctype.h m_string.h \
86+
m_ctype.h m_string.h password.h \
8787
my_alarm.h my_config.h my_dir.h my_list.h my_net.h my_sys.h \
8888
mysql.h mysql_com.h mysql_version.h mysqld_error.h \
8989
mysys_err.h my_pthread.h thr_alarm.h violite.h hash.h \

libmysqld/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
7676
../sql/sql_trigger.cc ../sql/sql_udf.cc ../sql/sql_union.cc
7777
../sql/sql_update.cc ../sql/sql_view.cc ../sql/sql_profile.cc
7878
../sql/strfunc.cc ../sql/table.cc ../sql/thr_malloc.cc
79-
../sql/time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
79+
../sql/sql_time.cc ../sql/tztime.cc ../sql/uniques.cc ../sql/unireg.cc
8080
../sql/partition_info.cc ../sql/sql_connect.cc
8181
../sql/scheduler.cc ../sql/sql_audit.cc
8282
../sql/event_parse_data.cc

0 commit comments

Comments
 (0)