2008-08-28 07:37:26 -07:00
|
|
|
/* EINA - EFL data type library
|
2008-09-01 05:42:16 -07:00
|
|
|
* Copyright (C) 2002-2008 Cedric BAIL
|
2008-08-28 07:37:26 -07:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library;
|
|
|
|
* if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef EINA_RBTREE_INLINE_H_
|
|
|
|
#define EINA_RBTREE_INLINE_H_
|
|
|
|
|
2010-09-12 12:28:18 -07:00
|
|
|
/**
|
|
|
|
* @addtogroup Eina_Rbtree_Group Red-Black tree
|
|
|
|
*
|
2017-11-12 19:04:39 -08:00
|
|
|
* @brief These functions provide Red-Black tree management.
|
2010-09-12 12:28:18 -07:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2008-08-28 07:37:26 -07:00
|
|
|
static inline Eina_Rbtree *
|
2008-11-10 08:23:56 -08:00
|
|
|
eina_rbtree_inline_lookup(const Eina_Rbtree *root, const void *key, int length, Eina_Rbtree_Cmp_Key_Cb cmp, const void *data)
|
2008-08-28 07:37:26 -07:00
|
|
|
{
|
|
|
|
int result;
|
|
|
|
|
|
|
|
while (root)
|
|
|
|
{
|
2016-09-18 16:58:56 -07:00
|
|
|
result = cmp(root, key, length, (void *)data);
|
|
|
|
if (result != 0) root = root->son[result < 0 ? 0 : 1];
|
|
|
|
else break;
|
2008-08-28 07:37:26 -07:00
|
|
|
}
|
2016-09-18 16:58:56 -07:00
|
|
|
return (Eina_Rbtree *)root;
|
2008-08-28 07:37:26 -07:00
|
|
|
}
|
|
|
|
|
2010-09-12 12:28:18 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2008-08-28 07:37:26 -07:00
|
|
|
#endif
|