diff options
Diffstat (limited to 'src/gdbmcount.c')
-rw-r--r-- | src/gdbmcount.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gdbmcount.c b/src/gdbmcount.c index 4a78bc0..3e6bb06 100644 --- a/src/gdbmcount.c +++ b/src/gdbmcount.c @@ -1,8 +1,7 @@ /* gdbmcount.c - get number of items in a gdbm file. */ /* This file is part of GDBM, the GNU data base manager. - Copyright (C) 1993-1994, 2007, 2011, 2013, 2016-2020 Free Software - Foundation, Inc. + Copyright (C) 1993-2021 Free Software Foundation, Inc. GDBM is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,3 +39,19 @@ gdbm_count (GDBM_FILE dbf, gdbm_count_t *pcount) *pcount = count; return 0; } + +int +gdbm_bucket_count (GDBM_FILE dbf, size_t *pcount) +{ + int i; + size_t count = 0; + + GDBM_ASSERT_CONSISTENCY (dbf, -1); + + for (i = 0; i < GDBM_DIR_COUNT (dbf); i = _gdbm_next_bucket_dir (dbf, i)) + { + ++count; + } + *pcount = count; + return 0; +} |