~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Brian Aker
  • Date: 2010-10-19 19:07:02 UTC
  • mto: (1864.2.1 merge)
  • mto: This revision was merged to the branch mainline in revision 1864.
  • Revision ID: brian@tangent.org-20101019190702-9iu980f1w3qu5r8c
Remove memcpy (though really this is just a shell, since it is still a
vector behind the scenes).

Show diffs side-by-side

added added

removed removed

Lines of Context:
849
849
 
850
850
  @param  session     Thread context
851
851
  @param  find    Table to remove
 
852
 
 
853
  @note because we risk the chance of deleting the share, we can't assume that it will exist past, this should be modified once we can use a TableSharePtr here.
852
854
*/
853
855
 
854
856
void Session::unlink_open_table(Table *find)
855
857
{
856
 
  char key[MAX_DBKEY_LENGTH];
857
 
  uint32_t key_length= find->getShare()->getCacheKeySize();
858
 
  Table *list, **prev;
 
858
  const TableIdentifier::Key find_key(find->getShare()->getCacheKey());
 
859
  Table **prev;
859
860
  safe_mutex_assert_owner(LOCK_open.native_handle());
860
861
 
861
 
  memcpy(key, &find->getShare()->getCacheKey()[0], key_length);
862
862
  /*
863
863
    Note that we need to hold LOCK_open while changing the
864
864
    open_tables list. Another thread may work on it.
868
868
  */
869
869
  for (prev= &open_tables; *prev; )
870
870
  {
871
 
    list= *prev;
 
871
    Table *list= *prev;
872
872
 
873
 
    if (list->getShare()->getCacheKeySize() == key_length &&
874
 
        not memcmp(&list->getShare()->getCacheKey()[0], key, key_length))
 
873
    if (list->getShare()->getCacheKey() == find_key)
875
874
    {
876
875
      /* Remove table from open_tables list. */
877
876
      *prev= list->getNext();