~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbxt/src/ccutils_xt.cc

  • Committer: Jay Pipes
  • Date: 2010-03-09 20:02:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1339.
  • Revision ID: jpipes@serialcoder-20100309200229-dfrliy4fads9vyf4
Fixes Bug #535296 by only incrementing ha_commit_count when its a normal transaction commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2005 PrimeBase Technologies GmbH
2
 
 *
3
 
 * PrimeBase XT
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
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.
14
 
 *
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
18
 
 *
19
 
 * 2006-05-16   Paul McCullagh
20
 
 *
21
 
 * H&G2JCtL
22
 
 *
23
 
 * C++ Utilities
24
 
 */
25
 
 
26
 
#include "xt_config.h"
27
 
 
28
 
#include "pthread_xt.h"
29
 
#include "ccutils_xt.h"
30
 
#include "bsearch_xt.h"
31
 
 
32
 
static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
33
 
{
34
 
        XTObject *obj_ptr = (XTObject *) b;
35
 
 
36
 
        return obj_ptr->compare(a);
37
 
}
38
 
 
39
 
void XTListImp::append(XTThreadPtr self, XTObject *info, void *key) {
40
 
        size_t idx;
41
 
 
42
 
        if (li_item_count == 0)
43
 
                idx = 0;
44
 
        else if (li_item_count == 1) {
45
 
                int r;
46
 
 
47
 
                if ((r = li_items[0]->compare(key)) == 0)
48
 
                        idx = 0;
49
 
                else if (r < 0)
50
 
                        idx = 0;
51
 
                else
52
 
                        idx = 1;
53
 
        }
54
 
        else {
55
 
                xt_bsearch(self, key, li_items, li_item_count, sizeof(void *), &idx, NULL, ccu_compare_object);
56
 
        }
57
 
 
58
 
        if (!xt_realloc(NULL, (void **) &li_items, (li_item_count + 1) * sizeof(void *))) {
59
 
                if (li_referenced)
60
 
                        info->release(self);
61
 
                xt_throw_errno(XT_CONTEXT, XT_ENOMEM);
62
 
                return;
63
 
        }
64
 
        memmove(&li_items[idx+1], &li_items[idx], (li_item_count-idx) * sizeof(void *));
65
 
        li_items[idx] = info;
66
 
        li_item_count++;
67
 
}
68
 
 
69