~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/xid.cc

  • Committer: Brian Aker
  • Date: 2009-05-05 21:20:32 UTC
  • mto: This revision was merged to the branch mainline in revision 1007.
  • Revision ID: brian@gaz-20090505212032-nax5tcd0m0wku35j
Cleanup to use new/delete

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
 
127
127
void xid_free_hash(void *ptr)
128
128
{
129
 
  if (!((XID_STATE*)ptr)->in_session)
130
 
    free((unsigned char*)ptr);
 
129
  XID_STATE *state= (XID_STATE *)ptr;
 
130
  if (state->in_session == false)
 
131
    delete state;
131
132
}
132
133
 
133
134
bool xid_cache_init()
160
161
  bool res;
161
162
  pthread_mutex_lock(&LOCK_xid_cache);
162
163
  if (hash_search(&xid_cache, xid->key(), xid->key_length()))
163
 
    res=0;
164
 
  else if (!(xs=(XID_STATE *)malloc(sizeof(*xs))))
165
 
    res=1;
 
164
    res= false;
 
165
  else if ((xs = new XID_STATE) == NULL)
 
166
    res= true;
166
167
  else
167
168
  {
168
169
    xs->xa_state=xa_state;
169
170
    xs->xid.set(xid);
170
171
    xs->in_session=0;
171
 
    res=my_hash_insert(&xid_cache, (unsigned char*)xs);
 
172
    res= my_hash_insert(&xid_cache, (unsigned char*)xs);
172
173
  }
173
174
  pthread_mutex_unlock(&LOCK_xid_cache);
174
175
  return res;