diff options
author | Colin Watson <cjwatson@debian.org> | 2019-08-23 22:47:27 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2019-08-23 23:40:43 +0100 |
commit | 252d7cbc2328b27457aafcbd6fa5958a8be9fded (patch) | |
tree | 0100b6b00c7505791df6cce36c9865c167be17ff /src/whatis.c | |
parent | d832caef138f91fdbd19495ca93d9645fca413de (diff) |
Store database file name alongside its handle
The GDBM backend already did things this way, but it's convenient to do
it the same way for all backends.
Rename libmandb's various backend-specific functions to be uniformly
man_<backend>_<operation>. In the cases of btree and ndbm there was
already no clash with the libraries they depend on, but this makes them
match the gdbm backend.
* libdb/db_btree.c (btree_close): Rename to ...
(man_btree_close): ... this.
(btree_flopen): Rename to ...
(man_btree_open): ... this. Wrap the returned file handle in a
man_btree_wrapper structure that remembers the file name.
(btree_replace): Rename to ...
(man_btree_replace): ... this.
(btree_insert): Rename to ...
(man_btree_insert): ... this.
(btree_fetch): Rename to ...
(man_btree_fetch): ... this.
(btree_exists): Rename to ...
(man_btree_exists): ... this.
(btree_findkey): Rename to ...
(man_btree_findkey): ... this.
(btree_firstkey): Rename to ...
(man_btree_firstkey): ... this.
(btree_nextkey): Rename to ...
(man_btree_nextkey): ... this.
(btree_nextkeydata): Rename to ...
(man_btree_nextkeydata): ... this.
(btree_get_time): Rename to ...
(man_btree_get_time): ... this.
(btree_set_time): Rename to ...
(man_btree_set_time): ... this.
Update all prototypes and callers for all renames.
(man_btree_close, man_btree_replace, man_btree_insert, man_btree_fetch,
man_btree_exists, man_btree_findkey, man_btree_firstkey,
man_btree_nextkey, man_btree_nextkeydata, man_btree_get_time,
man_btree_set_time): Take man_btree_wrapper parameter rather than DB *.
Update all callers.
* libdb/db_ndbm.c (ndbm_flclose): Rename to ...
(man_ndbm_close): ... this.
(ndbm_flopen): Rename to ...
(man_ndbm_open): ... this. Copy the given file name before passing it
to dbm_open, since at least GDBM's compatibility implementation declares
that parameter as non-const. Wrap the returned file handle in a
man_ndbm_wrapper structure that remembers the file name.
(ndbm_get_time): Rename to ...
(man_ndbm_get_time): ... this.
(ndbm_set_time): Rename to ...
(man_ndbm_set_time): ... this.
Update all prototypes and callers for all renames.
(man_ndbm_close, man_ndbm_get_time, man_ndbm_set_time): Take
man_ndbm_wrapper parameter rather than DBM *. Update all callers.
* libdb/mydbm.h (man_ndbm_wrapper): New structure.
(MYDBM_FILE) [NDBM]: Change to man_ndbm_wrapper.
(man_btree_wrapper): New structure.
(MYDBM_FILE) [BTREE]: Change to man_btree_wrapper.
* libdb/db_lookup.c (gripe_lock): Constify filename parameter.
* libdb/db_storage.h (gripe_lock): Update prototype.
Diffstat (limited to 'src/whatis.c')
-rw-r--r-- | src/whatis.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/whatis.c b/src/whatis.c index 8b648121..7bd37527 100644 --- a/src/whatis.c +++ b/src/whatis.c @@ -719,7 +719,7 @@ static void do_apropos (MYDBM_FILE dbf, while (MYDBM_DPTR (key)) { cont = MYDBM_FETCH (dbf, key); #else /* BTREE */ - end = btree_nextkeydata (dbf, &key, &cont); + end = man_btree_nextkeydata (dbf, &key, &cont); while (!end) { #endif /* !BTREE */ char *tab; @@ -800,7 +800,7 @@ nextpage: #else /* BTREE */ MYDBM_FREE_DPTR (cont); MYDBM_FREE_DPTR (key); - end = btree_nextkeydata (dbf, &key, &cont); + end = man_btree_nextkeydata (dbf, &key, &cont); #endif /* !BTREE */ info.addr = NULL; /* == MYDBM_DPTR (cont), freed above */ free_mandata_elements (&info); |