From fe9dd8710d577478b324d1d507de0ecd77df2ea5 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 19 Jan 2009 00:04:33 +0100 Subject: Remove unused tdb_search_keys() --- source3/include/util_tdb.h | 10 ------- source3/lib/util_tdb.c | 68 ---------------------------------------------- 2 files changed, 78 deletions(-) diff --git a/source3/include/util_tdb.h b/source3/include/util_tdb.h index a5b45e6a1d8..127176b887b 100644 --- a/source3/include/util_tdb.h +++ b/source3/include/util_tdb.h @@ -25,13 +25,6 @@ #include "talloc.h" /* for tdb_wrap_open() */ #include "../libcli/util/ntstatus.h" /* for map_nt_error_from_tdb() */ -/* single node of a list returned by tdb_search_keys */ -typedef struct keys_node -{ - struct keys_node *prev, *next; - TDB_DATA node_key; -} TDB_LIST_NODE; - struct tdb_wrap { struct tdb_context *tdb; const char *name; @@ -52,9 +45,6 @@ TDB_DATA make_tdb_data(const uint8_t *dptr, size_t dsize); TDB_DATA string_tdb_data(const char *string); TDB_DATA string_term_tdb_data(const char *string); -TDB_LIST_NODE *tdb_search_keys(struct tdb_context*, const char*); -void tdb_search_list_free(TDB_LIST_NODE*); - int tdb_chainlock_with_timeout( struct tdb_context *tdb, TDB_DATA key, unsigned int timeout); int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval); diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 03f72dfcee1..2dbdd579478 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -422,74 +422,6 @@ TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags, return tdb; } - -/** - * Search across the whole tdb for keys that match the given pattern - * return the result as a list of keys - * - * @param tdb pointer to opened tdb file context - * @param pattern searching pattern used by fnmatch(3) functions - * - * @return list of keys found by looking up with given pattern - **/ -TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT *tdb, const char* pattern) -{ - TDB_DATA key, next; - TDB_LIST_NODE *list = NULL; - TDB_LIST_NODE *rec = NULL; - - for (key = tdb_firstkey(tdb); key.dptr; key = next) { - /* duplicate key string to ensure null-termination */ - char *key_str = SMB_STRNDUP((const char *)key.dptr, key.dsize); - if (!key_str) { - DEBUG(0, ("tdb_search_keys: strndup() failed!\n")); - smb_panic("strndup failed!\n"); - } - - DEBUG(18, ("checking %s for match to pattern %s\n", key_str, pattern)); - - next = tdb_nextkey(tdb, key); - - /* do the pattern checking */ - if (fnmatch(pattern, key_str, 0) == 0) { - rec = SMB_MALLOC_P(TDB_LIST_NODE); - ZERO_STRUCTP(rec); - - rec->node_key = key; - - DLIST_ADD_END(list, rec, TDB_LIST_NODE *); - - DEBUG(18, ("checking %s matched pattern %s\n", key_str, pattern)); - } else { - free(key.dptr); - } - - /* free duplicated key string */ - free(key_str); - } - - return list; - -} - - -/** - * Free the list returned by tdb_search_keys - * - * @param node list of results found by tdb_search_keys - **/ -void tdb_search_list_free(TDB_LIST_NODE* node) -{ - TDB_LIST_NODE *next_node; - - while (node) { - next_node = node->next; - SAFE_FREE(node->node_key.dptr); - SAFE_FREE(node); - node = next_node; - }; -} - /**************************************************************************** tdb_store, wrapped in a transaction. This way we make sure that a process that dies within writing does not leave a corrupt tdb behind. -- cgit