~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/loader.cc

Merged meta-info branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
382
382
 
383
383
  Finally we initialize everything, aka the dynamic that have yet to initialize.
384
384
*/
385
 
int plugin_init(plugin::Registry &registry, int *argc, char **argv, int flags)
 
385
bool plugin_init(plugin::Registry &registry,
 
386
                 int *argc, char **argv,
 
387
                 bool skip_init)
386
388
{
387
389
  plugin::Manifest **builtins;
388
390
  plugin::Manifest *manifest;
390
392
  MEM_ROOT tmp_root;
391
393
 
392
394
  if (initialized)
393
 
    return(0);
 
395
    return false;
394
396
 
395
397
  init_alloc_root(&plugin_mem_root, 4096, 4096);
396
398
  init_alloc_root(&tmp_root, 4096, 4096);
399
401
                  get_bookmark_hash_key, NULL, HASH_UNIQUE))
400
402
  {
401
403
    free_root(&tmp_root, MYF(0));
402
 
    return(1);
 
404
    return true;
403
405
  }
404
406
 
405
407
 
424
426
 
425
427
      plugin_initialize_vars(module);
426
428
 
427
 
      if (! (flags & PLUGIN_INIT_SKIP_INITIALIZATION))
 
429
      if (! skip_init)
428
430
      {
429
431
        if (plugin_initialize(registry, module))
430
432
        {
431
433
          free_root(&tmp_root, MYF(0));
432
 
          return(1);
 
434
          return true;
433
435
        }
434
436
      }
435
437
    }
436
438
  }
437
439
 
438
440
 
 
441
  bool load_failed= false;
439
442
  /* Register all dynamic plugins */
440
 
  if (! (flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING))
441
 
  {
442
 
    if (opt_plugin_load)
443
 
    {
444
 
      plugin_load_list(registry, &tmp_root, argc, argv, opt_plugin_load);
445
 
    }
446
 
    else
447
 
    {
448
 
      string tmp_plugin_list(opt_plugin_load_default);
449
 
      if (opt_plugin_add)
450
 
      {
451
 
        tmp_plugin_list.push_back(',');
452
 
        tmp_plugin_list.append(opt_plugin_add);
453
 
      }
454
 
      plugin_load_list(registry, &tmp_root, argc, argv, tmp_plugin_list);
455
 
    }
 
443
  if (opt_plugin_load)
 
444
  {
 
445
    load_failed= plugin_load_list(registry, &tmp_root, argc, argv,
 
446
                                  opt_plugin_load);
 
447
  }
 
448
  else
 
449
  {
 
450
    string tmp_plugin_list(opt_plugin_load_default);
 
451
    if (opt_plugin_add)
 
452
    {
 
453
      tmp_plugin_list.push_back(',');
 
454
      tmp_plugin_list.append(opt_plugin_add);
 
455
    }
 
456
    load_failed= plugin_load_list(registry, &tmp_root, argc, argv,
 
457
                                  tmp_plugin_list);
 
458
  }
 
459
  if (load_failed)
 
460
  {
 
461
    free_root(&tmp_root, MYF(0));
 
462
    return true;
456
463
  }
457
464
 
458
 
  if (flags & PLUGIN_INIT_SKIP_INITIALIZATION)
 
465
  if (skip_init)
459
466
  {
460
467
    free_root(&tmp_root, MYF(0));
461
 
    return(0);
 
468
    return false;
462
469
  }
463
470
 
464
471
  /*
483
490
 
484
491
  free_root(&tmp_root, MYF(0));
485
492
 
486
 
  return(0);
 
493
  return false;
487
494
}
488
495
 
489
496