diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-06-15 14:54:23 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-06-15 14:54:23 +0200 |
commit | 37f5632212fd5cf6aafa272d33ca34da2320d570 (patch) | |
tree | 792f1e903f969bf293cc2ba8a272df705cf05dc0 /storage/xtradb/include/data0data.h | |
parent | 13982b5a118ab9060d786da646af94d81638bc3b (diff) | |
parent | 6de579241ed0bf01dfad1a7cede9fde36a1c5c03 (diff) | |
download | mariadb-git-37f5632212fd5cf6aafa272d33ca34da2320d570.tar.gz |
merged with XtraDB 1.1.8-26.0
Diffstat (limited to 'storage/xtradb/include/data0data.h')
-rw-r--r-- | storage/xtradb/include/data0data.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/storage/xtradb/include/data0data.h b/storage/xtradb/include/data0data.h index f7bdd29ed90..6d3c2988fdc 100644 --- a/storage/xtradb/include/data0data.h +++ b/storage/xtradb/include/data0data.h @@ -231,6 +231,26 @@ dtuple_set_n_fields_cmp( dtuple_t* tuple, /*!< in: tuple */ ulint n_fields_cmp); /*!< in: number of fields used in comparisons in rem0cmp.* */ + +/* Estimate the number of bytes that are going to be allocated when +creating a new dtuple_t object */ +#define DTUPLE_EST_ALLOC(n_fields) \ + (sizeof(dtuple_t) + (n_fields) * sizeof(dfield_t)) + +/**********************************************************//** +Creates a data tuple from an already allocated chunk of memory. +The size of the chunk must be at least DTUPLE_EST_ALLOC(n_fields). +The default value for number of fields used in record comparisons +for this tuple is n_fields. +@return created tuple (inside buf) */ +UNIV_INLINE +dtuple_t* +dtuple_create_from_mem( +/*===================*/ + void* buf, /*!< in, out: buffer to use */ + ulint buf_size, /*!< in: buffer size */ + ulint n_fields); /*!< in: number of fields */ + /**********************************************************//** Creates a data tuple to a memory heap. The default value for number of fields used in record comparisons for this tuple is n_fields. @@ -240,7 +260,8 @@ dtuple_t* dtuple_create( /*==========*/ mem_heap_t* heap, /*!< in: memory heap where the tuple - is created */ + is created, DTUPLE_EST_ALLOC(n_fields) + bytes will be allocated from this heap */ ulint n_fields); /*!< in: number of fields */ /**********************************************************//** |