~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.cc

  • Committer: lbieber at stabletransit
  • Date: 2010-10-19 14:03:27 UTC
  • mfrom: (1861.1.2 build)
  • Revision ID: lbieber@drizzle-build-n02.wc1.dfw1.stabletransit.com-20101019140327-2jvt5j2wi4pzhm1z
Merge Brian - Small collection of cleanups/refactor'ing around locks
Merge Monty - fix a few things in the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
  first_block_usage= 0;
62
62
}
63
63
 
64
 
memory::Root::~Root()
65
 
{
66
 
}
67
 
 
68
64
 
69
65
/**
70
66
 * @details
257
253
  return((void*) start);
258
254
}
259
255
 
260
 
static void trash_mem(memory::internal::UsedMemory *)
261
 
{
262
 
  TRASH(((char*)(x) + (x->size - x->left)), x->left);
263
 
}
 
256
#define TRASH_MEM(X) TRASH(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
264
257
 
265
258
/**
266
259
 * @brief
276
269
  for (next= free; next; next= *(last= &next->next))
277
270
  {
278
271
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
279
 
    trash_mem(next);
 
272
    TRASH_MEM(next);
280
273
  }
281
274
 
282
275
  /* Combine the free and the used list */
286
279
  for (; next; next= next->next)
287
280
  {
288
281
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
289
 
    trash_mem(next);
 
282
    TRASH_MEM(next);
290
283
  }
291
284
 
292
285
  /* Now everything is set; Indicate that nothing is used anymore */
339
332
  {
340
333
    this->free=this->pre_alloc;
341
334
    this->free->left=this->pre_alloc->size-ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
342
 
    trash_mem(this->pre_alloc);
 
335
    TRASH_MEM(this->pre_alloc);
343
336
    this->free->next=0;
344
337
  }
345
338
  this->block_num= 4;