2086
2085
for (opt= p->getManifest().system_vars; opt && *opt; opt++, count+= 2) {};
2088
if (!(opts= (my_option*) alloc_root(mem_root, sizeof(my_option) * count)))
2087
opts= (my_option*)alloc_root(mem_root, (sizeof(my_option) * count));
2091
2091
memset(opts, 0, sizeof(my_option) * count);
2227
2227
Help Verbose text with Plugin System Variables
2228
2228
****************************************************************************/
2230
static int option_cmp(my_option *a, my_option *b)
2232
return my_strcasecmp(&my_charset_utf8_general_ci, a->name, b->name);
2236
void my_print_help_inc_plugins(my_option *main_options, uint32_t size)
2238
DYNAMIC_ARRAY all_options;
2233
bool operator() (const my_option &a, const my_option &b)
2235
return my_strcasecmp(&my_charset_utf8_general_ci, a.name, b.name);
2240
void my_print_help_inc_plugins(my_option *main_options)
2242
vector<my_option> all_options;
2240
2244
MEM_ROOT mem_root;
2245
my_option *opt= NULL;
2243
2247
init_alloc_root(&mem_root, 4096, 4096);
2244
my_init_dynamic_array(&all_options, sizeof(my_option), size, size/4);
2246
2249
if (initialized)
2247
2250
for (uint32_t idx= 0; idx < plugin_array.elements; idx++)
2249
2252
p= *dynamic_element(&plugin_array, idx, Handle **);
2251
if (!p->getManifest().system_vars ||
2252
!(opt= construct_help_options(&mem_root, p)))
2254
if (p->getManifest().system_vars == NULL)
2257
opt= construct_help_options(&mem_root, p);
2255
2261
/* Only options with a non-NULL comment are displayed in help text */
2256
2262
for (;opt->id; opt++)
2257
2264
if (opt->comment)
2258
insert_dynamic(&all_options, (unsigned char*) opt);
2266
all_options.push_back(*opt);
2261
2272
for (;main_options->id; main_options++)
2262
insert_dynamic(&all_options, (unsigned char*) main_options);
2274
if (main_options->comment)
2276
all_options.push_back(*main_options);
2264
sort_dynamic(&all_options, (qsort_cmp) option_cmp);
2281
* @TODO: Fix the my_option building so that it doens't break sort
2283
* sort(all_options.begin(), all_options.end(), OptionCmp());
2266
2286
/* main_options now points to the empty option terminator */
2267
insert_dynamic(&all_options, (unsigned char*) main_options);
2269
my_print_help((my_option*) all_options.buffer);
2270
my_print_variables((my_option*) all_options.buffer);
2272
delete_dynamic(&all_options);
2287
all_options.push_back(*main_options);
2289
my_print_help(&*(all_options.begin()));
2290
my_print_variables(&*(all_options.begin()));
2273
2292
free_root(&mem_root, MYF(0));