Lines Matching defs:node

2271     StrongCacheNode *node = PyMem_Malloc(sizeof(StrongCacheNode));
2272 if (node == NULL) {
2279 node->next = NULL;
2280 node->prev = NULL;
2281 node->key = key;
2282 node->zone = zone;
2284 return node;
2289 strong_cache_node_free(StrongCacheNode *node)
2291 Py_XDECREF(node->key);
2292 Py_XDECREF(node->zone);
2294 PyMem_Free(node);
2299 * This can be used on the root node to free the entire cache or it can be used
2301 * right, will actually only be 1 node at a time).
2306 StrongCacheNode *node = root;
2308 while (node != NULL) {
2309 next_node = node->next;
2310 strong_cache_node_free(node);
2312 node = next_node;
2316 /* Removes a node from the cache and update its neighbors.
2318 * This is used both when ejecting a node from the cache and when moving it to
2322 remove_from_strong_cache(StrongCacheNode *node)
2324 if (ZONEINFO_STRONG_CACHE == node) {
2325 ZONEINFO_STRONG_CACHE = node->next;
2328 if (node->prev != NULL) {
2329 node->prev->next = node->next;
2332 if (node->next != NULL) {
2333 node->next->prev = node->prev;
2336 node->next = NULL;
2337 node->prev = NULL;
2340 /* Retrieves the node associated with a key, if it exists.
2343 * pointer to the relevant node if found. Returns NULL if no node is found.
2350 const StrongCacheNode *node = root;
2351 while (node != NULL) {
2352 int rv = PyObject_RichCompareBool(key, node->key, Py_EQ);
2357 return (StrongCacheNode *)node;
2360 node = node->next;
2377 StrongCacheNode *node = find_in_strong_cache(ZONEINFO_STRONG_CACHE, key);
2378 if (node != NULL) {
2379 remove_from_strong_cache(node);
2381 strong_cache_node_free(node);
2389 /* Moves a node to the front of the LRU cache.
2391 * The strong cache is an LRU cache, so whenever a given node is accessed, if
2395 move_strong_cache_node_to_front(StrongCacheNode **root, StrongCacheNode *node)
2398 if (root_p == node) {
2402 remove_from_strong_cache(node);
2404 node->prev = NULL;
2405 node->next = root_p;
2408 root_p->prev = node;
2411 *root = node;
2416 * This function finds the ZoneInfo by key and if found will move the node to
2430 StrongCacheNode *node = find_in_strong_cache(ZONEINFO_STRONG_CACHE, key);
2432 if (node != NULL) {
2433 move_strong_cache_node_to_front(&ZONEINFO_STRONG_CACHE, node);
2434 Py_INCREF(node->zone);
2435 return node->zone;
2443 * This function is only to be used after a cache miss — it creates a new node
2459 StrongCacheNode *node = new_node->next;
2461 if (node == NULL) {
2464 node = node->next;
2468 if (node != NULL) {
2469 if (node->prev != NULL) {
2470 node->prev->next = NULL;
2472 strong_cache_free(node);