Get value from leaf node */
| 324 | |
| 325 | /* Get value from leaf node */ |
| 326 | PyObject* node_get(BPlusNode *node, PyObject *key) { |
| 327 | int pos = node_find_position(node, key); |
| 328 | if (pos < 0) return NULL; /* Comparison error */ |
| 329 | |
| 330 | if (pos < node->num_keys) { |
| 331 | PyObject *found_key = node_get_key(node, pos); |
| 332 | int cmp = fast_compare_eq(found_key, key); |
| 333 | if (cmp < 0) return NULL; /* Comparison error */ |
| 334 | |
| 335 | if (cmp) { |
| 336 | PyObject *value = node_get_value(node, pos); |
| 337 | Py_INCREF(value); |
| 338 | return value; |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | /* Key not found */ |
| 343 | PyErr_SetObject(PyExc_KeyError, key); |
| 344 | return NULL; |
| 345 | } |
| 346 | |
| 347 | /* Cache-aligned memory allocation functions */ |
| 348 | void* cache_aligned_alloc(size_t size) { |
no test coverage detected