~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/mem/mem0mem.c

  • Committer: Lee Bieber
  • Date: 2010-11-20 22:04:04 UTC
  • mfrom: (1942.1.4 b)
  • Revision ID: kalebral@gmail.com-20101120220404-2qpb4xuik9wv9u1q
Merge Lee -  Run bzr ignore for leftover files
Merge Shrews - Add a --replicate-query option to the server which controls whether or not the SQL query string is included in the GPB Statement messages.
Merge Andrew - fix bug 665119: drizzleslap has -i mapped to two options
Merge Andrew fix bug 674145: Table Names Not Case Matched

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1994, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved.
4
4
 
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
24
24
*************************************************************************/
25
25
 
26
26
#include "mem0mem.h"
27
 
 
28
27
#ifdef UNIV_NONINL
29
28
#include "mem0mem.ic"
30
29
#endif
31
30
 
32
31
#include "buf0buf.h"
33
32
#include "srv0srv.h"
34
 
#include "mem0dbg.cc"
 
33
#include "mem0dbg.c"
35
34
#include <stdarg.h>
36
35
 
37
36
/*
109
108
        mem_heap_t*     heap,   /*!< in: memory heap where string is allocated */
110
109
        const char*     str)    /*!< in: string to be copied */
111
110
{
112
 
        return(static_cast<char *>(mem_heap_dup(heap, str, strlen(str) + 1)));
 
111
        return(mem_heap_dup(heap, str, strlen(str) + 1));
113
112
}
114
113
 
115
114
/**********************************************************************//**
141
140
        ulint   s1_len = strlen(s1);
142
141
        ulint   s2_len = strlen(s2);
143
142
 
144
 
        s = static_cast<char *>(mem_heap_alloc(heap, s1_len + s2_len + 1));
 
143
        s = mem_heap_alloc(heap, s1_len + s2_len + 1);
145
144
 
146
145
        memcpy(s, s1, s1_len);
147
146
        memcpy(s + s1_len, s2, s2_len);
286
285
        va_end(ap);
287
286
 
288
287
        /* Now create it for real. */
289
 
        str = static_cast<char *>(mem_heap_alloc(heap, len));
 
288
        str = mem_heap_alloc(heap, len);
290
289
        va_start(ap, format);
291
290
        mem_heap_printf_low(str, format, ap);
292
291
        va_end(ap);
331
330
 
332
331
                ut_ad(type == MEM_HEAP_DYNAMIC || n <= MEM_MAX_ALLOC_IN_BUF);
333
332
 
334
 
                block = static_cast<mem_block_info_t *>(mem_area_alloc(&len, mem_comm_pool));
 
333
                block = mem_area_alloc(&len, mem_comm_pool);
335
334
        } else {
336
335
                len = UNIV_PAGE_SIZE;
337
336
 
340
339
                        buffer pool, but must get the free block from
341
340
                        the heap header free block field */
342
341
 
343
 
                        buf_block = static_cast<buf_block_t *>(heap->free_block);
 
342
                        buf_block = heap->free_block;
344
343
                        heap->free_block = NULL;
345
344
 
346
345
                        if (UNIV_UNLIKELY(!buf_block)) {
348
347
                                return(NULL);
349
348
                        }
350
349
                } else {
351
 
                        buf_block = buf_block_alloc(NULL, 0);
 
350
                        buf_block = buf_block_alloc(0);
352
351
                }
353
352
 
354
353
                block = (mem_block_t*) buf_block->frame;
368
367
        block->line = line;
369
368
 
370
369
#ifdef MEM_PERIODIC_CHECK
371
 
        mutex_enter(&(mem_comm_pool->mutex));
 
370
        mem_pool_mutex_enter();
372
371
 
373
372
        if (!mem_block_list_inited) {
374
373
                mem_block_list_inited = TRUE;
377
376
 
378
377
        UT_LIST_ADD_LAST(mem_block_list, mem_block_list, block);
379
378
 
380
 
        mutex_exit(&(mem_comm_pool->mutex));
 
379
        mem_pool_mutex_exit();
381
380
#endif
382
381
        mem_block_set_len(block, len);
383
382
        mem_block_set_type(block, type);
470
469
        ulint           type;
471
470
        ulint           len;
472
471
#ifndef UNIV_HOTBACKUP
473
 
        buf_block_t*    buf_block       = static_cast<buf_block_t *>(block->buf_block);
 
472
        buf_block_t*    buf_block       = block->buf_block;
474
473
#endif /* !UNIV_HOTBACKUP */
475
474
 
476
475
        if (block->magic_n != MEM_BLOCK_MAGIC_N) {
480
479
        UT_LIST_REMOVE(list, heap->base, block);
481
480
 
482
481
#ifdef MEM_PERIODIC_CHECK
483
 
        mutex_enter(&(mem_comm_pool->mutex));
 
482
        mem_pool_mutex_enter();
484
483
 
485
484
        UT_LIST_REMOVE(mem_block_list, mem_block_list, block);
486
485
 
487
 
        mutex_exit(&(mem_comm_pool->mutex));
 
486
        mem_pool_mutex_exit();
488
487
#endif
489
488
 
490
489
        ut_ad(heap->total_size >= block->len);
537
536
{
538
537
        if (UNIV_LIKELY_NULL(heap->free_block)) {
539
538
 
540
 
                buf_block_free(static_cast<buf_block_t *>(heap->free_block));
 
539
                buf_block_free(heap->free_block);
541
540
 
542
541
                heap->free_block = NULL;
543
542
        }
555
554
{
556
555
        mem_block_t*    block;
557
556
 
558
 
        mutex_enter(&(mem_comm_pool->mutex));
 
557
        mem_pool_mutex_enter();
559
558
 
560
559
        block = UT_LIST_GET_FIRST(mem_block_list);
561
560
 
567
566
                block = UT_LIST_GET_NEXT(mem_block_list, block);
568
567
        }
569
568
 
570
 
        mutex_exit(&(mem_comm_pool->mutex));
 
569
        mem_pool_mutex_exit();
571
570
}
572
571
#endif