~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/heap/hp_open.cc

Merged padraig's removal of list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include <string.h>
21
21
 
 
22
using namespace std;
 
23
 
22
24
/*
23
25
  Open heap table based on HP_SHARE structure
24
26
 
58
60
  pthread_mutex_lock(&THR_LOCK_heap);
59
61
  if ((info= heap_open_from_share(share, mode)))
60
62
  {
61
 
    info->open_list.data= (void*) info;
62
 
    heap_open_list= list_add(heap_open_list,&info->open_list);
 
63
    heap_open_list.push_front(info);
63
64
  }
64
65
  pthread_mutex_unlock(&THR_LOCK_heap);
65
66
  return(info);
88
89
  }
89
90
  if ((info= heap_open_from_share(share, mode)))
90
91
  {
91
 
    info->open_list.data= (void*) info;
92
 
    heap_open_list= list_add(heap_open_list,&info->open_list);
 
92
    heap_open_list.push_front(info);
93
93
  }
94
94
  pthread_mutex_unlock(&THR_LOCK_heap);
95
95
  return(info);
100
100
 
101
101
HP_SHARE *hp_find_named_heap(const char *name)
102
102
{
103
 
  LIST *pos;
104
 
  HP_SHARE *info;
105
 
 
106
 
  for (pos= heap_share_list; pos; pos= pos->next)
 
103
  list<HP_SHARE *>::iterator it= heap_share_list.begin();
 
104
  while (it != heap_share_list.end())
107
105
  {
108
 
    info= (HP_SHARE*) pos->data;
109
 
    if (!strcmp(name, info->name))
 
106
    if (!strcmp(name, (*it)->name))
110
107
    {
111
 
      return(info);
 
108
      return (*it);
112
109
    }
 
110
    ++it;
113
111
  }
114
112
  return((HP_SHARE *) 0);
115
113
}