~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.cc

  • Committer: Brian Aker
  • Date: 2011-02-22 06:12:02 UTC
  • mfrom: (2190.1.6 drizzle-build)
  • Revision ID: brian@tangent.org-20110222061202-k03czxykqy4x9hjs
List update, header fixes, multiple symbols, and David deletes some code.

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