Merge lp:~stewart/drizzle/bug707323 into lp:drizzle

Proposed by Stewart Smith on 2013-08-08
Status: Merged
Merged at revision: 2640
Proposed branch: lp:~stewart/drizzle/bug707323
Merge into: lp:drizzle
Diff against target: 207 lines (+26/-19)
7 files modified
client/drizzletest.cc (+1/-1)
drizzled/drizzled.cc (+1/-1)
drizzled/internal/my_static.cc (+3/-1)
drizzled/internal/my_sys.h (+2/-0)
drizzled/plugin/storage_engine.cc (+11/-6)
drizzled/plugin/storage_engine.h (+1/-1)
plugin/innobase/handler/ha_innodb.cc (+7/-9)
To merge this branch: bzr merge lp:~stewart/drizzle/bug707323
Reviewer Review Type Date Requested Status
Drizzle Trunk 2013-08-08 Pending
Review via email: mp+179116@code.launchpad.net

Description of the change

use API calls rather than exported variables

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'client/drizzletest.cc'
2--- client/drizzletest.cc 2013-02-14 11:36:21 +0000
3+++ client/drizzletest.cc 2013-08-08 07:32:36 +0000
4@@ -2355,7 +2355,7 @@
5 mkdir_args, sizeof(mkdir_args)/sizeof(struct command_arg),
6 ' ');
7
8- int error= mkdir(ds_dirname.c_str(), (0777 & internal::my_umask_dir)) != 0;
9+ int error= mkdir(ds_dirname.c_str(), (0777 & internal::get_my_umask_dir())) != 0;
10 handle_command_error(command, error);
11 }
12
13
14=== modified file 'drizzled/drizzled.cc'
15--- drizzled/drizzled.cc 2013-02-28 22:27:42 +0000
16+++ drizzled/drizzled.cc 2013-08-08 07:32:36 +0000
17@@ -1099,7 +1099,7 @@
18
19 bool init_variables_before_daemonizing(int argc, char **argv)
20 {
21- umask(((~internal::my_umask) & 0666));
22+ umask(((~internal::get_my_umask()) & 0666));
23 decimal_zero.set_zero(); // set decimal_zero constant;
24 tzset(); // Set tzname
25
26
27=== modified file 'drizzled/internal/my_static.cc'
28--- drizzled/internal/my_static.cc 2013-02-27 02:30:19 +0000
29+++ drizzled/internal/my_static.cc 2013-08-08 07:32:36 +0000
30@@ -37,8 +37,10 @@
31 const char *my_progname=0;
32 char curr_dir[FN_REFLEN]= {0},
33 home_dir_buff[FN_REFLEN]= {0};
34-DRIZZLED_API int my_umask=0664;
35+int my_umask=0664;
36+int get_my_umask() { return my_umask; }
37 int my_umask_dir=0777;
38+int get_my_umask_dir() { return my_umask_dir; }
39
40 /* From mf_brkhant */
41 volatile int _my_signals=0;
42
43=== modified file 'drizzled/internal/my_sys.h'
44--- drizzled/internal/my_sys.h 2013-02-27 02:30:19 +0000
45+++ drizzled/internal/my_sys.h 2013-08-08 07:32:36 +0000
46@@ -206,6 +206,8 @@
47 DRIZZLED_API void my_store_ptr(unsigned char *buff, size_t pack_length, my_off_t pos);
48 DRIZZLED_API my_off_t my_get_ptr(unsigned char *ptr, size_t pack_length);
49 int create_temp_file(char *to, const char *dir, const char *pfx, myf MyFlags);
50+int get_my_umask();
51+int get_my_umask_dir();
52
53 } /* namespace internal */
54 } /* namespace drizzled */
55
56=== modified file 'drizzled/plugin/storage_engine.cc'
57--- drizzled/plugin/storage_engine.cc 2012-07-11 14:06:00 +0000
58+++ drizzled/plugin/storage_engine.cc 2013-08-08 07:32:36 +0000
59@@ -75,6 +75,11 @@
60 return g_schema_engines;
61 }
62
63+const std::string defaultTableDefinitionFileExt()
64+{
65+ return DEFAULT_DEFINITION_FILE_EXT;
66+}
67+
68 StorageEngine::StorageEngine(const std::string &name_arg,
69 const std::bitset<HTON_BIT_SIZE> &flags_arg) :
70 Plugin(name_arg, "StorageEngine"),
71@@ -150,7 +155,7 @@
72
73 if (engine->getTableDefinitionFileExtension().length())
74 {
75- assert(engine->getTableDefinitionFileExtension().length() == DEFAULT_DEFINITION_FILE_EXT.length());
76+ assert(engine->getTableDefinitionFileExtension().length() == plugin::defaultTableDefinitionFileExt().length());
77 set_of_table_definition_ext.insert(engine->getTableDefinitionFileExtension());
78 }
79
80@@ -539,7 +544,7 @@
81
82 /* We remove the file extension. */
83 length= entry->filename.length();
84- entry->filename.resize(length - DEFAULT_DEFINITION_FILE_EXT.length());
85+ entry->filename.resize(length - plugin::defaultTableDefinitionFileExt().length());
86
87 path+= directory;
88 path+= FN_LIBCHAR;
89@@ -842,7 +847,7 @@
90 {
91 std::string path(identifier.getPath());
92
93- path.append(DEFAULT_DEFINITION_FILE_EXT);
94+ path.append(plugin::defaultTableDefinitionFileExt());
95
96 return internal::my_delete(path.c_str(), MYF(0));
97 }
98@@ -853,8 +858,8 @@
99 std::string src_path(src.getPath());
100 std::string dest_path(dest.getPath());
101
102- src_path.append(DEFAULT_DEFINITION_FILE_EXT);
103- dest_path.append(DEFAULT_DEFINITION_FILE_EXT);
104+ src_path.append(plugin::defaultTableDefinitionFileExt());
105+ dest_path.append(plugin::defaultTableDefinitionFileExt());
106
107 bool was_read= StorageEngine::readTableFile(src_path.c_str(), table_message);
108
109@@ -881,7 +886,7 @@
110 char definition_file_tmp[FN_REFLEN];
111 std::string file_name(identifier.getPath());
112
113- file_name.append(DEFAULT_DEFINITION_FILE_EXT);
114+ file_name.append(plugin::defaultTableDefinitionFileExt());
115
116 snprintf(definition_file_tmp, sizeof(definition_file_tmp), "%sXXXXXX", file_name.c_str());
117
118
119=== modified file 'drizzled/plugin/storage_engine.h'
120--- drizzled/plugin/storage_engine.h 2013-03-03 01:46:08 +0000
121+++ drizzled/plugin/storage_engine.h 2013-08-08 07:32:36 +0000
122@@ -109,8 +109,8 @@
123 typedef std::set<std::string> TableNameList;
124
125 extern const std::string UNKNOWN_STRING;
126-extern DRIZZLED_API const std::string DEFAULT_DEFINITION_FILE_EXT;
127
128+const std::string defaultTableDefinitionFileExt();
129
130 /*
131 StorageEngine is a singleton structure - one instance per storage engine -
132
133=== modified file 'plugin/innobase/handler/ha_innodb.cc'
134--- plugin/innobase/handler/ha_innodb.cc 2013-03-03 02:44:39 +0000
135+++ plugin/innobase/handler/ha_innodb.cc 2013-08-08 07:32:36 +0000
136@@ -381,8 +381,6 @@
137 NULL
138 };
139
140-#define DEFAULT_FILE_EXTENSION ".dfe" // Deep Fried Elephant
141-
142 static INNOBASE_SHARE *get_share(const char *table_name);
143 static void free_share(INNOBASE_SHARE *share);
144
145@@ -398,7 +396,7 @@
146 HTON_TABLE_SCAN_ON_INDEX |
147 HTON_HAS_FOREIGN_KEYS)
148 {
149- table_definition_ext= plugin::DEFAULT_DEFINITION_FILE_EXT;
150+ table_definition_ext= plugin::defaultTableDefinitionFileExt();
151 addAlias("INNOBASE");
152 }
153
154@@ -626,7 +624,7 @@
155
156 const char *ext= strchr(filename->c_str(), '.');
157
158- if (ext == NULL || system_charset_info->strcasecmp(ext, DEFAULT_FILE_EXTENSION) ||
159+ if (ext == NULL || system_charset_info->strcasecmp(ext, plugin::defaultTableDefinitionFileExt().c_str()) ||
160 (filename->compare(0, strlen(TMP_FILE_PREFIX), TMP_FILE_PREFIX) == 0))
161 { }
162 else
163@@ -653,7 +651,7 @@
164 bool InnobaseEngine::doDoesTableExist(Session &session, const identifier::Table &identifier)
165 {
166 string proto_path(identifier.getPath());
167- proto_path.append(DEFAULT_FILE_EXTENSION);
168+ proto_path.append(plugin::defaultTableDefinitionFileExt());
169
170 if (session.getMessageCache().doesTableMessageExist(identifier))
171 return true;
172@@ -677,7 +675,7 @@
173 message::Table &table_proto)
174 {
175 string proto_path(identifier.getPath());
176- proto_path.append(DEFAULT_FILE_EXTENSION);
177+ proto_path.append(plugin::defaultTableDefinitionFileExt());
178
179 // First we check the temporary tables.
180 if (session.getMessageCache().getTableMessage(identifier, table_proto))
181@@ -2366,7 +2364,7 @@
182 goto error;
183 }
184
185- os_innodb_umask = (ulint)internal::my_umask;
186+ os_innodb_umask = (ulint)internal::get_my_umask();
187
188
189 /* Set InnoDB initialization parameters according to the values
190@@ -6808,7 +6806,7 @@
191 {
192 string path(identifier.getPath());
193
194- path.append(DEFAULT_FILE_EXTENSION);
195+ path.append(plugin::defaultTableDefinitionFileExt());
196
197 (void)internal::my_delete(path.c_str(), MYF(0));
198 }
199@@ -6817,7 +6815,7 @@
200 {
201 string path(identifier.getPath());
202
203- path.append(DEFAULT_FILE_EXTENSION);
204+ path.append(plugin::defaultTableDefinitionFileExt());
205
206 (void)internal::my_delete(path.c_str(), MYF(0));
207 }

Subscribers

People subscribed via source and target branches

to all changes: