summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-10-06 10:43:56 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-10-06 14:46:54 -0400
commitc7ac7a54ad32a53b866151663172acad2e82c8ee (patch)
tree42877d3f3b1c06546536ee402d5faf01e9c7b1ba /server
parent1f22c456d3bcec6f1c9318bd67f69e15e202c9a0 (diff)
downloadsssd-c7ac7a54ad32a53b866151663172acad2e82c8ee.tar.gz
sssd-c7ac7a54ad32a53b866151663172acad2e82c8ee.tar.xz
sssd-c7ac7a54ad32a53b866151663172acad2e82c8ee.zip
Remove unused btreemap code
We have converted to using dhash in place of btreemap everywhere in the code.
Diffstat (limited to 'server')
-rw-r--r--server/Makefile.am2
-rw-r--r--server/confdb/confdb.c1
-rw-r--r--server/confdb/confdb.h1
-rw-r--r--server/providers/data_provider.c1
-rw-r--r--server/providers/data_provider_be.c1
-rw-r--r--server/responder/common/responder.h1
-rw-r--r--server/responder/common/responder_common.c1
-rw-r--r--server/responder/nss/nsssrv.c1
-rw-r--r--server/responder/pam/pamsrv.c1
-rw-r--r--server/sbus/sssd_dbus_common.c1
-rw-r--r--server/util/btreemap.c216
-rw-r--r--server/util/btreemap.h41
12 files changed, 0 insertions, 268 deletions
diff --git a/server/Makefile.am b/server/Makefile.am
index 626633e95..4eb2c4bc5 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -170,7 +170,6 @@ SSSD_UTIL_OBJ = \
sbus/sssd_dbus_common.c \
sbus/sssd_dbus_connection.c \
sbus/sssd_dbus_server.c \
- util/btreemap.c \
util/memory.c \
util/server.c \
util/signal.c \
@@ -229,7 +228,6 @@ PYTHON_BINDINGS_LIBS = \
dist_noinst_HEADERS = \
monitor/monitor.h \
- util/btreemap.h \
util/nss_sha512crypt.h \
util/dlinklist.h \
util/sssd-i18n.h \
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c
index ca7be4544..b2a941ecb 100644
--- a/server/confdb/confdb.c
+++ b/server/confdb/confdb.c
@@ -26,7 +26,6 @@
#include "util/util.h"
#include "confdb/confdb.h"
#include "confdb/confdb_private.h"
-#include "util/btreemap.h"
#include "util/strtonum.h"
#include "db/sysdb.h"
diff --git a/server/confdb/confdb.h b/server/confdb/confdb.h
index 8f64be487..3821ffff3 100644
--- a/server/confdb/confdb.h
+++ b/server/confdb/confdb.h
@@ -27,7 +27,6 @@
#include "tevent.h"
#include "ldb.h"
#include "ldb_errors.h"
-#include "util/btreemap.h"
#include "config.h"
#define CONFDB_FILE "config.ldb"
diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c
index 0838cd021..70b7cd3f5 100644
--- a/server/providers/data_provider.c
+++ b/server/providers/data_provider.c
@@ -36,7 +36,6 @@
#include "confdb/confdb.h"
#include "dbus/dbus.h"
#include "sbus/sssd_dbus.h"
-#include "util/btreemap.h"
#include "data_provider.h"
#include "dp_interfaces.h"
#include "monitor/monitor_interfaces.h"
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index 29d6fa0e3..2fa99da2a 100644
--- a/server/providers/data_provider_be.c
+++ b/server/providers/data_provider_be.c
@@ -40,7 +40,6 @@
#include "db/sysdb.h"
#include "dbus/dbus.h"
#include "sbus/sssd_dbus.h"
-#include "util/btreemap.h"
#include "providers/dp_backend.h"
#include "monitor/monitor_interfaces.h"
diff --git a/server/responder/common/responder.h b/server/responder/common/responder.h
index ddf8b893c..558cba311 100644
--- a/server/responder/common/responder.h
+++ b/server/responder/common/responder.h
@@ -32,7 +32,6 @@
#include "dhash.h"
#include "sbus/sssd_dbus.h"
#include "../sss_client/sss_cli.h"
-#include "util/btreemap.h"
extern hash_table_t *dp_requests;
diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c
index a3ac6e819..92270afd3 100644
--- a/server/responder/common/responder_common.c
+++ b/server/responder/common/responder_common.c
@@ -35,7 +35,6 @@
#include "confdb/confdb.h"
#include "dbus/dbus.h"
#include "sbus/sssd_dbus.h"
-#include "util/btreemap.h"
#include "responder/common/responder.h"
#include "responder/common/responder_packet.h"
#include "providers/data_provider.h"
diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c
index 6cdd19a92..e7c2307da 100644
--- a/server/responder/nss/nsssrv.c
+++ b/server/responder/nss/nsssrv.c
@@ -38,7 +38,6 @@
#include "confdb/confdb.h"
#include "dbus/dbus.h"
#include "sbus/sssd_dbus.h"
-#include "util/btreemap.h"
#include "responder/common/responder_packet.h"
#include "providers/data_provider.h"
#include "monitor/monitor_interfaces.h"
diff --git a/server/responder/pam/pamsrv.c b/server/responder/pam/pamsrv.c
index dbc8ec12d..f8af665bf 100644
--- a/server/responder/pam/pamsrv.c
+++ b/server/responder/pam/pamsrv.c
@@ -37,7 +37,6 @@
#include "confdb/confdb.h"
#include "dbus/dbus.h"
#include "sbus/sssd_dbus.h"
-#include "util/btreemap.h"
#include "responder/common/responder_packet.h"
#include "providers/data_provider.h"
#include "monitor/monitor_interfaces.h"
diff --git a/server/sbus/sssd_dbus_common.c b/server/sbus/sssd_dbus_common.c
index e5970a3eb..d446632d2 100644
--- a/server/sbus/sssd_dbus_common.c
+++ b/server/sbus/sssd_dbus_common.c
@@ -23,7 +23,6 @@
#include "tevent.h"
#include "dbus/dbus.h"
#include "util/util.h"
-#include "util/btreemap.h"
#include "sbus/sssd_dbus.h"
#include "sbus/sssd_dbus_private.h"
diff --git a/server/util/btreemap.c b/server/util/btreemap.c
deleted file mode 100644
index 43646c34c..000000000
--- a/server/util/btreemap.c
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- SSSD
-
- Service monitor
-
- Copyright (C) Stephen Gallagher 2008
-
- 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-#include <errno.h>
-#include "talloc.h"
-#include "util/btreemap.h"
-#include "util/util.h"
-
-struct btreemap
-{
- /* NULL keys are not allowed */
- const void *key;
-
- /* NULL values are permitted */
- void *value;
-
- struct btreemap *left;
- struct btreemap *right;
-
- /* comparator must return -1, 0 or 1
- * and should only be set for the root node
- * other nodes will be ignored.
- */
- btreemap_comparison_fn comparator;
-};
-
-/* btreemap_search_key
- * Searches a btreemap for an entry with a specific key
- * If found, it will return BTREEMAP_FOUND and node will
- * be set to the appropriate node.
- * If not found, it will set the following:
- * BTREEMAP_EMPTY: The map was empty, create a new map when adding keys
- * BTREEMAP_CREATE_LEFT: A new node created should use node->left
- * BTREEMAP_CREATE_RIGHT: A new node created should use node->right
- */
-int btreemap_search_key(struct btreemap *map,
- const void *key, struct btreemap **node)
-{
- struct btreemap *tempnode;
- int result;
- int found = BTREEMAP_EMPTY;
-
- if (!map)
- {
- *node = NULL;
- return BTREEMAP_EMPTY;
- }
-
- tempnode = map;
- while (found == BTREEMAP_EMPTY) {
- result = tempnode->comparator(key, tempnode->key);
- if (result > 0)
- {
- if (tempnode->right)
- tempnode=tempnode->right;
- else
- {
- found = BTREEMAP_CREATE_RIGHT;
- }
- } else if (result < 0)
- {
- if (tempnode->left)
- tempnode=tempnode->left;
- else
- {
- found = BTREEMAP_CREATE_LEFT;
- }
- } else
- {
- /* This entry matched */
- found = BTREEMAP_FOUND;
- }
- }
-
- *node = tempnode;
- return found;
-}
-
-void *btreemap_get_value(struct btreemap *map, const void *key)
-{
- struct btreemap *node;
- int found;
-
- if (!map || !key)
- {
- return NULL;
- }
-
- /* Search for the key */
- found = btreemap_search_key(map, key, &node);
- if (found == 0)
- {
- return node->value;
- }
-
- /* If the key was not found, return NULL */
- return NULL;
-}
-
-/* Keys and values must be talloc contexts
- * comparator must return -1, 0 or 1
- */
-int btreemap_set_value(TALLOC_CTX *mem_ctx,
- struct btreemap **map, const void *key, void *value,
- btreemap_comparison_fn comparator)
-{
- struct btreemap *node;
- struct btreemap *new_node;
- int found;
-
- if (!key)
- {
- return EINVAL;
- }
-
- /* Search for the key */
- found = btreemap_search_key(*map, key, &node);
-
- if (found == BTREEMAP_FOUND)
- {
- /* Update existing value */
- node->value = value;
- return EOK;
- }
-
- /* Need to add a value to the tree */
- new_node = talloc_zero(mem_ctx, struct btreemap);
-
- if (!new_node)
- {
- return ENOMEM;
- }
- new_node->key = key;
- new_node->value = value;
- new_node->comparator = comparator;
- new_node->left = NULL;
- new_node->right = NULL;
-
-
- if (found == BTREEMAP_EMPTY)
- {
- *map = new_node;
- }
- if (found == BTREEMAP_CREATE_LEFT)
- {
- node->left = new_node;
- } else if (found == BTREEMAP_CREATE_RIGHT)
- {
- node->right = new_node;
- }
- return EOK;
-}
-
-static int _btreemap_get_keys(TALLOC_CTX *mem_ctx, struct btreemap *map,
- const void ***array, int *count, int depth)
-{
- int ret;
- const void **tmp_array;
-
- if (map == NULL) return EOK;
-
- /* Left Node */
- ret = _btreemap_get_keys(mem_ctx, map->left, array, count, depth+1);
- if (ret != EOK) {
- return ret;
- }
-
- /* Current Node */
- (*count)++;
- tmp_array = talloc_realloc(mem_ctx, *array, const void *, *count);
- if (tmp_array == NULL) {
- /* Out of memory */
- *count = 0;
- talloc_free(*array);
- *array = NULL;
- return ENOMEM;
- }
- *array = tmp_array;
- (*array)[(*count)-1] = map->key;
-
- /* Right Node */
- ret = _btreemap_get_keys(mem_ctx, map->right, array, count, depth+1);
- if (ret != EOK) {
- return ret;
- }
-
- return EOK;
-}
-/* Return an array of keys in sort order
- */
-int btreemap_get_keys(TALLOC_CTX *mem_ctx,
- struct btreemap *map,
- const void ***array, int *count)
-{
- *array = NULL;
- *count = 0;
- return _btreemap_get_keys(mem_ctx, map, array, count, 0);
-}
diff --git a/server/util/btreemap.h b/server/util/btreemap.h
deleted file mode 100644
index 8d7fb1595..000000000
--- a/server/util/btreemap.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- SSSD
-
- Service monitor
-
- Copyright (C) Stephen Gallagher 2008
-
- 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 3 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, see <http://www.gnu.org/licenses/>.
-*/
-#ifndef BTREEMAP_H_
-#define BTREEMAP_H_
-
-enum {
- BTREEMAP_EMPTY = -2,
- BTREEMAP_CREATE_LEFT,
- BTREEMAP_FOUND,
- BTREEMAP_CREATE_RIGHT
-};
-
-typedef int (*btreemap_comparison_fn)(const void *first, const void *second);
-struct btreemap;
-int btreemap_search_key(struct btreemap *map, const void *key, struct btreemap **node);
-void *btreemap_get_value(struct btreemap *map, const void *key);
-int btreemap_set_value(TALLOC_CTX *mem_ctx,
- struct btreemap **map, const void *key, void *value,
- btreemap_comparison_fn comparator);
-int btreemap_get_keys(TALLOC_CTX *mem_ctx, struct btreemap *map, const void ***array, int *count);
-
-
-#endif /*BTREEMAP_H_*/