~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.cc

  • Committer: Brian Aker
  • Date: 2011-02-12 08:10:17 UTC
  • mto: This revision was merged to the branch mainline in revision 2161.
  • Revision ID: brian@tangent.org-20110212081017-7793i41ybt7gp5ty
More removal of session from includes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 * Routines to handle mallocing of results which will be freed the same time 
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
 
23
 
#include <drizzled/definitions.h>
24
 
#include <drizzled/memory/root.h>
25
 
#include <drizzled/internal/my_sys.h>
26
 
#include <drizzled/internal/m_string.h>
 
23
#include "drizzled/internal/my_sys.h"
 
24
#include "drizzled/internal/m_string.h"
27
25
 
28
26
#include <algorithm>
29
27
 
259
257
  return((void*) start);
260
258
}
261
259
 
 
260
static void trash_mem(memory::internal::UsedMemory *)
 
261
{
 
262
  TRASH(((char*)(x) + (x->size - x->left)), x->left);
 
263
}
 
264
 
262
265
/**
263
266
 * @brief
264
267
 * Mark all data in blocks free for reusage 
273
276
  for (next= free; next; next= *(last= &next->next))
274
277
  {
275
278
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
 
279
    trash_mem(next);
276
280
  }
277
281
 
278
282
  /* Combine the free and the used list */
282
286
  for (; next; next= next->next)
283
287
  {
284
288
    next->left= next->size - ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
 
289
    trash_mem(next);
285
290
  }
286
291
 
287
292
  /* Now everything is set; Indicate that nothing is used anymore */
334
339
  {
335
340
    this->free=this->pre_alloc;
336
341
    this->free->left=this->pre_alloc->size-ALIGN_SIZE(sizeof(memory::internal::UsedMemory));
 
342
    trash_mem(this->pre_alloc);
337
343
    this->free->next=0;
338
344
  }
339
345
  this->block_num= 4;