~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.cc

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

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