Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 1 | /* cache .c - a LRU cache |
| 2 | * |
Florent Xicluna | c934f32 | 2010-09-03 23:47:32 +0000 | [diff] [blame] | 3 | * Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de> |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 4 | * |
| 5 | * This file is part of pysqlite. |
| 6 | * |
| 7 | * This software is provided 'as-is', without any express or implied |
| 8 | * warranty. In no event will the authors be held liable for any damages |
| 9 | * arising from the use of this software. |
| 10 | * |
| 11 | * Permission is granted to anyone to use this software for any purpose, |
| 12 | * including commercial applications, and to alter it and redistribute it |
| 13 | * freely, subject to the following restrictions: |
| 14 | * |
| 15 | * 1. The origin of this software must not be misrepresented; you must not |
| 16 | * claim that you wrote the original software. If you use this software |
| 17 | * in a product, an acknowledgment in the product documentation would be |
| 18 | * appreciated but is not required. |
| 19 | * 2. Altered source versions must be plainly marked as such, and must not be |
| 20 | * misrepresented as being the original software. |
| 21 | * 3. This notice may not be removed or altered from any source distribution. |
| 22 | */ |
| 23 | |
| 24 | #include "cache.h" |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 25 | #include <limits.h> |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 26 | |
| 27 | /* only used internally */ |
Erlend Egeberg Aasland | bf838a6 | 2021-02-21 01:29:19 +0100 | [diff] [blame] | 28 | static pysqlite_Node * |
| 29 | pysqlite_new_node(PyObject *key, PyObject *data) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 30 | { |
Thomas Wouters | fc7bb8c | 2007-01-15 15:49:28 +0000 | [diff] [blame] | 31 | pysqlite_Node* node; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 32 | |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 33 | node = (pysqlite_Node*) (pysqlite_NodeType->tp_alloc(pysqlite_NodeType, 0)); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 34 | if (!node) { |
| 35 | return NULL; |
| 36 | } |
| 37 | |
Erlend Egeberg Aasland | bf64d90 | 2020-12-27 12:05:33 +0100 | [diff] [blame] | 38 | node->key = Py_NewRef(key); |
| 39 | node->data = Py_NewRef(data); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 40 | |
| 41 | node->prev = NULL; |
| 42 | node->next = NULL; |
| 43 | |
| 44 | return node; |
| 45 | } |
| 46 | |
Miss Islington (bot) | e8d9df0 | 2021-05-25 11:08:39 -0700 | [diff] [blame^] | 47 | static int |
| 48 | node_traverse(pysqlite_Node *self, visitproc visit, void *arg) |
| 49 | { |
| 50 | Py_VISIT(self->key); |
| 51 | Py_VISIT(self->data); |
| 52 | Py_VISIT(Py_TYPE(self)); |
| 53 | return 0; |
| 54 | } |
| 55 | |
| 56 | static int |
| 57 | node_clear(pysqlite_Node *self) |
| 58 | { |
| 59 | Py_CLEAR(self->key); |
| 60 | Py_CLEAR(self->data); |
| 61 | return 0; |
| 62 | } |
| 63 | |
Erlend Egeberg Aasland | bf838a6 | 2021-02-21 01:29:19 +0100 | [diff] [blame] | 64 | static void |
| 65 | pysqlite_node_dealloc(pysqlite_Node *self) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 66 | { |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 67 | PyTypeObject *tp = Py_TYPE(self); |
Miss Islington (bot) | e8d9df0 | 2021-05-25 11:08:39 -0700 | [diff] [blame^] | 68 | PyObject_GC_UnTrack(self); |
| 69 | tp->tp_clear((PyObject *)self); |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 70 | tp->tp_free(self); |
| 71 | Py_DECREF(tp); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 72 | } |
| 73 | |
Erlend Egeberg Aasland | bf838a6 | 2021-02-21 01:29:19 +0100 | [diff] [blame] | 74 | static int |
| 75 | pysqlite_cache_init(pysqlite_Cache *self, PyObject *args, PyObject *kwargs) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 76 | { |
| 77 | PyObject* factory; |
| 78 | int size = 10; |
| 79 | |
| 80 | self->factory = NULL; |
| 81 | |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 82 | if (!PyArg_ParseTuple(args, "O|i", &factory, &size)) { |
| 83 | return -1; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 84 | } |
| 85 | |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 86 | /* minimum cache size is 5 entries */ |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 87 | if (size < 5) { |
| 88 | size = 5; |
| 89 | } |
| 90 | self->size = size; |
| 91 | self->first = NULL; |
| 92 | self->last = NULL; |
| 93 | |
| 94 | self->mapping = PyDict_New(); |
| 95 | if (!self->mapping) { |
| 96 | return -1; |
| 97 | } |
| 98 | |
Erlend Egeberg Aasland | bf64d90 | 2020-12-27 12:05:33 +0100 | [diff] [blame] | 99 | self->factory = Py_NewRef(factory); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 100 | |
| 101 | self->decref_factory = 1; |
| 102 | |
| 103 | return 0; |
| 104 | } |
| 105 | |
Miss Islington (bot) | e8d9df0 | 2021-05-25 11:08:39 -0700 | [diff] [blame^] | 106 | static int |
| 107 | cache_traverse(pysqlite_Cache *self, visitproc visit, void *arg) |
| 108 | { |
| 109 | pysqlite_Node *node = self->first; |
| 110 | while (node) { |
| 111 | Py_VISIT(node); |
| 112 | node = node->next; |
| 113 | } |
| 114 | Py_VISIT(self->mapping); |
| 115 | if (self->decref_factory) { |
| 116 | Py_VISIT(self->factory); |
| 117 | } |
| 118 | Py_VISIT(Py_TYPE(self)); |
| 119 | return 0; |
| 120 | } |
| 121 | |
| 122 | static int |
| 123 | cache_clear(pysqlite_Cache *self) |
| 124 | { |
| 125 | /* iterate over all nodes and deallocate them */ |
| 126 | pysqlite_Node *node = self->first; |
| 127 | self->first = NULL; |
| 128 | while (node) { |
| 129 | pysqlite_Node *delete_node = node; |
| 130 | node = node->next; |
| 131 | Py_CLEAR(delete_node); |
| 132 | } |
| 133 | if (self->decref_factory) { |
| 134 | Py_CLEAR(self->factory); |
| 135 | } |
| 136 | Py_CLEAR(self->mapping); |
| 137 | return 0; |
| 138 | } |
| 139 | |
Erlend Egeberg Aasland | bf838a6 | 2021-02-21 01:29:19 +0100 | [diff] [blame] | 140 | static void |
| 141 | pysqlite_cache_dealloc(pysqlite_Cache *self) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 142 | { |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 143 | if (!self->factory) { |
| 144 | /* constructor failed, just get out of here */ |
| 145 | return; |
| 146 | } |
| 147 | |
Miss Islington (bot) | e8d9df0 | 2021-05-25 11:08:39 -0700 | [diff] [blame^] | 148 | PyObject_GC_UnTrack(self); |
| 149 | PyTypeObject *tp = Py_TYPE(self); |
| 150 | tp->tp_clear((PyObject *)self); |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 151 | tp->tp_free(self); |
| 152 | Py_DECREF(tp); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 153 | } |
| 154 | |
Jeroen Demeyer | 196a530 | 2019-07-04 12:31:34 +0200 | [diff] [blame] | 155 | PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 156 | { |
Thomas Wouters | fc7bb8c | 2007-01-15 15:49:28 +0000 | [diff] [blame] | 157 | pysqlite_Node* node; |
| 158 | pysqlite_Node* ptr; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 159 | PyObject* data; |
| 160 | |
Serhiy Storchaka | fc662ac | 2018-12-10 16:06:08 +0200 | [diff] [blame] | 161 | node = (pysqlite_Node*)PyDict_GetItemWithError(self->mapping, key); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 162 | if (node) { |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 163 | /* an entry for this key already exists in the cache */ |
| 164 | |
| 165 | /* increase usage counter of the node found */ |
| 166 | if (node->count < LONG_MAX) { |
| 167 | node->count++; |
| 168 | } |
| 169 | |
| 170 | /* if necessary, reorder entries in the cache by swapping positions */ |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 171 | if (node->prev && node->count > node->prev->count) { |
| 172 | ptr = node->prev; |
| 173 | |
| 174 | while (ptr->prev && node->count > ptr->prev->count) { |
| 175 | ptr = ptr->prev; |
| 176 | } |
| 177 | |
| 178 | if (node->next) { |
| 179 | node->next->prev = node->prev; |
| 180 | } else { |
| 181 | self->last = node->prev; |
| 182 | } |
| 183 | if (node->prev) { |
| 184 | node->prev->next = node->next; |
| 185 | } |
| 186 | if (ptr->prev) { |
| 187 | ptr->prev->next = node; |
| 188 | } else { |
| 189 | self->first = node; |
| 190 | } |
| 191 | |
| 192 | node->next = ptr; |
| 193 | node->prev = ptr->prev; |
| 194 | if (!node->prev) { |
| 195 | self->first = node; |
| 196 | } |
| 197 | ptr->prev = node; |
| 198 | } |
Serhiy Storchaka | fc662ac | 2018-12-10 16:06:08 +0200 | [diff] [blame] | 199 | } |
| 200 | else if (PyErr_Occurred()) { |
| 201 | return NULL; |
| 202 | } |
| 203 | else { |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 204 | /* There is no entry for this key in the cache, yet. We'll insert a new |
| 205 | * entry in the cache, and make space if necessary by throwing the |
| 206 | * least used item out of the cache. */ |
| 207 | |
Serhiy Storchaka | 5ab81d7 | 2016-12-16 16:18:57 +0200 | [diff] [blame] | 208 | if (PyDict_GET_SIZE(self->mapping) == self->size) { |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 209 | if (self->last) { |
| 210 | node = self->last; |
| 211 | |
| 212 | if (PyDict_DelItem(self->mapping, self->last->key) != 0) { |
| 213 | return NULL; |
| 214 | } |
| 215 | |
| 216 | if (node->prev) { |
| 217 | node->prev->next = NULL; |
| 218 | } |
| 219 | self->last = node->prev; |
| 220 | node->prev = NULL; |
| 221 | |
| 222 | Py_DECREF(node); |
| 223 | } |
| 224 | } |
| 225 | |
Petr Viktorin | ffd9753 | 2020-02-11 17:46:57 +0100 | [diff] [blame] | 226 | /* We cannot replace this by PyObject_CallOneArg() since |
Jeroen Demeyer | 196a530 | 2019-07-04 12:31:34 +0200 | [diff] [blame] | 227 | * PyObject_CallFunction() has a special case when using a |
| 228 | * single tuple as argument. */ |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 229 | data = PyObject_CallFunction(self->factory, "O", key); |
| 230 | |
| 231 | if (!data) { |
| 232 | return NULL; |
| 233 | } |
| 234 | |
Thomas Wouters | fc7bb8c | 2007-01-15 15:49:28 +0000 | [diff] [blame] | 235 | node = pysqlite_new_node(key, data); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 236 | if (!node) { |
| 237 | return NULL; |
| 238 | } |
| 239 | node->prev = self->last; |
| 240 | |
| 241 | Py_DECREF(data); |
| 242 | |
| 243 | if (PyDict_SetItem(self->mapping, key, (PyObject*)node) != 0) { |
| 244 | Py_DECREF(node); |
| 245 | return NULL; |
| 246 | } |
| 247 | |
| 248 | if (self->last) { |
| 249 | self->last->next = node; |
| 250 | } else { |
| 251 | self->first = node; |
| 252 | } |
| 253 | self->last = node; |
| 254 | } |
| 255 | |
Erlend Egeberg Aasland | bf64d90 | 2020-12-27 12:05:33 +0100 | [diff] [blame] | 256 | return Py_NewRef(node->data); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 257 | } |
| 258 | |
Erlend Egeberg Aasland | bf838a6 | 2021-02-21 01:29:19 +0100 | [diff] [blame] | 259 | static PyObject * |
| 260 | pysqlite_cache_display(pysqlite_Cache *self, PyObject *args) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 261 | { |
Thomas Wouters | fc7bb8c | 2007-01-15 15:49:28 +0000 | [diff] [blame] | 262 | pysqlite_Node* ptr; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 263 | PyObject* prevkey; |
| 264 | PyObject* nextkey; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 265 | PyObject* display_str; |
| 266 | |
| 267 | ptr = self->first; |
| 268 | |
| 269 | while (ptr) { |
| 270 | if (ptr->prev) { |
| 271 | prevkey = ptr->prev->key; |
| 272 | } else { |
| 273 | prevkey = Py_None; |
| 274 | } |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 275 | |
| 276 | if (ptr->next) { |
| 277 | nextkey = ptr->next->key; |
| 278 | } else { |
| 279 | nextkey = Py_None; |
| 280 | } |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 281 | |
Amaury Forgeot d'Arc | 864741b | 2011-11-06 15:10:48 +0100 | [diff] [blame] | 282 | display_str = PyUnicode_FromFormat("%S <- %S -> %S\n", |
| 283 | prevkey, ptr->key, nextkey); |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 284 | if (!display_str) { |
| 285 | return NULL; |
| 286 | } |
| 287 | PyObject_Print(display_str, stdout, Py_PRINT_RAW); |
| 288 | Py_DECREF(display_str); |
| 289 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 290 | ptr = ptr->next; |
| 291 | } |
| 292 | |
Berker Peksag | fe21de9 | 2016-04-09 07:34:39 +0300 | [diff] [blame] | 293 | Py_RETURN_NONE; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 294 | } |
| 295 | |
Erlend Egeberg Aasland | 2ffba2a | 2020-11-17 13:52:54 +0100 | [diff] [blame] | 296 | static PyType_Slot node_slots[] = { |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 297 | {Py_tp_dealloc, pysqlite_node_dealloc}, |
Miss Islington (bot) | e8d9df0 | 2021-05-25 11:08:39 -0700 | [diff] [blame^] | 298 | {Py_tp_traverse, node_traverse}, |
| 299 | {Py_tp_clear, node_clear}, |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 300 | {0, NULL}, |
| 301 | }; |
| 302 | |
Erlend Egeberg Aasland | 2ffba2a | 2020-11-17 13:52:54 +0100 | [diff] [blame] | 303 | static PyType_Spec node_spec = { |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 304 | .name = MODULE_NAME ".Node", |
| 305 | .basicsize = sizeof(pysqlite_Node), |
Miss Islington (bot) | e8d9df0 | 2021-05-25 11:08:39 -0700 | [diff] [blame^] | 306 | .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, |
Erlend Egeberg Aasland | 2ffba2a | 2020-11-17 13:52:54 +0100 | [diff] [blame] | 307 | .slots = node_slots, |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 308 | }; |
| 309 | PyTypeObject *pysqlite_NodeType = NULL; |
| 310 | |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 311 | static PyMethodDef cache_methods[] = { |
Thomas Wouters | fc7bb8c | 2007-01-15 15:49:28 +0000 | [diff] [blame] | 312 | {"get", (PyCFunction)pysqlite_cache_get, METH_O, |
Thomas Wouters | 477c8d5 | 2006-05-27 19:21:47 +0000 | [diff] [blame] | 313 | PyDoc_STR("Gets an entry from the cache or calls the factory function to produce one.")}, |
Thomas Wouters | fc7bb8c | 2007-01-15 15:49:28 +0000 | [diff] [blame] | 314 | {"display", (PyCFunction)pysqlite_cache_display, METH_NOARGS, |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 315 | PyDoc_STR("For debugging only.")}, |
| 316 | {NULL, NULL} |
| 317 | }; |
| 318 | |
Erlend Egeberg Aasland | 2ffba2a | 2020-11-17 13:52:54 +0100 | [diff] [blame] | 319 | static PyType_Slot cache_slots[] = { |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 320 | {Py_tp_dealloc, pysqlite_cache_dealloc}, |
| 321 | {Py_tp_methods, cache_methods}, |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 322 | {Py_tp_init, pysqlite_cache_init}, |
Miss Islington (bot) | e8d9df0 | 2021-05-25 11:08:39 -0700 | [diff] [blame^] | 323 | {Py_tp_traverse, cache_traverse}, |
| 324 | {Py_tp_clear, cache_clear}, |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 325 | {0, NULL}, |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 326 | }; |
| 327 | |
Erlend Egeberg Aasland | 2ffba2a | 2020-11-17 13:52:54 +0100 | [diff] [blame] | 328 | static PyType_Spec cache_spec = { |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 329 | .name = MODULE_NAME ".Cache", |
| 330 | .basicsize = sizeof(pysqlite_Cache), |
Miss Islington (bot) | e8d9df0 | 2021-05-25 11:08:39 -0700 | [diff] [blame^] | 331 | .flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, |
Erlend Egeberg Aasland | 2ffba2a | 2020-11-17 13:52:54 +0100 | [diff] [blame] | 332 | .slots = cache_slots, |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 333 | }; |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 334 | PyTypeObject *pysqlite_CacheType = NULL; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 335 | |
Erlend Egeberg Aasland | 38b6c2a | 2021-02-21 11:07:49 +0100 | [diff] [blame] | 336 | int |
| 337 | pysqlite_cache_setup_types(PyObject *mod) |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 338 | { |
Erlend Egeberg Aasland | 2ffba2a | 2020-11-17 13:52:54 +0100 | [diff] [blame] | 339 | pysqlite_NodeType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &node_spec, NULL); |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 340 | if (pysqlite_NodeType == NULL) { |
| 341 | return -1; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 342 | } |
| 343 | |
Erlend Egeberg Aasland | 2ffba2a | 2020-11-17 13:52:54 +0100 | [diff] [blame] | 344 | pysqlite_CacheType = (PyTypeObject *)PyType_FromModuleAndSpec(mod, &cache_spec, NULL); |
Erlend Egeberg Aasland | a937ab4 | 2020-09-27 14:14:50 +0200 | [diff] [blame] | 345 | if (pysqlite_CacheType == NULL) { |
| 346 | return -1; |
| 347 | } |
| 348 | return 0; |
Thomas Wouters | 49fd7fa | 2006-04-21 10:40:58 +0000 | [diff] [blame] | 349 | } |