]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Remove unused tdb_search_keys()
authorVolker Lendecke <vl@samba.org>
Sun, 18 Jan 2009 23:04:33 +0000 (00:04 +0100)
committerVolker Lendecke <vl@samba.org>
Sun, 18 Jan 2009 23:05:56 +0000 (00:05 +0100)
source3/include/util_tdb.h
source3/lib/util_tdb.c

index a5b45e6a1d8eebc648cb5217ddfb1f5ae85e4277..127176b887b5dc944ca857f1985ce55cc5de5e54 100644 (file)
 #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);
index 03f72dfcee14a8065d58a5dd475c1572c1154d2f..2dbdd5794787df11ab76fec59aa8a94d1699a279 100644 (file)
@@ -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.