~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_plugin.cc

  • Committer: Brian Aker
  • Date: 2008-12-16 00:40:59 UTC
  • Revision ID: brian@tangent.org-20081216004059-12yccqqlsjkvsugo
Remove vector from lex for plugins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
521
521
}
522
522
 
523
523
 
524
 
static plugin_ref intern_plugin_lock(LEX *lex, plugin_ref rc)
 
524
static plugin_ref intern_plugin_lock(LEX *, plugin_ref rc)
525
525
{
526
526
  st_plugin_int *pi= plugin_ref_to_int(rc);
527
527
 
539
539
    *plugin= pi;
540
540
    pi->ref_count++;
541
541
 
542
 
    if (lex)
543
 
      insert_dynamic(&lex->plugins, (unsigned char*)&plugin);
544
542
    return(plugin);
545
543
  }
546
544
  return(NULL);
755
753
 
756
754
}
757
755
 
758
 
static void intern_plugin_unlock(LEX *lex, plugin_ref plugin)
 
756
static void intern_plugin_unlock(LEX *, plugin_ref plugin)
759
757
{
760
 
  int i;
761
758
  st_plugin_int *pi;
762
759
 
763
760
  if (!plugin)
767
764
 
768
765
  free((void *) plugin);
769
766
 
770
 
  if (lex)
771
 
  {
772
 
    /*
773
 
      Remove one instance of this plugin from the use list.
774
 
      We are searching backwards so that plugins locked last
775
 
      could be unlocked faster - optimizing for LIFO semantics.
776
 
    */
777
 
    for (i= lex->plugins.elements - 1; i >= 0; i--)
778
 
      if (plugin == *dynamic_element(&lex->plugins, i, plugin_ref*))
779
 
      {
780
 
        delete_dynamic_element(&lex->plugins, i);
781
 
        break;
782
 
      }
783
 
    assert(i >= 0);
784
 
  }
785
 
 
786
767
  assert(pi->ref_count);
787
768
  pi->ref_count--;
788
769
 
2014
1995
 
2015
1996
void plugin_sessionvar_cleanup(Session *session)
2016
1997
{
2017
 
  uint32_t idx;
2018
 
  plugin_ref *list;
2019
 
 
2020
1998
  unlock_variables(session, &session->variables);
2021
1999
  cleanup_variables(session, &session->variables);
2022
 
 
2023
 
  if ((idx= session->lex->plugins.elements))
2024
 
  {
2025
 
    list= ((plugin_ref*) session->lex->plugins.buffer) + idx - 1;
2026
 
    while ((unsigned char*) list >= session->lex->plugins.buffer)
2027
 
      intern_plugin_unlock(NULL, *list--);
2028
 
  }
2029
 
 
2030
 
  reset_dynamic(&session->lex->plugins);
2031
 
 
2032
 
  return;
2033
2000
}
2034
2001
 
2035
2002