~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/ut/ut0vec.c

  • Committer: Andrew Hutchings
  • Date: 2010-11-14 14:46:36 UTC
  • mto: (1931.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1932.
  • Revision ID: andrew@linuxjedi.co.uk-20101114144636-bkttapbfpp20ccd2
Fix broken Global Status test
Fix some stats not reset
Cleanup code a little

Note: local session stats are not reset, they will be added to the global stats after flush if any query is executed on those sessions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 2006, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 2006, 2009, 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
39
39
        mem_heap_t*     heap,   /*!< in: heap */
40
40
        ulint           size)   /*!< in: initial size */
41
41
{
 
42
        ib_vector_t*    vec;
 
43
 
42
44
        ut_a(size > 0);
43
45
 
44
 
        ib_vector_t *vec = static_cast<ib_vector_t*>(mem_heap_alloc(heap, sizeof(*vec)));
 
46
        vec = mem_heap_alloc(heap, sizeof(*vec));
45
47
 
46
48
        vec->heap = heap;
47
 
        vec->data = static_cast<void **>(mem_heap_alloc(heap, sizeof(void*) * size));
 
49
        vec->data = mem_heap_alloc(heap, sizeof(void*) * size);
48
50
        vec->used = 0;
49
51
        vec->total = size;
50
52
 
64
66
                void**  new_data;
65
67
                ulint   new_total = vec->total * 2;
66
68
 
67
 
                new_data = static_cast<void **>(mem_heap_alloc(vec->heap,
68
 
                                        sizeof(void*) * new_total));
 
69
                new_data = mem_heap_alloc(vec->heap,
 
70
                                          sizeof(void*) * new_total);
69
71
                memcpy(new_data, vec->data, sizeof(void*) * vec->total);
70
72
 
71
 
                vec->data = static_cast<void **>(new_data);
 
73
                vec->data = new_data;
72
74
                vec->total = new_total;
73
75
        }
74
76