Open SCAP Library
Loading...
Searching...
No Matches
rbt_str.h
1/*
2 * Copyright 2010 Red Hat Inc., Durham, North Carolina.
3 * All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 *
19 * Authors:
20 * "Daniel Kopecek" <dkopecek@redhat.com>
21 */
22#ifndef RBT_STR_H
23#define RBT_STR_H
24
25#include "rbt_common.h"
26
28 char *key;
29 void *data;
30};
31
32typedef struct rbt_str_node rbt_str_node_t;
33
34static inline struct rbt_str_node *rbt_str_node(const struct rbt_node *np)
35{
36 struct rbt_str_node *str_node = (struct rbt_str_node *)(rbt_node_ptr(np)->_node);
37 return str_node;
38}
39
40rbt_t *rbt_str_new (void);
41void rbt_str_free (rbt_t *rbt);
42void rbt_str_free_cb (rbt_t *rbt, void (*callback)(struct rbt_str_node *));
43void rbt_str_free_cb2 (rbt_t *rbt, void (*callback)(struct rbt_str_node *, void *user), void *user);
44
45int rbt_str_add(rbt_t *rbt, char *key, void *data);
46void *rbt_str_rep(rbt_t *rbt, const char *key, void *data);
47int rbt_str_del(rbt_t *rbt, const char *key, void **n);
48int rbt_str_getnode(rbt_t *rbt, const char *key, struct rbt_str_node **node);
49int rbt_str_get(rbt_t *rbt, const char *key, void **data);
50
51int rbt_str_walk_preorder(rbt_t *rbt, int (*callback)(struct rbt_str_node *), rbt_walk_t flags);
52int rbt_str_walk_inorder(rbt_t *rbt, int (*callback)(struct rbt_str_node *), rbt_walk_t flags);
53int rbt_str_walk_inorder2(rbt_t *rbt, int (*callback)(struct rbt_str_node *, void *), void *user, rbt_walk_t flags);
54int rbt_str_walk_postorder(rbt_t *rbt, int (*callback)(struct rbt_str_node *), rbt_walk_t flags);
55int rbt_str_walk_levelorder(rbt_t *rbt, int (*callback)(struct rbt_str_node *), rbt_walk_t flags);
56int rbt_str_walk(rbt_t *rbt, rbt_walk_t type, int (*callback)(struct rbt_str_node *));
57size_t rbt_str_size(rbt_t *rbt);
58
59#endif /* RBT_STR_H */
Generic node structure Lowest bit of _chld[0] holds the color bit.
Definition rbt_common.h:64
Definition rbt_str.h:27
Definition rbt_common.h:129