~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/myisam/mi_open.cc

  • Committer: Monty Taylor
  • Date: 2009-09-22 22:19:58 UTC
  • mto: This revision was merged to the branch mainline in revision 1184.
  • Revision ID: mordred@inaugust.com-20090922221958-l4d9ogwfs55513eo
Moved multi_malloc into drizzled since it's not going away any time soon. Also,
cleaned it up a bit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
/* open a isam-database */
17
17
 
18
18
#include "myisamdef.h"
19
 
#include <mystrings/m_ctype.h>
20
 
#include <mystrings/m_string.h>
21
 
#include <drizzled/util/test.h>
22
19
 
23
20
#include <string.h>
24
21
#include <algorithm>
25
22
 
 
23
#include "mystrings/m_ctype.h"
 
24
#include "mystrings/m_string.h"
 
25
#include "drizzled/util/test.h"
 
26
#include "drizzled/memory/multi_malloc.h"
 
27
 
 
28
 
26
29
using namespace std;
27
30
 
28
31
static void setup_key_functions(MI_KEYDEF *keyinfo);
222
225
    /* Add space for node pointer */
223
226
    share->base.max_key_length+= share->base.key_reflength;
224
227
 
225
 
    if (!my_multi_malloc(MY_WME,
226
 
                         &share,sizeof(*share),
227
 
                         &share->state.rec_per_key_part,sizeof(long)*key_parts,
228
 
                         &share->keyinfo,keys*sizeof(MI_KEYDEF),
229
 
                         &share->uniqueinfo,uniques*sizeof(MI_UNIQUEDEF),
230
 
                         &share->keyparts,
231
 
                         (key_parts+unique_key_parts+keys+uniques) *
232
 
                         sizeof(HA_KEYSEG),
233
 
                         &share->rec,
234
 
                         (share->base.fields+1)*sizeof(MI_COLUMNDEF),
235
 
                         &share->blobs,sizeof(MI_BLOB)*share->base.blobs,
236
 
                         &share->unique_file_name,strlen(name_buff)+1,
237
 
                         &share->index_file_name,strlen(index_name)+1,
238
 
                         &share->data_file_name,strlen(data_name)+1,
239
 
                         &share->state.key_root,keys*sizeof(my_off_t),
240
 
                         &share->state.key_del,
241
 
                         (share->state.header.max_block_size_index*sizeof(my_off_t)),
242
 
                         &share->key_root_lock,sizeof(pthread_rwlock_t)*keys,
243
 
                         &share->mmap_lock,sizeof(pthread_rwlock_t),
244
 
                         NULL))
 
228
    if (!drizzled::memory::multi_malloc(false,
 
229
           &share,sizeof(*share),
 
230
           &share->state.rec_per_key_part,sizeof(long)*key_parts,
 
231
           &share->keyinfo,keys*sizeof(MI_KEYDEF),
 
232
           &share->uniqueinfo,uniques*sizeof(MI_UNIQUEDEF),
 
233
           &share->keyparts,
 
234
           (key_parts+unique_key_parts+keys+uniques) * sizeof(HA_KEYSEG),
 
235
           &share->rec, (share->base.fields+1)*sizeof(MI_COLUMNDEF),
 
236
           &share->blobs,sizeof(MI_BLOB)*share->base.blobs,
 
237
           &share->unique_file_name,strlen(name_buff)+1,
 
238
           &share->index_file_name,strlen(index_name)+1,
 
239
           &share->data_file_name,strlen(data_name)+1,
 
240
           &share->state.key_root,keys*sizeof(uint64_t),
 
241
           &share->state.key_del,
 
242
           (share->state.header.max_block_size_index*sizeof(uint64_t)),
 
243
           &share->key_root_lock,sizeof(pthread_rwlock_t)*keys,
 
244
           &share->mmap_lock,sizeof(pthread_rwlock_t),
 
245
           NULL))
245
246
      goto err;
246
247
    errpos=4;
247
248
    *share=share_buff;
425
426
  }
426
427
 
427
428
  /* alloc and set up private structure parts */
428
 
  if (!my_multi_malloc(MY_WME,
429
 
                       &m_info,sizeof(MI_INFO),
430
 
                       &info.blobs,sizeof(MI_BLOB)*share->base.blobs,
431
 
                       &info.buff,(share->base.max_key_block_length*2+
432
 
                                   share->base.max_key_length),
433
 
                       &info.lastkey,share->base.max_key_length*3+1,
434
 
                       &info.first_mbr_key, share->base.max_key_length,
435
 
                       &info.filename,strlen(name)+1,
436
 
                       &info.rtree_recursion_state,have_rtree ? 1024 : 0,
437
 
                       NULL))
 
429
  if (!drizzled::memory::multi_malloc(MY_WME,
 
430
         &m_info,sizeof(MI_INFO),
 
431
         &info.blobs,sizeof(MI_BLOB)*share->base.blobs,
 
432
         &info.buff,(share->base.max_key_block_length*2+
 
433
                     share->base.max_key_length),
 
434
         &info.lastkey,share->base.max_key_length*3+1,
 
435
         &info.first_mbr_key, share->base.max_key_length,
 
436
         &info.filename,strlen(name)+1,
 
437
         &info.rtree_recursion_state,have_rtree ? 1024 : 0,
 
438
         NULL))
438
439
    goto err;
439
440
  errpos=6;
440
441