Merge lp:~jaypipes/drizzle/captain into lp:~drizzle-trunk/drizzle/development
- captain
- Merge into development
Proposed by
Jay Pipes
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | not available | ||||||||
Proposed branch: | lp:~jaypipes/drizzle/captain | ||||||||
Merge into: | lp:~drizzle-trunk/drizzle/development | ||||||||
Diff against target: | None lines | ||||||||
To merge this branch: | bzr merge lp:~jaypipes/drizzle/captain | ||||||||
Related bugs: |
|
This proposal supersedes a proposal from 2009-07-18.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote : Posted in a previous version of this proposal | # |
Revision history for this message
Jay Pipes (jaypipes) wrote : | # |
Contains Monty's build-cleanup and plugin class cleanup branches. All tests pass on Linux64, Solaris64, and MacOSX64, with only known exception of drizzledump failure on Solaris and myisamcheck failure on MacOSX. Also includes Pandora build fixes for Solaris.
lp:~jaypipes/drizzle/captain
updated
- 1098. By Brian Aker <brian@gaz>
-
Merge Jay
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile.am' |
2 | --- Makefile.am 2009-07-11 19:23:04 +0000 |
3 | +++ Makefile.am 2009-07-17 23:20:36 +0000 |
4 | @@ -128,7 +128,6 @@ |
5 | mysys/charset.cc \ |
6 | mysys/checksum.cc \ |
7 | mysys/default.cc \ |
8 | - mysys/default_modify.cc \ |
9 | mysys/dynamic_array.cc \ |
10 | mysys/errors.cc \ |
11 | mysys/hash.cc \ |
12 | |
13 | === modified file 'client/drizzle.1' |
14 | --- client/drizzle.1 2009-05-23 23:51:18 +0000 |
15 | +++ client/drizzle.1 2009-07-17 17:13:52 +0000 |
16 | @@ -1018,7 +1018,7 @@ |
17 | The |
18 | \fBprompt\fR |
19 | command reconfigures the default |
20 | -mysql> |
21 | +drizzle> |
22 | prompt. The string for defining the prompt can contain the following special sequences. |
23 | .TS |
24 | allbox tab(:); |
25 | @@ -1100,7 +1100,7 @@ |
26 | \\U |
27 | T}:T{ |
28 | Your full |
29 | - \fIuser_name\fR@\fIhost_name\fR |
30 | + \fIuser\fR@\fIhost\fR |
31 | account name |
32 | T} |
33 | T{ |
34 | |
35 | === modified file 'client/drizzledump.1' |
36 | --- client/drizzledump.1 2009-05-23 23:51:18 +0000 |
37 | +++ client/drizzledump.1 2009-07-17 17:13:52 +0000 |
38 | @@ -989,19 +989,20 @@ |
39 | NULL (\fIunknown value\fR) |
40 | T}:T{ |
41 | <field name="\fIcolumn_name\fR" |
42 | - xsi:nil="true" /> |
43 | + xsi:nil="true" /> |
44 | T} |
45 | T{ |
46 | \'' (\fIempty string\fR) |
47 | T}:T{ |
48 | -<field |
49 | - name="\fIcolumn_name\fR"></field> |
50 | +<field name="\fIcolumn_name\fR"> |
51 | +</field> |
52 | T} |
53 | T{ |
54 | \'NULL' (\fIstring value\fR) |
55 | T}:T{ |
56 | -<field |
57 | - name="\fIcolumn_name\fR">NULL</field> |
58 | +<field name="\fIcolumn_name\fR"> |
59 | +NULL |
60 | +</field> |
61 | T} |
62 | .TE |
63 | .sp |
64 | |
65 | === modified file 'config/uncrustify.cfg' |
66 | --- config/uncrustify.cfg 2009-07-10 21:50:02 +0000 |
67 | +++ config/uncrustify.cfg 2009-07-15 21:16:34 +0000 |
68 | @@ -60,8 +60,8 @@ |
69 | nl_create_if_one_liner=false |
70 | nl_create_for_one_liner=false |
71 | nl_create_while_one_liner=false |
72 | -ls_for_split_full=true |
73 | -ls_func_split_full=true |
74 | +ls_for_split_full=false |
75 | +ls_func_split_full=false |
76 | nl_after_multiline_comment=true |
77 | eat_blanks_after_open_brace=true |
78 | eat_blanks_before_close_brace=true |
79 | |
80 | === modified file 'drizzled/Makefile.am' |
81 | --- drizzled/Makefile.am 2009-07-12 18:36:46 +0000 |
82 | +++ drizzled/Makefile.am 2009-07-15 21:47:32 +0000 |
83 | @@ -267,8 +267,11 @@ |
84 | plugin/applier.h \ |
85 | plugin/authentication.h \ |
86 | plugin/error_message_handler.h \ |
87 | + plugin/handle.h \ |
88 | + plugin/library.h \ |
89 | plugin/listen.h \ |
90 | plugin/logging_handler.h \ |
91 | + plugin/manifest.h \ |
92 | plugin/protocol.h \ |
93 | plugin/qcache.h \ |
94 | plugin/replicator.h \ |
95 | |
96 | === modified file 'drizzled/drizzled.cc' |
97 | --- drizzled/drizzled.cc 2009-07-16 19:30:03 +0000 |
98 | +++ drizzled/drizzled.cc 2009-07-18 18:11:42 +0000 |
99 | @@ -2326,10 +2326,7 @@ |
100 | #endif |
101 | |
102 | /* Print out all the options including plugin supplied options */ |
103 | - my_print_help_inc_plugins(my_long_options, sizeof(my_long_options)/sizeof(my_option)); |
104 | - |
105 | - puts(_("\nTo see what values a running Drizzle server is using, type\n" |
106 | - "'drizzleadmin variables' instead of 'drizzled --help'.")); |
107 | + my_print_help_inc_plugins(my_long_options); |
108 | } |
109 | } |
110 | |
111 | |
112 | === modified file 'drizzled/plugin.h' |
113 | --- drizzled/plugin.h 2009-07-07 09:06:29 +0000 |
114 | +++ drizzled/plugin.h 2009-07-15 21:30:33 +0000 |
115 | @@ -31,40 +31,28 @@ |
116 | */ |
117 | |
118 | |
119 | -/* We use the following strings to define licenses for plugins */ |
120 | -enum plugin_license_type { |
121 | - PLUGIN_LICENSE_PROPRIETARY, |
122 | - PLUGIN_LICENSE_GPL, |
123 | - PLUGIN_LICENSE_BSD, |
124 | - PLUGIN_LICENSE_LGPL, |
125 | - PLUGIN_LICENSE_MAX=PLUGIN_LICENSE_LGPL |
126 | -}; |
127 | - |
128 | -const char * const PLUGIN_LICENSE_PROPRIETARY_STRING="PROPRIETARY"; |
129 | -const char * const PLUGIN_LICENSE_GPL_STRING="GPL"; |
130 | -const char * const PLUGIN_LICENSE_BSD_STRING="BSD"; |
131 | -const char * const PLUGIN_LICENSE_LGPL_STRING="LGPL"; |
132 | - |
133 | /* |
134 | Macros for beginning and ending plugin declarations. Between |
135 | drizzle_declare_plugin and drizzle_declare_plugin_end there should |
136 | - be a drizzled_plugin_manifest struct for each plugin to be declared. |
137 | + be a drizzled::plugin::Manifest for each plugin to be declared. |
138 | */ |
139 | |
140 | |
141 | #ifndef DRIZZLE_DYNAMIC_PLUGIN |
142 | #define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \ |
143 | -struct drizzled_plugin_manifest DECLS[]= { |
144 | +drizzled::plugin::Manifest DECLS[]= { |
145 | #else |
146 | #define __DRIZZLE_DECLARE_PLUGIN(NAME, DECLS) \ |
147 | -struct drizzled_plugin_manifest _mysql_plugin_declarations_[]= { |
148 | +drizzled::plugin::Manifest _drizzled_plugin_declaration_[]= { |
149 | #endif |
150 | |
151 | #define drizzle_declare_plugin(NAME) \ |
152 | __DRIZZLE_DECLARE_PLUGIN(NAME, \ |
153 | builtin_ ## NAME ## _plugin) |
154 | |
155 | -#define drizzle_declare_plugin_end ,{0,0,0,0,0,0,0,0,0,0}} |
156 | +#define drizzle_declare_plugin_end ,{0,0,0,0,PLUGIN_LICENSE_GPL,0,0,0,0,0}} |
157 | + |
158 | + |
159 | |
160 | /* |
161 | the following flags are valid for plugin_init() |
162 | |
163 | === added file 'drizzled/plugin/handle.h' |
164 | --- drizzled/plugin/handle.h 1970-01-01 00:00:00 +0000 |
165 | +++ drizzled/plugin/handle.h 2009-07-16 00:24:27 +0000 |
166 | @@ -0,0 +1,68 @@ |
167 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
168 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
169 | + * |
170 | + * Copyright (C) 2009 Sun Microsystems |
171 | + * |
172 | + * This program is free software; you can redistribute it and/or modify |
173 | + * it under the terms of the GNU General Public License as published by |
174 | + * the Free Software Foundation; version 2 of the License. |
175 | + * |
176 | + * This program is distributed in the hope that it will be useful, |
177 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
178 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
179 | + * GNU General Public License for more details. |
180 | + * |
181 | + * You should have received a copy of the GNU General Public License |
182 | + * along with this program; if not, write to the Free Software |
183 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
184 | + */ |
185 | + |
186 | +#ifndef DRIZZLED_PLUGIN_HANDLE_H |
187 | +#define DRIZZLED_PLUGIN_HANDLE_H |
188 | + |
189 | +#include <drizzled/lex_string.h> |
190 | +#include <mysys/my_alloc.h> |
191 | + |
192 | +class sys_var; |
193 | + |
194 | +namespace drizzled |
195 | +{ |
196 | +namespace plugin |
197 | +{ |
198 | + |
199 | +class Manifest; |
200 | +class Library; |
201 | + |
202 | +/* A handle of a plugin */ |
203 | +class Handle |
204 | +{ |
205 | + const std::string name; |
206 | + Manifest *manifest; |
207 | +public: |
208 | + Library *plugin_dl; |
209 | + bool isInited; |
210 | + MEM_ROOT mem_root; /* memory for dynamic plugin structures */ |
211 | + sys_var *system_vars; /* server variables for this plugin */ |
212 | + Handle(Manifest *manifest_arg, Library *library_arg) |
213 | + : name(manifest_arg->name), manifest(manifest_arg), plugin_dl(library_arg), |
214 | + mem_root(), system_vars(NULL) {} |
215 | + |
216 | + Handle(Manifest *manifest_arg) |
217 | + : name(manifest_arg->name), manifest(manifest_arg), plugin_dl(NULL), |
218 | + mem_root(), system_vars(NULL) {} |
219 | + |
220 | + const std::string& getName() const |
221 | + { |
222 | + return name; |
223 | + } |
224 | + |
225 | + const Manifest& getManifest() const |
226 | + { |
227 | + return *manifest; |
228 | + } |
229 | +}; |
230 | + |
231 | +} /* namespace plugin */ |
232 | +} /* namespace drizzled */ |
233 | + |
234 | +#endif /* DRIZZLED_PLUGIN_HANDLE_H */ |
235 | |
236 | === added file 'drizzled/plugin/library.h' |
237 | --- drizzled/plugin/library.h 1970-01-01 00:00:00 +0000 |
238 | +++ drizzled/plugin/library.h 2009-07-15 21:47:32 +0000 |
239 | @@ -0,0 +1,45 @@ |
240 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
241 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
242 | + * |
243 | + * Copyright (C) 2009 Sun Microsystems |
244 | + * |
245 | + * This program is free software; you can redistribute it and/or modify |
246 | + * it under the terms of the GNU General Public License as published by |
247 | + * the Free Software Foundation; version 2 of the License. |
248 | + * |
249 | + * This program is distributed in the hope that it will be useful, |
250 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
251 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
252 | + * GNU General Public License for more details. |
253 | + * |
254 | + * You should have received a copy of the GNU General Public License |
255 | + * along with this program; if not, write to the Free Software |
256 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
257 | + */ |
258 | + |
259 | +#ifndef DRIZZLED_PLUGIN_LIBRARY_H |
260 | +#define DRIZZLED_PLUGIN_LIBRARY_H |
261 | + |
262 | +#include <drizzled/lex_string.h> |
263 | + |
264 | +namespace drizzled |
265 | +{ |
266 | +namespace plugin |
267 | +{ |
268 | + |
269 | +class Manifest; |
270 | + |
271 | +/* A handle for the dynamic library containing a plugin or plugins. */ |
272 | +class Library |
273 | +{ |
274 | +public: |
275 | + LEX_STRING dl; |
276 | + void *handle; |
277 | + Manifest *plugins; |
278 | + Library() : dl(), handle(NULL), plugins(NULL) {} |
279 | +}; |
280 | + |
281 | +} /* namespace plugin */ |
282 | +} /* namespace drizzled */ |
283 | + |
284 | +#endif /* DRIZZLED_PLUGIN_LIBRARY_H */ |
285 | |
286 | === added file 'drizzled/plugin/manifest.h' |
287 | --- drizzled/plugin/manifest.h 1970-01-01 00:00:00 +0000 |
288 | +++ drizzled/plugin/manifest.h 2009-07-16 00:24:27 +0000 |
289 | @@ -0,0 +1,75 @@ |
290 | +/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
291 | + * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: |
292 | + * |
293 | + * Copyright (C) 2009 Sun Microsystems |
294 | + * |
295 | + * This program is free software; you can redistribute it and/or modify |
296 | + * it under the terms of the GNU General Public License as published by |
297 | + * the Free Software Foundation; version 2 of the License. |
298 | + * |
299 | + * This program is distributed in the hope that it will be useful, |
300 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
301 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
302 | + * GNU General Public License for more details. |
303 | + * |
304 | + * You should have received a copy of the GNU General Public License |
305 | + * along with this program; if not, write to the Free Software |
306 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
307 | + */ |
308 | + |
309 | +#ifndef DRIZZLED_PLUGIN_MANIFEST_H |
310 | +#define DRIZZLED_PLUGIN_MANIFEST_H |
311 | + |
312 | +#include <drizzled/plugin_registry.h> |
313 | + |
314 | +struct st_mysql_show_var; |
315 | +struct st_mysql_sys_var; |
316 | + |
317 | +/* We use the following strings to define licenses for plugins */ |
318 | +enum plugin_license_type { |
319 | + PLUGIN_LICENSE_GPL, |
320 | + PLUGIN_LICENSE_BSD, |
321 | + PLUGIN_LICENSE_LGPL, |
322 | + PLUGIN_LICENSE_PROPRIETARY, |
323 | + PLUGIN_LICENSE_MAX=PLUGIN_LICENSE_LGPL |
324 | +}; |
325 | + |
326 | + |
327 | +namespace drizzled |
328 | +{ |
329 | +namespace plugin |
330 | +{ |
331 | + |
332 | +static const std::string LICENSE_GPL_STRING("GPL"); |
333 | +static const std::string LICENSE_BSD_STRING("BSD"); |
334 | +static const std::string LICENSE_LGPL_STRING("LGPL"); |
335 | +static const std::string LICENSE_PROPRIETARY_STRING("PROPRIETARY"); |
336 | + |
337 | +typedef int (*initialize_func_t)(PluginRegistry &); |
338 | + |
339 | +/** |
340 | + * Plugin Manfiest |
341 | + * |
342 | + * One Manifest is required per plugin library which is to be dlopened |
343 | + * |
344 | + * This is a struct and not a class because it is staticly defined in the |
345 | + * plugin objects and needs to be a POD as it can, or else it won't compile. |
346 | + */ |
347 | +struct Manifest |
348 | +{ |
349 | + const char *name; /* plugin name (for SHOW PLUGINS) */ |
350 | + const char *version; /* plugin version (for SHOW PLUGINS) */ |
351 | + const char *author; /* plugin author (for SHOW PLUGINS) */ |
352 | + const char *descr; /* general descriptive text (for SHOW PLUGINS ) */ |
353 | + plugin_license_type license; /* plugin license (PLUGIN_LICENSE_XXX) */ |
354 | + initialize_func_t init; /* function to invoke when plugin is loaded */ |
355 | + initialize_func_t deinit; /* function to invoke when plugin is unloaded */ |
356 | + st_mysql_show_var *status_vars; |
357 | + st_mysql_sys_var **system_vars; |
358 | + void *reserved1; /* reserved for dependency checking */ |
359 | +}; |
360 | + |
361 | +} /* namespace plugin */ |
362 | +} /* namespace drizzled */ |
363 | + |
364 | +#endif /* DRIZZLED_PLUGIN_MANIFEST_H */ |
365 | |
366 | === modified file 'drizzled/plugin_registry.cc' |
367 | --- drizzled/plugin_registry.cc 2009-06-17 18:39:44 +0000 |
368 | +++ drizzled/plugin_registry.cc 2009-07-16 00:24:27 +0000 |
369 | @@ -45,21 +45,21 @@ |
370 | return the_registry; |
371 | } |
372 | |
373 | -st_plugin_int *PluginRegistry::find(const LEX_STRING *name) |
374 | +drizzled::plugin::Handle *PluginRegistry::find(const LEX_STRING *name) |
375 | { |
376 | string find_str(name->str,name->length); |
377 | transform(find_str.begin(), find_str.end(), find_str.begin(), ::tolower); |
378 | |
379 | - map<string, st_plugin_int *>::iterator map_iter; |
380 | + map<string, drizzled::plugin::Handle *>::iterator map_iter; |
381 | map_iter= plugin_map.find(find_str); |
382 | if (map_iter != plugin_map.end()) |
383 | return (*map_iter).second; |
384 | return(0); |
385 | } |
386 | |
387 | -void PluginRegistry::add(st_plugin_int *plugin) |
388 | +void PluginRegistry::add(drizzled::plugin::Handle *plugin) |
389 | { |
390 | - string add_str(plugin->name.str); |
391 | + string add_str(plugin->getName()); |
392 | transform(add_str.begin(), add_str.end(), |
393 | add_str.begin(), ::tolower); |
394 | |
395 | @@ -67,14 +67,14 @@ |
396 | } |
397 | |
398 | |
399 | -vector<st_plugin_int *> PluginRegistry::get_list(bool active) |
400 | +vector<drizzled::plugin::Handle *> PluginRegistry::get_list(bool active) |
401 | { |
402 | - st_plugin_int *plugin= NULL; |
403 | + drizzled::plugin::Handle *plugin= NULL; |
404 | |
405 | - vector <st_plugin_int *> plugins; |
406 | + vector <drizzled::plugin::Handle *> plugins; |
407 | plugins.reserve(plugin_map.size()); |
408 | |
409 | - map<string, st_plugin_int *>::iterator map_iter; |
410 | + map<string, drizzled::plugin::Handle *>::iterator map_iter; |
411 | for (map_iter= plugin_map.begin(); |
412 | map_iter != plugin_map.end(); |
413 | map_iter++) |
414 | |
415 | === modified file 'drizzled/plugin_registry.h' |
416 | --- drizzled/plugin_registry.h 2009-06-26 06:25:57 +0000 |
417 | +++ drizzled/plugin_registry.h 2009-07-15 21:00:16 +0000 |
418 | @@ -25,7 +25,6 @@ |
419 | #include <vector> |
420 | #include <map> |
421 | |
422 | -struct st_plugin_int; |
423 | class StorageEngine; |
424 | class InfoSchemaTable; |
425 | class Function_builder; |
426 | @@ -40,13 +39,14 @@ |
427 | namespace plugin |
428 | { |
429 | class Replicator; |
430 | +class Handle; |
431 | } |
432 | } |
433 | |
434 | class PluginRegistry |
435 | { |
436 | private: |
437 | - std::map<std::string, st_plugin_int *> |
438 | + std::map<std::string, drizzled::plugin::Handle *> |
439 | plugin_map; |
440 | |
441 | PluginRegistry(const PluginRegistry&); |
442 | @@ -54,11 +54,11 @@ |
443 | PluginRegistry() {} |
444 | |
445 | |
446 | - st_plugin_int *find(const LEX_STRING *name); |
447 | - |
448 | - void add(st_plugin_int *plugin); |
449 | - |
450 | - std::vector<st_plugin_int *> get_list(bool active); |
451 | + drizzled::plugin::Handle *find(const LEX_STRING *name); |
452 | + |
453 | + void add(drizzled::plugin::Handle *plugin); |
454 | + |
455 | + std::vector<drizzled::plugin::Handle *> get_list(bool active); |
456 | static PluginRegistry& getPluginRegistry(); |
457 | |
458 | void add(StorageEngine *engine); |
459 | |
460 | === modified file 'drizzled/sql_plugin.cc' |
461 | --- drizzled/sql_plugin.cc 2009-06-30 21:28:16 +0000 |
462 | +++ drizzled/sql_plugin.cc 2009-07-16 17:37:03 +0000 |
463 | @@ -43,19 +43,21 @@ |
464 | #define REPORT_TO_USER 2 |
465 | |
466 | using namespace std; |
467 | +using namespace drizzled; |
468 | +using namespace drizzled::plugin; |
469 | |
470 | -typedef struct drizzled_plugin_manifest builtin_plugin[]; |
471 | +typedef Manifest builtin_plugin[]; |
472 | extern builtin_plugin DRIZZLED_BUILTIN_LIST; |
473 | -static drizzled_plugin_manifest *drizzled_builtins[]= |
474 | +static Manifest *drizzled_builtins[]= |
475 | { |
476 | - DRIZZLED_BUILTIN_LIST,(struct drizzled_plugin_manifest *)0 |
477 | + DRIZZLED_BUILTIN_LIST,(Manifest *)0 |
478 | }; |
479 | |
480 | char *opt_plugin_load= NULL; |
481 | const char *opt_plugin_load_default= QUOTE_ARG(DRIZZLED_PLUGIN_LIST); |
482 | char *opt_plugin_dir_ptr; |
483 | char opt_plugin_dir[FN_REFLEN]; |
484 | -static const char *plugin_declarations_sym= "_mysql_plugin_declarations_"; |
485 | +static const char *plugin_declarations_sym= "_drizzled_plugin_declaration_"; |
486 | |
487 | /* Note that 'int version' must be the first field of every plugin |
488 | sub-structure (plugin->info). |
489 | @@ -122,7 +124,7 @@ |
490 | class sys_var_pluginvar: public sys_var |
491 | { |
492 | public: |
493 | - struct st_plugin_int *plugin; |
494 | + Handle *plugin; |
495 | struct st_mysql_sys_var *plugin_var; |
496 | |
497 | static void *operator new(size_t size, MEM_ROOT *mem_root) |
498 | @@ -154,10 +156,10 @@ |
499 | /* prototypes */ |
500 | static bool plugin_load_list(MEM_ROOT *tmp_root, int *argc, char **argv, |
501 | const char *list); |
502 | -static int test_plugin_options(MEM_ROOT *, struct st_plugin_int *, |
503 | +static int test_plugin_options(MEM_ROOT *, Handle *, |
504 | int *, char **); |
505 | -static bool register_builtin(struct st_plugin_int *, |
506 | - struct st_plugin_int **); |
507 | +static bool register_builtin(Handle *, |
508 | + Handle **); |
509 | static void unlock_variables(Session *session, struct system_variables *vars); |
510 | static void cleanup_variables(Session *session, struct system_variables *vars); |
511 | static void plugin_vars_free_values(sys_var *vars); |
512 | @@ -236,14 +238,14 @@ |
513 | Plugin support code |
514 | ****************************************************************************/ |
515 | |
516 | -static struct st_plugin_dl *plugin_dl_find(const LEX_STRING *dl) |
517 | +static Library *plugin_dl_find(const LEX_STRING *dl) |
518 | { |
519 | uint32_t i; |
520 | - struct st_plugin_dl *tmp; |
521 | + Library *tmp; |
522 | |
523 | for (i= 0; i < plugin_dl_array.elements; i++) |
524 | { |
525 | - tmp= *dynamic_element(&plugin_dl_array, i, struct st_plugin_dl **); |
526 | + tmp= *dynamic_element(&plugin_dl_array, i, Library **); |
527 | if (! my_strnncoll(files_charset_info, |
528 | (const unsigned char *)dl->str, dl->length, |
529 | (const unsigned char *)tmp->dl.str, tmp->dl.length)) |
530 | @@ -252,29 +254,29 @@ |
531 | return(0); |
532 | } |
533 | |
534 | -static st_plugin_dl *plugin_dl_insert_or_reuse(struct st_plugin_dl *plugin_dl) |
535 | +static Library *plugin_dl_insert_or_reuse(Library *plugin_dl) |
536 | { |
537 | uint32_t i; |
538 | - struct st_plugin_dl *tmp; |
539 | + Library *tmp; |
540 | |
541 | for (i= 0; i < plugin_dl_array.elements; i++) |
542 | { |
543 | - tmp= *dynamic_element(&plugin_dl_array, i, struct st_plugin_dl **); |
544 | + tmp= *dynamic_element(&plugin_dl_array, i, Library **); |
545 | { |
546 | - memcpy(tmp, plugin_dl, sizeof(struct st_plugin_dl)); |
547 | + memcpy(tmp, plugin_dl, sizeof(Library)); |
548 | return(tmp); |
549 | } |
550 | } |
551 | if (insert_dynamic(&plugin_dl_array, (unsigned char*)&plugin_dl)) |
552 | return(0); |
553 | tmp= *dynamic_element(&plugin_dl_array, plugin_dl_array.elements - 1, |
554 | - struct st_plugin_dl **)= |
555 | - (struct st_plugin_dl *) memdup_root(&plugin_mem_root, (unsigned char*)plugin_dl, |
556 | - sizeof(struct st_plugin_dl)); |
557 | + Library **)= |
558 | + (Library *) memdup_root(&plugin_mem_root, (unsigned char*)plugin_dl, |
559 | + sizeof(Library)); |
560 | return(tmp); |
561 | } |
562 | |
563 | -static inline void free_plugin_mem(struct st_plugin_dl *p) |
564 | +static inline void free_plugin_mem(Library *p) |
565 | { |
566 | if (p->handle) |
567 | dlclose(p->handle); |
568 | @@ -282,11 +284,11 @@ |
569 | } |
570 | |
571 | |
572 | -static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) |
573 | +static Library *plugin_dl_add(const LEX_STRING *dl, int report) |
574 | { |
575 | string dlpath; |
576 | uint32_t plugin_dir_len; |
577 | - struct st_plugin_dl *tmp, plugin_dl; |
578 | + Library *tmp, plugin_dl; |
579 | void *sym; |
580 | plugin_dir_len= strlen(opt_plugin_dir); |
581 | dlpath.reserve(FN_REFLEN); |
582 | @@ -345,7 +347,7 @@ |
583 | return(0); |
584 | } |
585 | |
586 | - plugin_dl.plugins= (struct drizzled_plugin_manifest *)sym; |
587 | + plugin_dl.plugins= static_cast<Manifest *>(sym); |
588 | |
589 | /* Duplicate and convert dll name */ |
590 | plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1; |
591 | @@ -364,9 +366,9 @@ |
592 | { |
593 | free_plugin_mem(&plugin_dl); |
594 | if (report & REPORT_TO_USER) |
595 | - my_error(ER_OUTOFMEMORY, MYF(0), sizeof(struct st_plugin_dl)); |
596 | + my_error(ER_OUTOFMEMORY, MYF(0), sizeof(Library)); |
597 | if (report & REPORT_TO_LOG) |
598 | - errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_OUTOFMEMORY), sizeof(struct st_plugin_dl)); |
599 | + errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_OUTOFMEMORY), sizeof(Library)); |
600 | return(0); |
601 | } |
602 | return(tmp); |
603 | @@ -379,8 +381,8 @@ |
604 | |
605 | for (i= 0; i < plugin_dl_array.elements; i++) |
606 | { |
607 | - struct st_plugin_dl *tmp= *dynamic_element(&plugin_dl_array, i, |
608 | - struct st_plugin_dl **); |
609 | + Library *tmp= *dynamic_element(&plugin_dl_array, i, |
610 | + Library **); |
611 | if (! my_strnncoll(files_charset_info, |
612 | (const unsigned char *)dl->str, dl->length, |
613 | (const unsigned char *)tmp->dl.str, tmp->dl.length)) |
614 | @@ -388,7 +390,7 @@ |
615 | /* Do not remove this element, unless no other plugin uses this dll. */ |
616 | { |
617 | free_plugin_mem(tmp); |
618 | - memset(tmp, 0, sizeof(struct st_plugin_dl)); |
619 | + memset(tmp, 0, sizeof(Library)); |
620 | } |
621 | break; |
622 | } |
623 | @@ -398,16 +400,13 @@ |
624 | |
625 | |
626 | |
627 | -static st_plugin_int *plugin_insert_or_reuse(struct st_plugin_int *plugin) |
628 | +static Handle *plugin_insert_or_reuse(Handle *plugin) |
629 | { |
630 | - struct st_plugin_int *tmp; |
631 | if (insert_dynamic(&plugin_array, (unsigned char*)&plugin)) |
632 | return(0); |
633 | - tmp= *dynamic_element(&plugin_array, plugin_array.elements - 1, |
634 | - struct st_plugin_int **)= |
635 | - (struct st_plugin_int *) memdup_root(&plugin_mem_root, (unsigned char*)plugin, |
636 | - sizeof(struct st_plugin_int)); |
637 | - return(tmp); |
638 | + plugin= *dynamic_element(&plugin_array, plugin_array.elements - 1, |
639 | + Handle **); |
640 | + return(plugin); |
641 | } |
642 | |
643 | |
644 | @@ -421,8 +420,7 @@ |
645 | { |
646 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
647 | |
648 | - struct st_plugin_int tmp; |
649 | - struct drizzled_plugin_manifest *plugin; |
650 | + Manifest *manifest; |
651 | if (! initialized) |
652 | return(0); |
653 | |
654 | @@ -434,34 +432,32 @@ |
655 | errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_UDF_EXISTS), name->str); |
656 | return(true); |
657 | } |
658 | - /* Clear the whole struct to catch future extensions. */ |
659 | - memset(&tmp, 0, sizeof(tmp)); |
660 | - if (! (tmp.plugin_dl= plugin_dl_add(dl, report))) |
661 | - return(true); |
662 | + Library *library= plugin_dl_add(dl, report); |
663 | + if (library == NULL) |
664 | + return true; |
665 | + |
666 | + Handle *tmp= NULL; |
667 | /* Find plugin by name */ |
668 | - for (plugin= tmp.plugin_dl->plugins; plugin->name; plugin++) |
669 | + for (manifest= library->plugins; manifest->name; manifest++) |
670 | { |
671 | - uint32_t name_len= strlen(plugin->name); |
672 | if (! my_strnncoll(system_charset_info, |
673 | (const unsigned char *)name->str, name->length, |
674 | - (const unsigned char *)plugin->name, |
675 | - name_len)) |
676 | + (const unsigned char *)manifest->name, |
677 | + strlen(manifest->name))) |
678 | { |
679 | - struct st_plugin_int *tmp_plugin_ptr; |
680 | + tmp= new (std::nothrow) Handle(manifest, library); |
681 | + if (tmp == NULL) |
682 | + return true; |
683 | |
684 | - tmp.plugin= plugin; |
685 | - tmp.name.str= (char *)plugin->name; |
686 | - tmp.name.length= name_len; |
687 | - tmp.isInited= false; |
688 | - if (!test_plugin_options(tmp_root, &tmp, argc, argv)) |
689 | + if (!test_plugin_options(tmp_root, tmp, argc, argv)) |
690 | { |
691 | - if ((tmp_plugin_ptr= plugin_insert_or_reuse(&tmp))) |
692 | + if ((tmp= plugin_insert_or_reuse(tmp))) |
693 | { |
694 | - registry.add(tmp_plugin_ptr); |
695 | - init_alloc_root(&tmp_plugin_ptr->mem_root, 4096, 4096); |
696 | + registry.add(tmp); |
697 | + init_alloc_root(&tmp->mem_root, 4096, 4096); |
698 | return(false); |
699 | } |
700 | - mysql_del_sys_var_chain(tmp.system_vars); |
701 | + mysql_del_sys_var_chain(tmp->system_vars); |
702 | goto err; |
703 | } |
704 | /* plugin was disabled */ |
705 | @@ -479,18 +475,18 @@ |
706 | } |
707 | |
708 | |
709 | -static void plugin_del(struct st_plugin_int *plugin) |
710 | +static void plugin_del(Handle *plugin) |
711 | { |
712 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
713 | if (plugin->isInited) |
714 | { |
715 | - if (plugin->plugin->status_vars) |
716 | + if (plugin->getManifest().status_vars) |
717 | { |
718 | - remove_status_vars(plugin->plugin->status_vars); |
719 | + remove_status_vars(plugin->getManifest().status_vars); |
720 | } |
721 | |
722 | - if (plugin->plugin->deinit) |
723 | - plugin->plugin->deinit(registry); |
724 | + if (plugin->getManifest().deinit) |
725 | + plugin->getManifest().deinit(registry); |
726 | } |
727 | |
728 | /* Free allocated strings before deleting the plugin. */ |
729 | @@ -501,44 +497,44 @@ |
730 | pthread_rwlock_wrlock(&LOCK_system_variables_hash); |
731 | mysql_del_sys_var_chain(plugin->system_vars); |
732 | pthread_rwlock_unlock(&LOCK_system_variables_hash); |
733 | - free_root(&plugin->mem_root, MYF(0)); |
734 | + delete plugin; |
735 | } |
736 | |
737 | static void reap_plugins(void) |
738 | { |
739 | size_t count; |
740 | uint32_t idx; |
741 | - struct st_plugin_int *plugin; |
742 | + drizzled::plugin::Handle *plugin; |
743 | |
744 | count= plugin_array.elements; |
745 | |
746 | for (idx= 0; idx < count; idx++) |
747 | { |
748 | - plugin= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); |
749 | + plugin= *dynamic_element(&plugin_array, idx, drizzled::plugin::Handle **); |
750 | plugin_del(plugin); |
751 | } |
752 | } |
753 | |
754 | -static bool plugin_initialize(struct st_plugin_int *plugin) |
755 | +static bool plugin_initialize(drizzled::plugin::Handle *plugin) |
756 | { |
757 | assert(plugin->isInited == false); |
758 | |
759 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
760 | - if (plugin->plugin->init) |
761 | + if (plugin->getManifest().init) |
762 | { |
763 | - if (plugin->plugin->init(registry)) |
764 | + if (plugin->getManifest().init(registry)) |
765 | { |
766 | errmsg_printf(ERRMSG_LVL_ERROR, |
767 | _("Plugin '%s' init function returned error.\n"), |
768 | - plugin->name.str); |
769 | + plugin->getName().c_str()); |
770 | goto err; |
771 | } |
772 | } |
773 | plugin->isInited= true; |
774 | |
775 | - if (plugin->plugin->status_vars) |
776 | + if (plugin->getManifest().status_vars) |
777 | { |
778 | - add_status_vars(plugin->plugin->status_vars); // add_status_vars makes a copy |
779 | + add_status_vars(plugin->getManifest().status_vars); // add_status_vars makes a copy |
780 | } |
781 | |
782 | /* |
783 | @@ -584,9 +580,9 @@ |
784 | int plugin_init(int *argc, char **argv, int flags) |
785 | { |
786 | uint32_t idx; |
787 | - struct drizzled_plugin_manifest **builtins; |
788 | - struct drizzled_plugin_manifest *plugin; |
789 | - struct st_plugin_int tmp, *plugin_ptr; |
790 | + Manifest **builtins; |
791 | + Manifest *manifest; |
792 | + Handle *handle; |
793 | MEM_ROOT tmp_root; |
794 | |
795 | if (initialized) |
796 | @@ -601,9 +597,9 @@ |
797 | |
798 | |
799 | if (my_init_dynamic_array(&plugin_dl_array, |
800 | - sizeof(struct st_plugin_dl *),16,16) || |
801 | + sizeof(Library *),16,16) || |
802 | my_init_dynamic_array(&plugin_array, |
803 | - sizeof(struct st_plugin_int *),16,16)) |
804 | + sizeof(Handle *),16,16)) |
805 | goto err; |
806 | |
807 | initialized= 1; |
808 | @@ -613,21 +609,20 @@ |
809 | */ |
810 | for (builtins= drizzled_builtins; *builtins; builtins++) |
811 | { |
812 | - for (plugin= *builtins; plugin->name; plugin++) |
813 | + for (manifest= *builtins; manifest->name; manifest++) |
814 | { |
815 | - memset(&tmp, 0, sizeof(tmp)); |
816 | - tmp.plugin= plugin; |
817 | - tmp.name.str= (char *)plugin->name; |
818 | - tmp.name.length= strlen(plugin->name); |
819 | + handle= new (std::nothrow) Handle(manifest); |
820 | + if (handle == NULL) |
821 | + return true; |
822 | |
823 | free_root(&tmp_root, MYF(MY_MARK_BLOCKS_FREE)); |
824 | - if (test_plugin_options(&tmp_root, &tmp, argc, argv)) |
825 | + if (test_plugin_options(&tmp_root, handle, argc, argv)) |
826 | continue; |
827 | |
828 | - if (register_builtin(&tmp, &plugin_ptr)) |
829 | + if (register_builtin(handle, &handle)) |
830 | goto err_unlock; |
831 | |
832 | - if (plugin_initialize(plugin_ptr)) |
833 | + if (plugin_initialize(handle)) |
834 | goto err_unlock; |
835 | |
836 | } |
837 | @@ -649,11 +644,11 @@ |
838 | */ |
839 | for (idx= 0; idx < plugin_array.elements; idx++) |
840 | { |
841 | - plugin_ptr= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); |
842 | - if (plugin_ptr->isInited == false) |
843 | + handle= *dynamic_element(&plugin_array, idx, Handle **); |
844 | + if (handle->isInited == false) |
845 | { |
846 | - if (plugin_initialize(plugin_ptr)) |
847 | - plugin_del(plugin_ptr); |
848 | + if (plugin_initialize(handle)) |
849 | + plugin_del(handle); |
850 | } |
851 | } |
852 | |
853 | @@ -670,8 +665,8 @@ |
854 | } |
855 | |
856 | |
857 | -static bool register_builtin(struct st_plugin_int *tmp, |
858 | - struct st_plugin_int **ptr) |
859 | +static bool register_builtin(Handle *tmp, |
860 | + Handle **ptr) |
861 | { |
862 | |
863 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
864 | @@ -683,9 +678,7 @@ |
865 | return(1); |
866 | |
867 | *ptr= *dynamic_element(&plugin_array, plugin_array.elements - 1, |
868 | - struct st_plugin_int **)= |
869 | - (struct st_plugin_int *) memdup_root(&plugin_mem_root, (unsigned char*)tmp, |
870 | - sizeof(struct st_plugin_int)); |
871 | + Handle **); |
872 | |
873 | registry.add(*ptr); |
874 | |
875 | @@ -701,8 +694,8 @@ |
876 | { |
877 | char buffer[FN_REFLEN]; |
878 | LEX_STRING name= {buffer, 0}, dl= {NULL, 0}, *str= &name; |
879 | - struct st_plugin_dl *plugin_dl; |
880 | - struct drizzled_plugin_manifest *plugin; |
881 | + Library *plugin_dl; |
882 | + Manifest *plugin; |
883 | char *p= buffer; |
884 | while (list) |
885 | { |
886 | @@ -778,8 +771,8 @@ |
887 | { |
888 | uint32_t idx; |
889 | size_t count= plugin_array.elements; |
890 | - vector<st_plugin_int *> plugins; |
891 | - vector<st_plugin_dl *> dl; |
892 | + vector<Handle *> plugins; |
893 | + vector<Library *> dl; |
894 | |
895 | if (initialized) |
896 | { |
897 | @@ -803,7 +796,7 @@ |
898 | dl.reserve(count); |
899 | for (idx= 0; idx < count; idx++) |
900 | dl.push_back(*dynamic_element(&plugin_dl_array, idx, |
901 | - struct st_plugin_dl **)); |
902 | + Library **)); |
903 | for (idx= 0; idx < count; idx++) |
904 | free_plugin_mem(dl[idx]); |
905 | delete_dynamic(&plugin_dl_array); |
906 | @@ -1123,7 +1116,7 @@ |
907 | { |
908 | sys_var *var; |
909 | sys_var_pluginvar *pi= NULL; |
910 | - st_plugin_int *plugin; |
911 | + Handle *plugin; |
912 | |
913 | pthread_rwlock_rdlock(&LOCK_system_variables_hash); |
914 | if ((var= intern_find_sys_var(str, length, false)) && |
915 | @@ -1867,10 +1860,10 @@ |
916 | } |
917 | |
918 | |
919 | -static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, |
920 | +static int construct_options(MEM_ROOT *mem_root, Handle *tmp, |
921 | my_option *options, bool can_disable) |
922 | { |
923 | - const char *plugin_name= tmp->plugin->name; |
924 | + const char *plugin_name= tmp->getManifest().name; |
925 | uint32_t namelen= strlen(plugin_name), optnamelen; |
926 | uint32_t buffer_length= namelen * 4 + (can_disable ? 75 : 10); |
927 | char *name= (char*) alloc_root(mem_root, buffer_length) + 1; |
928 | @@ -1916,7 +1909,7 @@ |
929 | by my_getopt and register_var() in the first pass uses realloc |
930 | */ |
931 | |
932 | - for (plugin_option= tmp->plugin->system_vars; |
933 | + for (plugin_option= tmp->getManifest().system_vars; |
934 | plugin_option && *plugin_option; plugin_option++, index++) |
935 | { |
936 | opt= *plugin_option; |
937 | @@ -1953,7 +1946,7 @@ |
938 | }; |
939 | } |
940 | |
941 | - for (plugin_option= tmp->plugin->system_vars; |
942 | + for (plugin_option= tmp->getManifest().system_vars; |
943 | plugin_option && *plugin_option; plugin_option++, index++) |
944 | { |
945 | switch ((opt= *plugin_option)->flags & PLUGIN_VAR_TYPEMASK) { |
946 | @@ -2082,24 +2075,24 @@ |
947 | } |
948 | |
949 | |
950 | -static my_option *construct_help_options(MEM_ROOT *mem_root, |
951 | - struct st_plugin_int *p) |
952 | +static my_option *construct_help_options(MEM_ROOT *mem_root, Handle *p) |
953 | { |
954 | st_mysql_sys_var **opt; |
955 | my_option *opts; |
956 | bool can_disable; |
957 | uint32_t count= EXTRA_OPTIONS; |
958 | |
959 | - for (opt= p->plugin->system_vars; opt && *opt; opt++, count+= 2) {}; |
960 | + for (opt= p->getManifest().system_vars; opt && *opt; opt++, count+= 2) {}; |
961 | |
962 | - if (!(opts= (my_option*) alloc_root(mem_root, sizeof(my_option) * count))) |
963 | + opts= (my_option*)alloc_root(mem_root, (sizeof(my_option) * count)); |
964 | + if (opts == NULL) |
965 | return NULL; |
966 | |
967 | memset(opts, 0, sizeof(my_option) * count); |
968 | |
969 | - if ((my_strcasecmp(&my_charset_utf8_general_ci, p->name.str, "MyISAM") == 0)) |
970 | + if ((my_strcasecmp(&my_charset_utf8_general_ci, p->getName().c_str(), "MyISAM") == 0)) |
971 | can_disable= false; |
972 | - else if ((my_strcasecmp(&my_charset_utf8_general_ci, p->name.str, "MEMORY") == 0)) |
973 | + else if ((my_strcasecmp(&my_charset_utf8_general_ci, p->getName().c_str(), "MEMORY") == 0)) |
974 | can_disable= false; |
975 | else |
976 | can_disable= true; |
977 | @@ -2125,7 +2118,7 @@ |
978 | NOTE: |
979 | Requires that a write-lock is held on LOCK_system_variables_hash |
980 | */ |
981 | -static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, |
982 | +static int test_plugin_options(MEM_ROOT *tmp_root, Handle *tmp, |
983 | int *argc, char **argv) |
984 | { |
985 | struct sys_var_chain chain= { NULL, NULL }; |
986 | @@ -2140,14 +2133,13 @@ |
987 | sys_var *v; |
988 | struct st_bookmark *var; |
989 | uint32_t len, count= EXTRA_OPTIONS; |
990 | - assert(tmp->plugin && tmp->name.str); |
991 | |
992 | - for (opt= tmp->plugin->system_vars; opt && *opt; opt++) |
993 | + for (opt= tmp->getManifest().system_vars; opt && *opt; opt++) |
994 | count+= 2; /* --{plugin}-{optname} and --plugin-{plugin}-{optname} */ |
995 | |
996 | - if ((my_strcasecmp(&my_charset_utf8_general_ci, tmp->name.str, "MyISAM") == 0)) |
997 | + if ((my_strcasecmp(&my_charset_utf8_general_ci, tmp->getName().c_str(), "MyISAM") == 0)) |
998 | can_disable= false; |
999 | - else if ((my_strcasecmp(&my_charset_utf8_general_ci, tmp->name.str, "MEMORY") == 0)) |
1000 | + else if ((my_strcasecmp(&my_charset_utf8_general_ci, tmp->getName().c_str(), "MEMORY") == 0)) |
1001 | can_disable= false; |
1002 | else |
1003 | can_disable= true; |
1004 | @@ -2156,14 +2148,14 @@ |
1005 | { |
1006 | if (!(opts= (my_option*) alloc_root(tmp_root, sizeof(my_option) * count))) |
1007 | { |
1008 | - errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory for plugin '%s'."), tmp->name.str); |
1009 | + errmsg_printf(ERRMSG_LVL_ERROR, _("Out of memory for plugin '%s'."), tmp->getName().c_str()); |
1010 | return(-1); |
1011 | } |
1012 | memset(opts, 0, sizeof(my_option) * count); |
1013 | |
1014 | if (construct_options(tmp_root, tmp, opts, can_disable)) |
1015 | { |
1016 | - errmsg_printf(ERRMSG_LVL_ERROR, _("Bad options for plugin '%s'."), tmp->name.str); |
1017 | + errmsg_printf(ERRMSG_LVL_ERROR, _("Bad options for plugin '%s'."), tmp->getName().c_str()); |
1018 | return(-1); |
1019 | } |
1020 | |
1021 | @@ -2173,7 +2165,7 @@ |
1022 | if (error) |
1023 | { |
1024 | errmsg_printf(ERRMSG_LVL_ERROR, _("Parsing options for plugin '%s' failed."), |
1025 | - tmp->name.str); |
1026 | + tmp->getName().c_str()); |
1027 | goto err; |
1028 | } |
1029 | } |
1030 | @@ -2181,18 +2173,18 @@ |
1031 | error= 1; |
1032 | |
1033 | { |
1034 | - for (opt= tmp->plugin->system_vars; opt && *opt; opt++) |
1035 | + for (opt= tmp->getManifest().system_vars; opt && *opt; opt++) |
1036 | { |
1037 | if (((o= *opt)->flags & PLUGIN_VAR_NOSYSVAR)) |
1038 | continue; |
1039 | |
1040 | - if ((var= find_bookmark(tmp->name.str, o->name, o->flags))) |
1041 | + if ((var= find_bookmark(tmp->getName().c_str(), o->name, o->flags))) |
1042 | v= new (mem_root) sys_var_pluginvar(var->key + 1, o); |
1043 | else |
1044 | { |
1045 | - len= tmp->name.length + strlen(o->name) + 2; |
1046 | + len= tmp->getName().length() + strlen(o->name) + 2; |
1047 | varname= (char*) alloc_root(mem_root, len); |
1048 | - sprintf(varname,"%s-%s",tmp->name.str,o->name); |
1049 | + sprintf(varname,"%s-%s",tmp->getName().c_str(),o->name); |
1050 | my_casedn_str(&my_charset_utf8_general_ci, varname); |
1051 | |
1052 | for (p= varname; *p; p++) |
1053 | @@ -2216,7 +2208,7 @@ |
1054 | if (mysql_add_sys_var_chain(chain.first, NULL)) |
1055 | { |
1056 | errmsg_printf(ERRMSG_LVL_ERROR, _("Plugin '%s' has conflicting system variables"), |
1057 | - tmp->name.str); |
1058 | + tmp->getName().c_str()); |
1059 | goto err; |
1060 | } |
1061 | tmp->system_vars= chain.first; |
1062 | @@ -2235,49 +2227,69 @@ |
1063 | Help Verbose text with Plugin System Variables |
1064 | ****************************************************************************/ |
1065 | |
1066 | -static int option_cmp(my_option *a, my_option *b) |
1067 | -{ |
1068 | - return my_strcasecmp(&my_charset_utf8_general_ci, a->name, b->name); |
1069 | -} |
1070 | - |
1071 | - |
1072 | -void my_print_help_inc_plugins(my_option *main_options, uint32_t size) |
1073 | -{ |
1074 | - DYNAMIC_ARRAY all_options; |
1075 | - struct st_plugin_int *p; |
1076 | +class OptionCmp |
1077 | +{ |
1078 | +public: |
1079 | + bool operator() (const my_option &a, const my_option &b) |
1080 | + { |
1081 | + return my_strcasecmp(&my_charset_utf8_general_ci, a.name, b.name); |
1082 | + } |
1083 | +}; |
1084 | + |
1085 | + |
1086 | +void my_print_help_inc_plugins(my_option *main_options) |
1087 | +{ |
1088 | + vector<my_option> all_options; |
1089 | + Handle *p; |
1090 | MEM_ROOT mem_root; |
1091 | - my_option *opt; |
1092 | + my_option *opt= NULL; |
1093 | |
1094 | init_alloc_root(&mem_root, 4096, 4096); |
1095 | - my_init_dynamic_array(&all_options, sizeof(my_option), size, size/4); |
1096 | |
1097 | if (initialized) |
1098 | for (uint32_t idx= 0; idx < plugin_array.elements; idx++) |
1099 | { |
1100 | - p= *dynamic_element(&plugin_array, idx, struct st_plugin_int **); |
1101 | - |
1102 | - if (!p->plugin->system_vars || |
1103 | - !(opt= construct_help_options(&mem_root, p))) |
1104 | + p= *dynamic_element(&plugin_array, idx, Handle **); |
1105 | + |
1106 | + if (p->getManifest().system_vars == NULL) |
1107 | + continue; |
1108 | + |
1109 | + opt= construct_help_options(&mem_root, p); |
1110 | + if (opt == NULL) |
1111 | continue; |
1112 | |
1113 | /* Only options with a non-NULL comment are displayed in help text */ |
1114 | for (;opt->id; opt++) |
1115 | + { |
1116 | if (opt->comment) |
1117 | - insert_dynamic(&all_options, (unsigned char*) opt); |
1118 | + { |
1119 | + all_options.push_back(*opt); |
1120 | + |
1121 | + } |
1122 | + } |
1123 | } |
1124 | |
1125 | for (;main_options->id; main_options++) |
1126 | - insert_dynamic(&all_options, (unsigned char*) main_options); |
1127 | + { |
1128 | + if (main_options->comment) |
1129 | + { |
1130 | + all_options.push_back(*main_options); |
1131 | + } |
1132 | + } |
1133 | |
1134 | - sort_dynamic(&all_options, (qsort_cmp) option_cmp); |
1135 | + /** |
1136 | + * @TODO: Fix the my_option building so that it doens't break sort |
1137 | + * |
1138 | + * sort(all_options.begin(), all_options.end(), OptionCmp()); |
1139 | + */ |
1140 | |
1141 | /* main_options now points to the empty option terminator */ |
1142 | - insert_dynamic(&all_options, (unsigned char*) main_options); |
1143 | - |
1144 | - my_print_help((my_option*) all_options.buffer); |
1145 | - my_print_variables((my_option*) all_options.buffer); |
1146 | - |
1147 | - delete_dynamic(&all_options); |
1148 | + all_options.push_back(*main_options); |
1149 | + |
1150 | + my_print_help(&*(all_options.begin())); |
1151 | + my_print_variables(&*(all_options.begin())); |
1152 | + |
1153 | free_root(&mem_root, MYF(0)); |
1154 | + |
1155 | } |
1156 | |
1157 | |
1158 | === modified file 'drizzled/sql_plugin.h' |
1159 | --- drizzled/sql_plugin.h 2009-07-07 09:06:29 +0000 |
1160 | +++ drizzled/sql_plugin.h 2009-07-16 17:37:03 +0000 |
1161 | @@ -36,63 +36,15 @@ |
1162 | #ifndef DRIZZLE_SERVER_PLUGIN_H |
1163 | #define DRIZZLE_SERVER_PLUGIN_H |
1164 | |
1165 | -#include <drizzled/lex_string.h> |
1166 | -#include <mysys/my_alloc.h> |
1167 | -#include <drizzled/plugin_registry.h> |
1168 | #include <drizzled/plugin.h> |
1169 | +#include <drizzled/plugin/manifest.h> |
1170 | +#include <drizzled/plugin/library.h> |
1171 | +#include <drizzled/plugin/handle.h> |
1172 | |
1173 | +class Session; |
1174 | class sys_var; |
1175 | -class Session; |
1176 | - |
1177 | - |
1178 | -/* A handle for the dynamic library containing a plugin or plugins. */ |
1179 | -struct drizzled_plugin_manifest; |
1180 | - |
1181 | -struct st_plugin_dl |
1182 | -{ |
1183 | - LEX_STRING dl; |
1184 | - void *handle; |
1185 | - struct drizzled_plugin_manifest *plugins; |
1186 | -}; |
1187 | - |
1188 | -/* A handle of a plugin */ |
1189 | - |
1190 | -struct st_plugin_int |
1191 | -{ |
1192 | - LEX_STRING name; |
1193 | - struct drizzled_plugin_manifest *plugin; |
1194 | - struct st_plugin_dl *plugin_dl; |
1195 | - bool isInited; |
1196 | - MEM_ROOT mem_root; /* memory for dynamic plugin structures */ |
1197 | - sys_var *system_vars; /* server variables for this plugin */ |
1198 | -}; |
1199 | - |
1200 | - |
1201 | -#define plugin_decl(pi) ((pi)->plugin) |
1202 | -#define plugin_data(pi,cast) (static_cast<cast>((pi)->data)) |
1203 | -#define plugin_name(pi) (&((pi)->name)) |
1204 | -#define plugin_equals(p1,p2) ((p1) && (p2) && (p1) == (p2)) |
1205 | - |
1206 | - |
1207 | -typedef int (*plugin_type_init)(PluginRegistry &); |
1208 | - |
1209 | -/* |
1210 | - Plugin description structure. |
1211 | -*/ |
1212 | - |
1213 | -struct drizzled_plugin_manifest |
1214 | -{ |
1215 | - const char *name; /* plugin name (for SHOW PLUGINS) */ |
1216 | - const char *version; /* plugin version (for SHOW PLUGINS) */ |
1217 | - const char *author; /* plugin author (for SHOW PLUGINS) */ |
1218 | - const char *descr; /* general descriptive text (for SHOW PLUGINS ) */ |
1219 | - int license; /* plugin license (PLUGIN_LICENSE_XXX) */ |
1220 | - plugin_type_init init; /* function to invoke when plugin is loaded */ |
1221 | - plugin_type_init deinit; /* function to invoke when plugin is unloaded */ |
1222 | - struct st_mysql_show_var *status_vars; |
1223 | - struct st_mysql_sys_var **system_vars; |
1224 | - void *reserved1; /* reserved for dependency checking */ |
1225 | -}; |
1226 | +typedef struct st_mysql_lex_string LEX_STRING; |
1227 | +struct my_option; |
1228 | |
1229 | extern char *opt_plugin_load; |
1230 | extern char *opt_plugin_dir_ptr; |
1231 | @@ -100,12 +52,12 @@ |
1232 | |
1233 | extern int plugin_init(int *argc, char **argv, int init_flags); |
1234 | extern void plugin_shutdown(void); |
1235 | -extern void my_print_help_inc_plugins(struct my_option *options, uint32_t size); |
1236 | +extern void my_print_help_inc_plugins(my_option *options); |
1237 | extern bool plugin_is_ready(const LEX_STRING *name, int type); |
1238 | extern bool mysql_install_plugin(Session *session, const LEX_STRING *name, |
1239 | const LEX_STRING *dl); |
1240 | extern bool mysql_uninstall_plugin(Session *session, const LEX_STRING *name); |
1241 | -extern bool plugin_register_builtin(struct drizzled_plugin_manifest *plugin); |
1242 | +extern bool plugin_register_builtin(drizzled::plugin::Manifest *plugin); |
1243 | extern void plugin_sessionvar_init(Session *session); |
1244 | extern void plugin_sessionvar_cleanup(Session *session); |
1245 | extern sys_var *intern_find_sys_var(const char *str, uint32_t, bool no_error); |
1246 | |
1247 | === modified file 'extra/clean_source.sh' |
1248 | --- extra/clean_source.sh 2009-07-10 21:50:02 +0000 |
1249 | +++ extra/clean_source.sh 2009-07-15 21:16:34 +0000 |
1250 | @@ -15,8 +15,8 @@ |
1251 | # along with this program; if not, write to the Free Software |
1252 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
1253 | |
1254 | -for file in `ack-grep -f | grep -v innobase | grep -v '\.pb\.'| grep -v bak-header | grep -v '^intl' | grep -v '^config' `; do |
1255 | +for file in `ack-grep -f | grep -v innobase | grep -v '\.pb\.'| grep -v bak-header | grep -v '^intl' | grep -v '^config' | grep -v '\.am$' | grep -v '\.ac$' | grep -v m4 | grep -v sql_yacc.yy | grep -v '.gperf$' `; do |
1256 | grep Copyright $file >/dev/null 2>&1 || echo "No copyright header in $file" |
1257 | - uncrustify -c ../config/uncrustify.cfg --replace $file |
1258 | + uncrustify -c config/uncrustify.cfg --replace $file |
1259 | done |
1260 | |
1261 | |
1262 | === modified file 'm4/lib-prefix.m4' |
1263 | --- m4/lib-prefix.m4 2009-07-14 22:35:09 +0000 |
1264 | +++ m4/lib-prefix.m4 2009-07-18 22:10:19 +0000 |
1265 | @@ -183,18 +183,13 @@ |
1266 | dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." |
1267 | dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the |
1268 | dnl symlink is missing, so we set acl_libdirstem2 too. |
1269 | - AC_MSG_CHECKING([if buildling 64-bit app]) |
1270 | - AC_RUN_IFELSE([ |
1271 | - AC_LANG_PROGRAM([ |
1272 | - ], [ |
1273 | - return sizeof(void*) == 8 ? 0 : 1; |
1274 | - ]) |
1275 | - ], [ |
1276 | - gl_cv_solaris_64bit=yes |
1277 | - ], [ |
1278 | - gl_cv_solaris_64bit=no |
1279 | - ]) |
1280 | - AC_MSG_RESULT([$gl_cv_solaris_64bit]) |
1281 | + AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], |
1282 | + [AC_RUN_IFELSE([ |
1283 | + AC_LANG_PROGRAM([], [[ |
1284 | + return sizeof(void*) == 8 ? 0 : 1; |
1285 | + ]]) |
1286 | + ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) |
1287 | + ]) |
1288 | if test $gl_cv_solaris_64bit = yes; then |
1289 | acl_libdirstem=lib/64 |
1290 | case "$host_cpu" in |
1291 | |
1292 | === modified file 'm4/pandora_64bit.m4' |
1293 | --- m4/pandora_64bit.m4 2009-07-13 19:24:14 +0000 |
1294 | +++ m4/pandora_64bit.m4 2009-07-18 22:10:19 +0000 |
1295 | @@ -7,6 +7,8 @@ |
1296 | dnl Macro: PANDORA_64BIT |
1297 | dnl --------------------------------------------------------------------------- |
1298 | AC_DEFUN([PANDORA_64BIT],[ |
1299 | + AC_BEFORE([$0], [AC_LIB_PREFIX]) |
1300 | + |
1301 | |
1302 | AC_ARG_ENABLE([64bit],[ |
1303 | AS_HELP_STRING([--disable-64bit], |
1304 | |
1305 | === modified file 'm4/pandora_canonical.m4' |
1306 | --- m4/pandora_canonical.m4 2009-07-15 19:22:16 +0000 |
1307 | +++ m4/pandora_canonical.m4 2009-07-18 22:10:19 +0000 |
1308 | @@ -4,7 +4,7 @@ |
1309 | dnl with or without modifications, as long as this notice is preserved. |
1310 | |
1311 | dnl Which version of the canonical setup we're using |
1312 | -AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.20]) |
1313 | +AC_DEFUN([PANDORA_CANONICAL_VERSION],[0.22]) |
1314 | |
1315 | AC_DEFUN([PANDORA_FORCE_DEPEND_TRACKING],[ |
1316 | dnl Force dependency tracking on for Sun Studio builds |
1317 | @@ -59,6 +59,7 @@ |
1318 | |
1319 | AC_REQUIRE([AC_PROG_CC]) |
1320 | AC_REQUIRE([PANDORA_MAC_GCC42]) |
1321 | + AC_REQUIRE([PANDORA_64BIT]) |
1322 | |
1323 | dnl Once we can use a modern autoconf, we can use this |
1324 | dnl AC_PROG_CC_C99 |
1325 | @@ -66,6 +67,7 @@ |
1326 | AC_PROG_CPP |
1327 | AM_PROG_CC_C_O |
1328 | |
1329 | + |
1330 | gl_USE_SYSTEM_EXTENSIONS |
1331 | m4_if(PCT_FORCE_GCC42, [yes], [ |
1332 | AS_IF([test "$GCC" = "yes"], PANDORA_ENSURE_GCC_VERSION) |
1333 | @@ -111,7 +113,6 @@ |
1334 | PANDORA_CHECK_CXX_VERSION |
1335 | |
1336 | PANDORA_OPTIMIZE |
1337 | - PANDORA_64BIT |
1338 | |
1339 | dnl We need to inject error into the cflags to test if visibility works or not |
1340 | save_CFLAGS="${CFLAGS}" |
1341 | |
1342 | === modified file 'mysys/base64.cc' |
1343 | --- mysys/base64.cc 2009-05-03 15:58:12 +0000 |
1344 | +++ mysys/base64.cc 2009-07-17 22:25:54 +0000 |
1345 | @@ -213,9 +213,9 @@ |
1346 | i++; |
1347 | |
1348 | end: |
1349 | - b[0]= (c >> 16) & 0xff; |
1350 | - b[1]= (c >> 8) & 0xff; |
1351 | - b[2]= (c >> 0) & 0xff; |
1352 | + b[0]= char((c >> 16) & 0xff); |
1353 | + b[1]= char((c >> 8) & 0xff); |
1354 | + b[2]= char((c >> 0) & 0xff); |
1355 | |
1356 | for (j=0; j<3-mark; j++) |
1357 | *d++= b[j]; |
1358 | @@ -228,7 +228,7 @@ |
1359 | The variable 'i' is set to 'len' when padding has been read, so it |
1360 | does not actually reflect the number of bytes read from 'src'. |
1361 | */ |
1362 | - return i != len ? -1 : d - dst_base; |
1363 | + return (i != len) ? -1 : int(d - dst_base); |
1364 | } |
1365 | |
1366 | |
1367 | |
1368 | === modified file 'mysys/checksum.cc' |
1369 | --- mysys/checksum.cc 2009-04-17 21:01:47 +0000 |
1370 | +++ mysys/checksum.cc 2009-07-17 22:25:54 +0000 |
1371 | @@ -30,6 +30,6 @@ |
1372 | |
1373 | ha_checksum my_checksum(ha_checksum crc, const unsigned char *pos, size_t length) |
1374 | { |
1375 | - return (ha_checksum)crc32((uint32_t)crc, pos, length); |
1376 | + return ha_checksum(crc32((uint32_t)crc, pos, uInt(length))); |
1377 | } |
1378 | |
1379 | |
1380 | === modified file 'mysys/default.cc' |
1381 | --- mysys/default.cc 2009-07-10 21:19:35 +0000 |
1382 | +++ mysys/default.cc 2009-07-17 23:20:36 +0000 |
1383 | @@ -164,7 +164,7 @@ |
1384 | /* Handle --defaults-group-suffix= */ |
1385 | uint32_t i; |
1386 | const char **extra_groups; |
1387 | - const uint32_t instance_len= strlen(my_defaults_group_suffix); |
1388 | + const size_t instance_len= strlen(my_defaults_group_suffix); |
1389 | struct handle_option_ctx *ctx= (struct handle_option_ctx*) func_ctx; |
1390 | char *ptr; |
1391 | TYPELIB *group= ctx->group; |
1392 | @@ -176,7 +176,7 @@ |
1393 | |
1394 | for (i= 0; i < group->count; i++) |
1395 | { |
1396 | - uint32_t len; |
1397 | + size_t len; |
1398 | extra_groups[i]= group->type_names[i]; /** copy group */ |
1399 | |
1400 | len= strlen(extra_groups[i]); |
1401 | @@ -455,8 +455,8 @@ |
1402 | memcpy(res+1+args.elements, *argv + 1, (*argc-1)*sizeof(char*)); |
1403 | res[args.elements+ *argc]=0; /* last null */ |
1404 | |
1405 | - (*argc)+=args.elements; |
1406 | - *argv= (char**) res; |
1407 | + (*argc)+=int(args.elements); |
1408 | + *argv= static_cast<char**>(res); |
1409 | *(MEM_ROOT*) ptr= alloc; /* Save alloc root for free */ |
1410 | delete_dynamic(&args); |
1411 | if (found_print_defaults) |
1412 | |
1413 | === removed file 'mysys/default_modify.cc' |
1414 | --- mysys/default_modify.cc 2009-06-30 21:28:16 +0000 |
1415 | +++ mysys/default_modify.cc 1970-01-01 00:00:00 +0000 |
1416 | @@ -1,252 +0,0 @@ |
1417 | -/* Copyright (C) 2005 MySQL AB |
1418 | - |
1419 | - This program is free software; you can redistribute it and/or modify |
1420 | - it under the terms of the GNU General Public License as published by |
1421 | - the Free Software Foundation; version 2 of the License. |
1422 | - |
1423 | - This program is distributed in the hope that it will be useful, |
1424 | - but WITHOUT ANY WARRANTY; without even the implied warranty of |
1425 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1426 | - GNU General Public License for more details. |
1427 | - |
1428 | - You should have received a copy of the GNU General Public License |
1429 | - along with this program; if not, write to the Free Software |
1430 | - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
1431 | - |
1432 | -#include "mysys/mysys_priv.h" |
1433 | -#include <mystrings/m_string.h> |
1434 | -#include <mysys/my_dir.h> |
1435 | - |
1436 | -#include <stdio.h> |
1437 | -#include <algorithm> |
1438 | - |
1439 | -using namespace std; |
1440 | - |
1441 | -#define BUFF_SIZE 1024 |
1442 | -#define RESERVE 1024 /* Extend buffer with this extent */ |
1443 | - |
1444 | -#define NEWLINE "\n" |
1445 | -#define NEWLINE_LEN 1 |
1446 | - |
1447 | -static char *add_option(char *dst, const char *option_value, |
1448 | - const char *option, int remove_option); |
1449 | - |
1450 | - |
1451 | -/* |
1452 | - Add/remove option to the option file section. |
1453 | - |
1454 | - SYNOPSYS |
1455 | - modify_defaults_file() |
1456 | - file_location The location of configuration file to edit |
1457 | - option The name of the option to look for (can be NULL) |
1458 | - option value The value of the option we would like to set (can be NULL) |
1459 | - section_name The name of the section (must be NOT NULL) |
1460 | - remove_option This defines what we want to remove: |
1461 | - - MY_REMOVE_NONE -- nothing to remove; |
1462 | - - MY_REMOVE_OPTION -- remove the specified option; |
1463 | - - MY_REMOVE_SECTION -- remove the specified section; |
1464 | - IMPLEMENTATION |
1465 | - We open the option file first, then read the file line-by-line, |
1466 | - looking for the section we need. At the same time we put these lines |
1467 | - into a buffer. Then we look for the option within this section and |
1468 | - change/remove it. In the end we get a buffer with modified version of the |
1469 | - file. Then we write it to the file, truncate it if needed and close it. |
1470 | - Note that there is a small time gap, when the file is incomplete, |
1471 | - and this theoretically might introduce a problem. |
1472 | - |
1473 | - RETURN |
1474 | - 0 - ok |
1475 | - 1 - some error has occured. Probably due to the lack of resourses |
1476 | - 2 - cannot open the file |
1477 | -*/ |
1478 | - |
1479 | -int modify_defaults_file(const char *file_location, const char *option, |
1480 | - const char *option_value, |
1481 | - const char *section_name, int remove_option) |
1482 | -{ |
1483 | - FILE *cnf_file; |
1484 | - struct stat file_stat; |
1485 | - char linebuff[BUFF_SIZE], *src_ptr, *dst_ptr, *file_buffer; |
1486 | - size_t opt_len= 0, optval_len= 0, sect_len; |
1487 | - uint32_t nr_newlines= 0; |
1488 | - size_t buffer_size; |
1489 | - bool in_section= false, opt_applied= 0; |
1490 | - size_t reserve_extended; |
1491 | - uint32_t new_opt_len; |
1492 | - int reserve_occupied= 0; |
1493 | - |
1494 | - if (!(cnf_file= fopen(file_location, "r+"))) |
1495 | - return(2); |
1496 | - |
1497 | - if (fstat(fileno(cnf_file), &file_stat)) |
1498 | - goto malloc_err; |
1499 | - |
1500 | - if (option && option_value) |
1501 | - { |
1502 | - opt_len= strlen(option); |
1503 | - optval_len= strlen(option_value); |
1504 | - } |
1505 | - |
1506 | - new_opt_len= opt_len + 1 + optval_len + NEWLINE_LEN; |
1507 | - |
1508 | - /* calculate the size of the buffer we need */ |
1509 | - reserve_extended= (opt_len + |
1510 | - 1 + /* For '=' char */ |
1511 | - optval_len + /* Option value len */ |
1512 | - NEWLINE_LEN + /* Space for newline */ |
1513 | - RESERVE); /* Some additional space */ |
1514 | - |
1515 | - buffer_size= (size_t)max((uint64_t)file_stat.st_size + 1, (uint64_t)SIZE_MAX); |
1516 | - |
1517 | - /* |
1518 | - Reserve space to read the contents of the file and some more |
1519 | - for the option we want to add. |
1520 | - */ |
1521 | - if (!(file_buffer= (char*) malloc(max(buffer_size + reserve_extended, |
1522 | - (size_t)SIZE_MAX)))) |
1523 | - goto malloc_err; |
1524 | - |
1525 | - sect_len= strlen(section_name); |
1526 | - |
1527 | - for (dst_ptr= file_buffer; fgets(linebuff, BUFF_SIZE, cnf_file); ) |
1528 | - { |
1529 | - /* Skip over whitespaces */ |
1530 | - for (src_ptr= linebuff; my_isspace(&my_charset_utf8_general_ci, *src_ptr); |
1531 | - src_ptr++) |
1532 | - {} |
1533 | - |
1534 | - if (!*src_ptr) /* Empty line */ |
1535 | - { |
1536 | - nr_newlines++; |
1537 | - continue; |
1538 | - } |
1539 | - |
1540 | - /* correct the option (if requested) */ |
1541 | - if (option && in_section && !strncmp(src_ptr, option, opt_len) && |
1542 | - (*(src_ptr + opt_len) == '=' || |
1543 | - my_isspace(&my_charset_utf8_general_ci, *(src_ptr + opt_len)) || |
1544 | - *(src_ptr + opt_len) == '\0')) |
1545 | - { |
1546 | - char *old_src_ptr= src_ptr; |
1547 | - src_ptr= strchr(src_ptr+ opt_len, '\0'); /* Find the end of the line */ |
1548 | - |
1549 | - /* could be negative */ |
1550 | - reserve_occupied+= (int) new_opt_len - (int) (src_ptr - old_src_ptr); |
1551 | - if (reserve_occupied >= (int) reserve_extended) |
1552 | - { |
1553 | - reserve_extended= (uint32_t) reserve_occupied + RESERVE; |
1554 | - if (!(file_buffer= (char*) realloc(file_buffer, buffer_size + |
1555 | - reserve_extended))) |
1556 | - goto malloc_err; |
1557 | - } |
1558 | - opt_applied= 1; |
1559 | - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); |
1560 | - } |
1561 | - else |
1562 | - { |
1563 | - /* |
1564 | - If we are going to the new group and have an option to apply, do |
1565 | - it now. If we are removing a single option or the whole section |
1566 | - this will only trigger opt_applied flag. |
1567 | - */ |
1568 | - |
1569 | - if (in_section && !opt_applied && *src_ptr == '[') |
1570 | - { |
1571 | - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); |
1572 | - opt_applied= 1; /* set the flag to do write() later */ |
1573 | - reserve_occupied= new_opt_len+ opt_len + 1 + NEWLINE_LEN; |
1574 | - } |
1575 | - |
1576 | - for (; nr_newlines; nr_newlines--) |
1577 | - dst_ptr= strcpy(dst_ptr, NEWLINE)+NEWLINE_LEN; |
1578 | - |
1579 | - /* Skip the section if MY_REMOVE_SECTION was given */ |
1580 | - if (!in_section || remove_option != MY_REMOVE_SECTION) |
1581 | - dst_ptr= strcpy(dst_ptr, linebuff); |
1582 | - dst_ptr+= strlen(linebuff); |
1583 | - } |
1584 | - /* Look for a section */ |
1585 | - if (*src_ptr == '[') |
1586 | - { |
1587 | - /* Copy the line to the buffer */ |
1588 | - if (!strncmp(++src_ptr, section_name, sect_len)) |
1589 | - { |
1590 | - src_ptr+= sect_len; |
1591 | - /* Skip over whitespaces. They are allowed after section name */ |
1592 | - for (; my_isspace(&my_charset_utf8_general_ci, *src_ptr); src_ptr++) |
1593 | - {} |
1594 | - |
1595 | - if (*src_ptr != ']') |
1596 | - { |
1597 | - in_section= false; |
1598 | - continue; /* Missing closing parenthesis. Assume this was no group */ |
1599 | - } |
1600 | - |
1601 | - if (remove_option == MY_REMOVE_SECTION) |
1602 | - dst_ptr= dst_ptr - strlen(linebuff); |
1603 | - |
1604 | - in_section= true; |
1605 | - } |
1606 | - else |
1607 | - in_section= false; /* mark that this section is of no interest to us */ |
1608 | - } |
1609 | - } |
1610 | - |
1611 | - /* |
1612 | - File ended. Apply an option or set opt_applied flag (in case of |
1613 | - MY_REMOVE_SECTION) so that the changes are saved. Do not do anything |
1614 | - if we are removing non-existent option. |
1615 | - */ |
1616 | - |
1617 | - if (!opt_applied && in_section && (remove_option != MY_REMOVE_OPTION)) |
1618 | - { |
1619 | - /* New option still remains to apply at the end */ |
1620 | - if (!remove_option && *(dst_ptr - 1) != '\n') |
1621 | - dst_ptr= strcpy(dst_ptr, NEWLINE)+NEWLINE_LEN; |
1622 | - dst_ptr= add_option(dst_ptr, option_value, option, remove_option); |
1623 | - opt_applied= 1; |
1624 | - } |
1625 | - for (; nr_newlines; nr_newlines--) |
1626 | - dst_ptr= strcpy(dst_ptr, NEWLINE)+NEWLINE_LEN; |
1627 | - |
1628 | - if (opt_applied) |
1629 | - { |
1630 | - /* Don't write the file if there are no changes to be made */ |
1631 | - if (ftruncate(fileno(cnf_file), (size_t) (dst_ptr - file_buffer)) || |
1632 | - fseeko(cnf_file, 0, SEEK_SET) || |
1633 | - fwrite(file_buffer, 1, (size_t) (dst_ptr - file_buffer), cnf_file)) |
1634 | - goto err; |
1635 | - } |
1636 | - if (fclose(cnf_file)) |
1637 | - return(1); |
1638 | - |
1639 | - free(file_buffer); |
1640 | - return(0); |
1641 | - |
1642 | -err: |
1643 | - free(file_buffer); |
1644 | -malloc_err: |
1645 | - fclose(cnf_file); |
1646 | - |
1647 | - return 1; /* out of resources */ |
1648 | -} |
1649 | - |
1650 | - |
1651 | -static char *add_option(char *dst, const char *option_value, |
1652 | - const char *option, int remove_option) |
1653 | -{ |
1654 | - if (!remove_option) |
1655 | - { |
1656 | - dst= strcpy(dst, option); |
1657 | - dst+= strlen(option); |
1658 | - if (*option_value) |
1659 | - { |
1660 | - *dst++= '='; |
1661 | - dst= strcpy(dst, option_value); |
1662 | - dst+= strlen(option_value); |
1663 | - } |
1664 | - /* add a newline */ |
1665 | - dst= strcpy(dst, NEWLINE)+NEWLINE_LEN; |
1666 | - } |
1667 | - return dst; |
1668 | -} |
1669 | |
1670 | === modified file 'mysys/my_bitmap.h' |
1671 | --- mysys/my_bitmap.h 2009-05-23 00:05:52 +0000 |
1672 | +++ mysys/my_bitmap.h 2009-07-17 22:25:54 +0000 |
1673 | @@ -80,7 +80,7 @@ |
1674 | |
1675 | static inline void bitmap_set_bit(MY_BITMAP const *map, uint32_t bit) |
1676 | { |
1677 | - ((unsigned char *)map->bitmap)[bit / 8] |= (1 << ((bit) & 7)); |
1678 | + ((unsigned char *)map->bitmap)[bit / 8] |= (unsigned char)(1 << ((bit) & 7)); |
1679 | } |
1680 | |
1681 | static inline void bitmap_flip_bit(MY_BITMAP const *map, uint32_t bit) |
1682 | |
1683 | === modified file 'mysys/my_sys.h' |
1684 | --- mysys/my_sys.h 2009-07-11 06:24:19 +0000 |
1685 | +++ mysys/my_sys.h 2009-07-17 23:20:36 +0000 |
1686 | @@ -71,10 +71,6 @@ |
1687 | #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ |
1688 | #define MY_GIVE_INFO 2 /* Give time info about process*/ |
1689 | |
1690 | -#define MY_REMOVE_NONE 0 /* Params for modify_defaults_file */ |
1691 | -#define MY_REMOVE_OPTION 1 |
1692 | -#define MY_REMOVE_SECTION 2 |
1693 | - |
1694 | #define ME_HIGHBYTE 8 /* Shift for colours */ |
1695 | #define ME_NOCUR 1 /* Don't use curses message */ |
1696 | #define ME_OLDWIN 2 /* Use old window */ |
1697 | @@ -401,9 +397,6 @@ |
1698 | char **group_suffix); |
1699 | extern int load_defaults(const char *conf_file, const char **groups, |
1700 | int *argc, char ***argv); |
1701 | -extern int modify_defaults_file(const char *file_location, const char *option, |
1702 | - const char *option_value, |
1703 | - const char *section_name, int remove_option); |
1704 | extern int my_search_option_files(const char *conf_file, int *argc, |
1705 | char ***argv, uint32_t *args_used, |
1706 | Process_option_func func, void *func_ctx); |
1707 | |
1708 | === modified file 'plugin/info_schema/info_schema_methods.cc' |
1709 | --- plugin/info_schema/info_schema_methods.cc 2009-07-09 01:35:10 +0000 |
1710 | +++ plugin/info_schema/info_schema_methods.cc 2009-07-18 18:11:42 +0000 |
1711 | @@ -330,7 +330,7 @@ |
1712 | return (0); |
1713 | } |
1714 | |
1715 | -class ShowPlugins : public unary_function<st_plugin_int *, bool> |
1716 | +class ShowPlugins : public unary_function<drizzled::plugin::Handle *, bool> |
1717 | { |
1718 | Session *session; |
1719 | Table *table; |
1720 | @@ -340,17 +340,17 @@ |
1721 | |
1722 | result_type operator() (argument_type plugin) |
1723 | { |
1724 | - struct drizzled_plugin_manifest *plug= plugin_decl(plugin); |
1725 | + const drizzled::plugin::Manifest &manifest= plugin->getManifest(); |
1726 | const CHARSET_INFO * const cs= system_charset_info; |
1727 | |
1728 | table->restoreRecordAsDefault(); |
1729 | |
1730 | - table->field[0]->store(plugin_name(plugin)->str, |
1731 | - plugin_name(plugin)->length, cs); |
1732 | + table->field[0]->store(plugin->getName().c_str(), |
1733 | + plugin->getName().size(), cs); |
1734 | |
1735 | - if (plug->version) |
1736 | + if (manifest.version) |
1737 | { |
1738 | - table->field[1]->store(plug->version, strlen(plug->version), cs); |
1739 | + table->field[1]->store(manifest.version, strlen(manifest.version), cs); |
1740 | table->field[1]->set_notnull(); |
1741 | } |
1742 | else |
1743 | @@ -365,9 +365,9 @@ |
1744 | table->field[2]->store(STRING_WITH_LEN("INACTIVE"), cs); |
1745 | } |
1746 | |
1747 | - if (plug->author) |
1748 | + if (manifest.author) |
1749 | { |
1750 | - table->field[3]->store(plug->author, strlen(plug->author), cs); |
1751 | + table->field[3]->store(manifest.author, strlen(manifest.author), cs); |
1752 | table->field[3]->set_notnull(); |
1753 | } |
1754 | else |
1755 | @@ -375,9 +375,9 @@ |
1756 | table->field[3]->set_null(); |
1757 | } |
1758 | |
1759 | - if (plug->descr) |
1760 | + if (manifest.descr) |
1761 | { |
1762 | - table->field[4]->store(plug->descr, strlen(plug->descr), cs); |
1763 | + table->field[4]->store(manifest.descr, strlen(manifest.descr), cs); |
1764 | table->field[4]->set_notnull(); |
1765 | } |
1766 | else |
1767 | @@ -385,22 +385,23 @@ |
1768 | table->field[4]->set_null(); |
1769 | } |
1770 | |
1771 | - switch (plug->license) { |
1772 | + switch (manifest.license) { |
1773 | case PLUGIN_LICENSE_GPL: |
1774 | - table->field[5]->store(PLUGIN_LICENSE_GPL_STRING, |
1775 | - strlen(PLUGIN_LICENSE_GPL_STRING), cs); |
1776 | + table->field[5]->store(drizzled::plugin::LICENSE_GPL_STRING.c_str(), |
1777 | + drizzled::plugin::LICENSE_GPL_STRING.size(), cs); |
1778 | break; |
1779 | case PLUGIN_LICENSE_BSD: |
1780 | - table->field[5]->store(PLUGIN_LICENSE_BSD_STRING, |
1781 | - strlen(PLUGIN_LICENSE_BSD_STRING), cs); |
1782 | + table->field[5]->store(drizzled::plugin::LICENSE_BSD_STRING.c_str(), |
1783 | + drizzled::plugin::LICENSE_BSD_STRING.size(), cs); |
1784 | break; |
1785 | case PLUGIN_LICENSE_LGPL: |
1786 | - table->field[5]->store(PLUGIN_LICENSE_LGPL_STRING, |
1787 | - strlen(PLUGIN_LICENSE_LGPL_STRING), cs); |
1788 | + table->field[5]->store(drizzled::plugin::LICENSE_LGPL_STRING.c_str(), |
1789 | + drizzled::plugin::LICENSE_LGPL_STRING.size(), cs); |
1790 | break; |
1791 | default: |
1792 | - table->field[5]->store(PLUGIN_LICENSE_PROPRIETARY_STRING, |
1793 | - strlen(PLUGIN_LICENSE_PROPRIETARY_STRING), cs); |
1794 | + table->field[5]->store(drizzled::plugin::LICENSE_PROPRIETARY_STRING.c_str(), |
1795 | + drizzled::plugin::LICENSE_PROPRIETARY_STRING.size(), |
1796 | + cs); |
1797 | break; |
1798 | } |
1799 | table->field[5]->set_notnull(); |
1800 | @@ -414,8 +415,8 @@ |
1801 | Table *table= tables->table; |
1802 | |
1803 | PluginRegistry ®istry= PluginRegistry::getPluginRegistry(); |
1804 | - vector<st_plugin_int *> plugins= registry.get_list(true); |
1805 | - vector<st_plugin_int *>::iterator iter= |
1806 | + vector<drizzled::plugin::Handle *> plugins= registry.get_list(true); |
1807 | + vector<drizzled::plugin::Handle *>::iterator iter= |
1808 | find_if(plugins.begin(), plugins.end(), ShowPlugins(session, table)); |
1809 | if (iter != plugins.end()) |
1810 | { |
1811 | |
1812 | === modified file 'plugin/innobase/handler/ha_innodb.cc' |
1813 | --- plugin/innobase/handler/ha_innodb.cc 2009-07-07 09:06:29 +0000 |
1814 | +++ plugin/innobase/handler/ha_innodb.cc 2009-07-15 21:00:16 +0000 |
1815 | @@ -131,7 +131,7 @@ |
1816 | #ifdef DRIZZLE_DYNAMIC_PLUGIN |
1817 | /* These must be weak global variables in the dynamic plugin. */ |
1818 | #ifdef __WIN__ |
1819 | -struct drizzled_plugin_manifest* builtin_innobase_plugin_ptr; |
1820 | +struct drizzled::plugin::Manifest* builtin_innobase_plugin_ptr; |
1821 | #else |
1822 | int builtin_innobase_plugin; |
1823 | #endif /* __WIN__ */ |
1824 | @@ -9063,9 +9063,9 @@ |
1825 | |
1826 | /* Copy the system variables. */ |
1827 | |
1828 | - struct drizzled_plugin_manifest* builtin; |
1829 | - struct st_mysql_sys_var** sta; /* static parameters */ |
1830 | - struct st_mysql_sys_var** dyn; /* dynamic parameters */ |
1831 | + drizzled::plugin::Manifest* builtin; |
1832 | + st_mysql_sys_var** sta; /* static parameters */ |
1833 | + st_mysql_sys_var** dyn; /* dynamic parameters */ |
1834 | |
1835 | #ifdef __WIN__ |
1836 | if (!builtin_innobase_plugin_ptr) { |
1837 | @@ -9076,7 +9076,7 @@ |
1838 | builtin = builtin_innobase_plugin_ptr; |
1839 | #else |
1840 | |
1841 | - builtin = (struct drizzled_plugin_manifest*) &builtin_innobase_plugin; |
1842 | + builtin = (drizzled::plugin::Manifest*) &builtin_innobase_plugin; |
1843 | #endif |
1844 | |
1845 | for (sta = builtin->system_vars; *sta != NULL; sta++) { |
1846 | |
1847 | === modified file 'plugin/innobase/handler/win_delay_loader.cc' |
1848 | --- plugin/innobase/handler/win_delay_loader.cc 2009-04-11 00:30:51 +0000 |
1849 | +++ plugin/innobase/handler/win_delay_loader.cc 2009-07-15 21:00:16 +0000 |
1850 | @@ -76,7 +76,7 @@ |
1851 | The following is defined in ha_innodb.cc. It is used for copying the |
1852 | system variables from the builtin innodb plugin to the dynamic plugin. |
1853 | */ |
1854 | -extern struct drizzled_plugin_manifest* builtin_innobase_plugin_ptr; |
1855 | +extern drizzled::plugin::Manifest* builtin_innobase_plugin_ptr; |
1856 | |
1857 | /*********************************************************************** |
1858 | The preffered load-address defined in PE (portable executable format).*/ |
1859 | @@ -644,7 +644,7 @@ |
1860 | wdl_binlog_format_names, char*); |
1861 | |
1862 | /* It is fine if builtin_innobase_plugin is not available. */ |
1863 | - builtin_innobase_plugin_ptr = (struct drizzled_plugin_manifest*) |
1864 | + builtin_innobase_plugin_ptr = (drizzled::plugin::Manifest*) |
1865 | wdl_get_varaddr_from_map( |
1866 | hmod, |
1867 | "?builtin_innobase_plugin@@3PAUdrizzled_plugin_manifest@@A"); |
Contains Monty's build-cleanup and plugin class cleanup branches. All tests pass on Linux64, Solaris64, and MacOSX64, with only known exception of drizzledump failure on Solaris and myisamcheck failure on MacOSX.