diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-03-15 17:32:42 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-03-15 17:32:42 +0200 |
commit | 02bc2dc9bee96c0e7d93d23c6f0b7a24d0e17566 (patch) | |
tree | 61071105561260e4b08a8e3faee5f8a07645fc79 /src/gdbmtool.c | |
parent | 1f94a81a9f3a9955ca74dff07b7909595a850485 (diff) | |
download | gdbm-02bc2dc9bee96c0e7d93d23c6f0b7a24d0e17566.tar.gz gdbm-02bc2dc9bee96c0e7d93d23c6f0b7a24d0e17566.tar.bz2 |
Implement the gdbm_bucket_count function.
* src/gdbmcount.c (gdbm_bucket_count): New function.
* src/gdbm.h.in (gdbm_bucket_count): New proto.
* doc/gdbm.texi: Document gdbm_bucket_count.
* src/gdbmtool.c (bucket_count): Reimplement via gdbm_bucket_count.
Diffstat (limited to 'src/gdbmtool.c')
-rw-r--r-- | src/gdbmtool.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/gdbmtool.c b/src/gdbmtool.c index f9a4924..f439207 100644 --- a/src/gdbmtool.c +++ b/src/gdbmtool.c @@ -788,17 +788,11 @@ print_dir_begin (struct handler_param *param GDBM_ARG_UNUSED, size_t *exp_count) static size_t bucket_count (void) { - int i; - off_t last = 0; size_t count = 0; - - for (i = 0; i < GDBM_DIR_COUNT (gdbm_file); i++) + + if (gdbm_bucket_count (gdbm_file, &count)) { - if (gdbm_file->dir[i] != last) - { - ++count; - last = gdbm_file->dir[i]; - } + terror ("gdbm_bucket_count: %s", gdbm_strerror (gdbm_errno)); } return count; } |