1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef DRIZZLED_QUERY_ARENA_H
22
#define DRIZZLED_QUERY_ARENA_H
24
#include <drizzled/global.h>
25
#include <mysys/my_alloc.h>
33
List of items created in the parser for this query. Every item puts
34
itself to the list on creation (see Item::Item() for details))
37
MEM_ROOT *mem_root; // Pointer to current memroot
39
Query_arena(MEM_ROOT *mem_root_arg) :
40
free_list(0), mem_root(mem_root_arg)
43
This constructor is used only when Query_arena is created as
44
backup storage for another instance of Query_arena.
48
virtual ~Query_arena() {};
50
inline void* alloc(size_t size) { return alloc_root(mem_root,size); }
51
inline void* calloc(size_t size)
54
if ((ptr=alloc_root(mem_root,size)))
58
inline char *strdup(const char *str)
59
{ return strdup_root(mem_root,str); }
60
inline char *strmake(const char *str, size_t size)
61
{ return strmake_root(mem_root,str,size); }
62
inline void *memdup(const void *str, size_t size)
63
{ return memdup_root(mem_root,str,size); }
64
inline void *memdup_w_gap(const void *str, size_t size, uint32_t gap)
67
if ((ptr= alloc_root(mem_root,size+gap)))
76
#endif /* DRIZZLED_QUERY_ARENA_H */