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/lib/util_tdb.c | 68 -------------------------------------------------- 1 file changed, 68 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 03f72dfcee..2dbdd57947 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