diff options
Diffstat (limited to 'storage/innobase/include/ut0rbt.h')
-rw-r--r-- | storage/innobase/include/ut0rbt.h | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/storage/innobase/include/ut0rbt.h b/storage/innobase/include/ut0rbt.h index e26b637ae13..e8a4430e76b 100644 --- a/storage/innobase/include/ut0rbt.h +++ b/storage/innobase/include/ut0rbt.h @@ -1,12 +1,6 @@ /***************************************************************************//** -Copyright (c) 2007, 2010, Innobase Oy. All Rights Reserved. - -Portions of this file contain modifications contributed and copyrighted by -Sun Microsystems, Inc. Those modifications are gratefully acknowledged and -are described briefly in the InnoDB documentation. The contributions by -Sun Microsystems are incorporated with their permission, and subject to the -conditions contained in the file COPYING.Sun_Microsystems. +Copyright (c) 2007, 2010, Oracle and/or its affiliates. All Rights Reserved. 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 @@ -17,8 +11,8 @@ 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., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA *****************************************************************************/ /******************************************************************//** @@ -57,6 +51,7 @@ typedef struct ib_rbt_node_struct ib_rbt_node_t; typedef struct ib_rbt_bound_struct ib_rbt_bound_t; typedef void (*ib_rbt_print_node)(const ib_rbt_node_t* node); typedef int (*ib_rbt_compare)(const void* p1, const void* p2); +typedef int (*ib_rbt_arg_compare)(const void*, const void* p1, const void* p2); /** Red black tree color types */ enum ib_rbt_color_enum { @@ -90,7 +85,11 @@ struct ib_rbt_struct { ulint n_nodes; /* Total number of data nodes */ ib_rbt_compare compare; /* Fn. to use for comparison */ + ib_rbt_arg_compare + compare_with_arg; /* Fn. to use for comparison + with argument */ ulint sizeof_value; /* Sizeof the item in bytes */ + const void* cmp_arg; /* Compare func argument */ }; /** The result of searching for a key in the tree, this is useful for @@ -133,6 +132,18 @@ rbt_create( size_t sizeof_value, /*!< in: size in bytes */ ib_rbt_compare compare); /*!< in: comparator */ /**********************************************************************//** +Create an instance of a red black tree, whose comparison function takes +an argument +@return rb tree instance */ +UNIV_INTERN +ib_rbt_t* +rbt_create_arg_cmp( +/*===============*/ + size_t sizeof_value, /*!< in: size in bytes */ + ib_rbt_arg_compare + compare, /*!< in: comparator */ + const void* cmp_arg); /*!< in: compare fn arg */ +/**********************************************************************//** Delete a node from the red black tree, identified by key */ UNIV_INTERN ibool @@ -265,7 +276,10 @@ rbt_search_cmp( const ib_rbt_t* tree, /*!< in: rb tree */ ib_rbt_bound_t* parent, /*!< in: search bounds */ const void* key, /*!< in: key to search */ - ib_rbt_compare compare); /*!< in: comparator */ + ib_rbt_compare compare, /*!< in: comparator */ + ib_rbt_arg_compare + arg_compare); /*!< in: fn to compare items + with argument */ /**********************************************************************//** Clear the tree, deletes (and free's) all the nodes. */ UNIV_INTERN |