~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/memory/root.cc

Merge refactored command line using for innodb

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
/**
17
17
 * @file
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
 
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;