Merge lp:~mordred/drizzle/bug667006 into lp:drizzle/7.0

Proposed by Monty Taylor
Status: Merged
Approved by: Brian Aker
Approved revision: 1908
Merged at revision: 1919
Proposed branch: lp:~mordred/drizzle/bug667006
Merge into: lp:drizzle/7.0
Diff against target: 93 lines (+30/-20)
2 files modified
drizzled/module/loader.cc (+29/-19)
plugin/utility_dictionary/tests/t/master.opt (+1/-1)
To merge this branch: bzr merge lp:~mordred/drizzle/bug667006
Reviewer Review Type Date Requested Status
Drizzle Developers Pending
Review via email: mp+40372@code.launchpad.net

Description of the change

Makes the plugin-add option a little less brittle.

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
=== modified file 'drizzled/module/loader.cc'
--- drizzled/module/loader.cc 2010-10-28 16:52:12 +0000
+++ drizzled/module/loader.cc 2010-11-08 19:52:48 +0000
@@ -355,6 +355,26 @@
355 return false;355 return false;
356}356}
357357
358
359inline static void dashes_to_underscores(std::string &name_in,
360 char from= '-', char to= '_')
361{
362 for (string::iterator p= name_in.begin();
363 p != name_in.end();
364 ++p)
365 {
366 if (*p == from)
367 {
368 *p= to;
369 }
370 }
371}
372
373inline static void underscores_to_dashes(std::string &name_in)
374{
375 return dashes_to_underscores(name_in, '_', '-');
376}
377
358static void compose_plugin_options(vector<string> &target,378static void compose_plugin_options(vector<string> &target,
359 vector<string> options)379 vector<string> options)
360{380{
@@ -364,6 +384,12 @@
364 {384 {
365 tokenize(*it, target, ",", true);385 tokenize(*it, target, ",", true);
366 }386 }
387 for (vector<string>::iterator it= target.begin();
388 it != target.end();
389 ++it)
390 {
391 dashes_to_underscores(*it);
392 }
367}393}
368394
369void compose_plugin_add(vector<string> options)395void compose_plugin_add(vector<string> options)
@@ -825,13 +851,7 @@
825 varname.push_back('_');851 varname.push_back('_');
826 varname.append(name);852 varname.append(name);
827853
828 for (string::iterator p= varname.begin() + 1; p != varname.end(); ++p)854 dashes_to_underscores(varname);
829 {
830 if (*p == '-')
831 {
832 *p= '_';
833 }
834 }
835 return varname;855 return varname;
836}856}
837857
@@ -1422,11 +1442,7 @@
1422 string name(plugin_name);1442 string name(plugin_name);
1423 transform(name.begin(), name.end(), name.begin(), ::tolower);1443 transform(name.begin(), name.end(), name.begin(), ::tolower);
14241444
1425 for (string::iterator iter= name.begin(); iter != name.end(); ++iter)1445 underscores_to_dashes(name);
1426 {
1427 if (*iter == '_')
1428 *iter= '-';
1429 }
14301446
1431 /*1447 /*
1432 Two passes as the 2nd pass will take pointer addresses for use1448 Two passes as the 2nd pass will take pointer addresses for use
@@ -1691,13 +1707,7 @@
1691 vname.push_back('-');1707 vname.push_back('-');
1692 vname.append(o->name);1708 vname.append(o->name);
1693 transform(vname.begin(), vname.end(), vname.begin(), ::tolower);1709 transform(vname.begin(), vname.end(), vname.begin(), ::tolower);
1694 string::iterator p= vname.begin(); 1710 dashes_to_underscores(vname);
1695 while (p != vname.end())
1696 {
1697 if (*p == '-')
1698 *p= '_';
1699 ++p;
1700 }
17011711
1702 v= new sys_var_pluginvar(vname, o);1712 v= new sys_var_pluginvar(vname, o);
1703 }1713 }
17041714
=== modified file 'plugin/utility_dictionary/tests/t/master.opt'
--- plugin/utility_dictionary/tests/t/master.opt 2010-09-30 03:36:05 +0000
+++ plugin/utility_dictionary/tests/t/master.opt 2010-11-08 19:52:48 +0000
@@ -1,1 +1,1 @@
1--plugin-add=utility_dictionary1--plugin-add=utility-dictionary

Subscribers

People subscribed via source and target branches