diff options
author | Volker Lendecke <vl@samba.org> | 2009-01-19 00:04:33 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-01-19 00:05:56 +0100 |
commit | fe9dd8710d577478b324d1d507de0ecd77df2ea5 (patch) | |
tree | f1277aab6513e781a1c77b69cda643c0bcba5bbf /source3/lib | |
parent | eaec86514896762aff23f30aca2b944ce07bf7c9 (diff) | |
download | samba-fe9dd8710d577478b324d1d507de0ecd77df2ea5.tar.gz samba-fe9dd8710d577478b324d1d507de0ecd77df2ea5.tar.bz2 samba-fe9dd8710d577478b324d1d507de0ecd77df2ea5.zip |
Remove unused tdb_search_keys()
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_tdb.c | 68 |
1 files changed, 0 insertions, 68 deletions
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. |