/* wmem_splay.h * Definitions for the Wireshark Memory Manager Splay Tree * Copyright 2014, Evan Huus * * Wireshark - Network traffic analyzer * By Gerald Combs * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __WMEM_SPLAY_H__ #define __WMEM_SPLAY_H__ #include "wmem_core.h" #include "wmem_tree.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** @addtogroup wmem * @{ * @defgroup wmem-splay Splay Tree * * Binary trees are a well-known and popular device in computer science to * handle storage of objects based on a search key or identity. The * particular binary tree style implemented here is the splay tree, which * has a large number of nice properties. It guarantees O(log(n)) amortized * time per operation, and O(1) per operation for certain special access * patterns. See https://en.wikipedia.org/wiki/Splay_tree * * The version implemented here is known as "independent semi-splaying", * which is a variant with the same properties but slightly better practical * performance. * * @{ */ struct _wmem_splay_t; typedef struct _wmem_splay_t wmem_splay_t; /** A wmem_compare_func compares two keys in a tree, and must return: * 0 if a==b * >0 if a>b * <0 if a