Age | Commit message (Collapse) | Author | Files |
|
* src/gdbm.h.in (gdbm_errno_location): New extern
(gdbm_errno): Change to a define.
* src/gdbmerrno.c (gdbm_errno_location): New function.
(gdbm_errno_storage): Thread-safe storage for the last errno.
|
|
* src/parseopt.c (print_option_descr): Return if descr is NULL
or empty. Translate it using gettext.
All callers changed.
|
|
|
|
* src/Makefile.am: Add dependency for gram.h
Reported by Petr Ovtchenkov <ptr@void-ptr.info>
|
|
|
|
* src/mmap.c (_gdbm_internal_remap): Avoid munmapping NULL pointer.
Make sure mapped_region isn't a dangling pointer.
|
|
|
|
* doc/gdbm.texi: Remove description of GDBM_UNKNOWN_UPDATE.
Document GDBM_DIR_OVERFLOW.
* src/gdbm.h.in (GDBM_ERR_DIR_OVERFLOW): Rename to GDBM_DIR_OVERFLOW.
(GDBM_UNKNOWN_ERROR): New error code.
(GDBM_UNKNOWN_UPDATE): Define to GDBM_UNKNOWN_ERROR for
backward compatibility.
* src/gdbmerrno.c (gdbm_strerror, gdbm_db_strerror): Simplify a bit
|
|
* src/bucket.c (_gdbm_split_bucket): Avoid range error
when doubling directory size.
* src/gdbm.h.in (GDBM_ERR_DIR_OVERFLOW): New error code.
* src/gdbmerrno.c (gdbm_errlist): Describe GDBM_ERR_DIR_OVERFLOW.
|
|
* src/gdbm.magic: Explicitly handle big- and little-endian databases.
|
|
* src/bucket.c (_gdbm_read_bucket_at): Remove unused variable.
* src/debug.c: Include ctype.h
(datbuf_format): Don't use sprintf; Precede each output line
with data offset.
|
|
Use the GDBM_SET_ERRNO and GDBM_SET_ERRNO2 macros to make
sure the error gets reported in debug output.
* src/fullio.c (_gdbm_full_read)
(_gdbm_full_write): Return -1 and set gdbm_errno
on error.
* src/bucket.c: Use GDBM_SET_ERRNO(2?) or
GDBM_DEBUG where necessary.
* src/falloc.c: Likewise.
* src/findkey.c: Likewise.
* src/gdbmdefs.h: Likewise.
* src/gdbmopen.c: Likewise.
* src/gdbmstore.c: Likewise.
* src/mmap.c: Likewise.
* src/recover.c: Likewise.
* src/update.c: Likewise.
|
|
* src/gdbmdefs.h (GDBM_SET_ERRNO)
(GDBM_SET_ERRNO2): New macros.
* src/base64.c: Use new macros to set error state.
* src/bucket.c: Likewise.
* src/falloc.c: Likewise.
* src/findkey.c: Likewise.
* src/gdbm_load.c: Likewise.
* src/gdbmdelete.c: Likewise.
* src/gdbmdump.c: Likewise.
* src/gdbmexp.c: Likewise.
* src/gdbmfetch.c: Likewise.
* src/gdbmimp.c: Likewise.
* src/gdbmload.c: Likewise.
* src/gdbmopen.c: Likewise.
* src/gdbmseq.c: Likewise.
* src/gdbmsetopt.c: Likewise.
* src/gdbmstore.c: Likewise.
* src/gdbmtool.c: Fix preprocessor conditional.
|
|
* src/Makefile.am: Mark gdbm.h as noinst
* compat/Makefile.am (AM_CPPFLAGS): Make sure we pick up
../src/gdbm.h
|
|
* src/gdbmtool.c (open_handler): Close the previously
opened database.
(close_handler): Free the file name.
(print_dir_handler): Print the number of buckets.
(command_repeat_type): New enum.
(command) <repeat>: Change type to enum command_repeat_type.
(command_tab): Update accordingly. Mark "next" with REPEAT_NOARG.
(run_last_command): Handle REPEAT_NOARG separately.
* NEWS: Document the shortcut.
* doc/gdbm.texi: Likewise.
* src/debug.c (datbuf_format): Don't represent
bytes after the end of datum as zeros.
(gdbm_debug_datum): Print datum size.
|
|
* configure.ac: Fix description wording.
* src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Don't
define GDBM_DEBUG_ENABLE.
* tests/Makefile.am: Likewise.
* src/debug.c (gdbm_debug_printer)
(gdbm_debug_flags): New globals.
(gdbm_debug_token, gdbm_debug_parse_state)
(gdbm_debug_datum): New functions.
* src/gdbm.h.in [@GDBM_DEBUG_ENABLE@]: Define GDBM_DEBUG_ENABLE.
(gdbm_debug_printer_t): New typedef.
(gdbm_debug_printer, gdbm_debug_flags): New externs.
(GDBM_DEBUG_ERR,GDBM_DEBUG_OPEN)
(GDBM_DEBUG_READ,GDBM_DEBUG_STORE)
(GDBM_DEBUG_LOOKUP,GDBM_DEBUG_ALL): New defines.
(gdbm_debug_token,gdbm_debug_parse_state)
(gdbm_debug_datum): New protos.
* src/gdbmdefs.h (GDBM_DEBUG,GDBM_DEBUG_DATUM): New macros.
* src/findkey.c: Add debugging info.
* src/gdbmfetch.c: Likewise.
* src/gdbmopen.c: Likewise.
* src/gdbmseq.c: Likewise.
* src/gdbmstore.c: Likewise.
* src/gdbmtool.c (open_handler): Allow the use of ~/
(command) <repeat,variadic>: New members.
(run_command): Handle variadic functions.
(run_last_command): New command. In interactive mode,
repeats the last command if it was marked
with repeat=1 (currently, only "next").
New command: "debug".
(all functions): Use terror instead of fprintf(stderr,...);
* src/gdbmtool.h (handler_param) <vararg>: New member.
(run_last_command): New proto.
* src/gram.y: Call run_last_command) on empty input.
* tests/gtload.c: New option: -debug=
|
|
* configure.ac: New option --enable-debug
Print feature summary at the end of the run.
* src/debug.c: New file.
* src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Build debug.o
Define GDBM_DEBUG_ENABLE.
* src/gdbmdefs.h [GDBM_DEBUG_ENABLE] (_gdbm_debug_hook_install)
(_gdbm_debug_hook_remove,_gdbm_debug_hook_check)
(_gdbm_debug_hook_val): New protos.
(GDBM_DEBUG_HOOK, GDBM_DEBUG_OVERRIDE)
(GDBM_DEBUG_ALLOC): New defines.
* src/gdbm.h.in (GDBM_RCVR_FORCE): New flag.
* src/recover.c (gdbm_recover): Check database before attempting
recovery, unless GDBM_RCVR_FORCE flag is set.
* doc/gdbm.texi: Document GDBM_RCVR_FORCE
* src/gdbmreorg.c (gdbm_reorganize): Use GDBM_RCVR_FORCE.
* src/gdbmtool.c (main): Always allocate file_name.
* src/bucket.c: Put GDBM_DEBUG_OVERRIDE and GDBM_DEBUG_ALLOC
in critical places.
* src/falloc.c: Likewise.
* src/findkey.c: Likewise.
* src/gdbmopen.c: Likewise.
* src/gdbmstore.c: Likewise.
* src/update.c: Likewise.
* tests/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Define GDBM_DEBUG_ENABLE.
* tests/gtload.c: New options -hook, -recover, -verbose,
-backup, -max-failures, -max-failed-keys,
and -max-failed-buckets.
Attempt recovery after errors.
|
|
|
|
* NEWS: Document new features.
* doc/gdbm.texi: Likewise.
* src/gdbm.h.in (gdbm_last_errno): Fix return value.
(gdbm_check_syserr): New proto.
* src/gdbmdefs.h (gdbm_file_info) <last_error>: Fix data type.
* src/gdbmerrno.c (gdbm_last_errno): Fix return value.
(gdbm_check_syserr): New function.
|
|
* configure.ac: Don't check for rename.
* src/Makefile.am (libgdbm_la_SOURCES): Add recover.c
* src/recover.c: New file.
* src/bucket.c (_gdbm_get_bucket): Remove extra space before [
* src/err.c (prerror): Take additional argument
(gdbm_perror): Print system errno if necessary.
* src/gdbm.h.in (GDBM_CLOERROR): New flag.
(gdbm_fd_open, gdbm_copy_meta): New proto.
(gdbm_last_syserr,gdbm_db_strerror,gdbm_recover): New proto.
(gdbm_syserr): New extern.
(gdbm_recovery): New struct.
(GDBM_RCVR_DEFAULT,GDBM_RCVR_ERRFUN)
(GDBM_RCVR_MAX_FAILED_KEYS)
(GDBM_RCVR_MAX_FAILED_BUCKETS)
(GDBM_RCVR_MAX_FAILURES)
(GDBM_RCVR_BACKUP): New flags.
(GDBM_BACKUP_FAILED): New error code.
* src/gdbmclose.c (gdbm_close): Work correctly if dbf->desc == -1.
* src/gdbmcount.c (gdbm_count): Remove spurious sorting.
Use _gdbm_next_bucket_dir for iterating over the buckets.
* src/gdbmdefs.h (struct gdbm_file_info)<last_syserror>
<last_errstr>: New members.
* src/gdbmerrno.c (gdbm_set_errno): Set last_syserror as well.
(gdbm_clear_error): Reset last_syserror.
(gdbm_last_syserr): New function.
(gdbm_errlist): New entry for GDBM_BACKUP_FAILED.
(gdbm_db_strerror): New function.
(gdbm_syserr): New global.
* src/gdbmload.c (get_parms): Buffer can be NULL.
* src/gdbmopen.c (gdbm_fd_open): New function.
(gdbm_open): Rewrite as a wrapper over gdbm_fd_open.
* src/gdbmreorg.c (gdbm_reorganize): Rewrite as a wrapper
over gdbm_recover.
* src/proto.h (_gdbm_next_bucket_dir): New proto.
* src/gdbmtool.c: New command: recover.
* tests/.gitignore: Add gtrecover
* tests/gtrecover.c: New test program.
* tests/Makefile.am: Build gtrecover
|
|
|
|
* src/gdbm.h.in (GDBM_GETBLOCKSIZE): New option.
* src/gdbmcount.c (gdbm_count): Fix memory leak on
error.
* src/gdbmsetopt.c (gdbm_setopt): Rewrite.
Handle GDBM_GETBLOCKSIZE.
* NEWS: Document GDBM_GETBLOCKSIZE
* doc/gdbm.texi: Likewise.
* tests/gtload.c: New options -bsexact and -verbose.
* tests/Makefile.am: Add new testcases.
* tests/testsuite.at: Likewise.
* tests/blocksize00.at: New testcase.
* tests/blocksize01.at: Likewise.
* tests/blocksize02.at: Likewise.
|
|
directory offsets.
* src/gdbm.h.in (GDBM_BSEXACT): New flag.
* src/gdbmopen.c (compute_directory_size): New function.
(gdbm_open): When creating new database, adjust the requested
block size so that the block holds integer number of directory
indices. Disable this behavior if GDBM_BSEXACT flag is set
(this reverts to old behavior). Always unset GDBM_BSEXACT if
using block size returned by stat(2). This makes sure gdbm_open
succeeds on file systems reporting block sizes not divisible by
512.
* src/gdbmconst.h (GDBM_MIN_BLOCK_SIZE): New constant.
* src/gdbmimp.c (gdbm_import_from_file): Use GDBM_MIN_BLOCK_SIZE
instead of the hardcoded value.
* NEWS: Document GDBM_BSEXACT.
* doc/gdbm.texi: Likewise.
|
|
* src/gdbmconst.h (GDBM_HASH_BITS): New constant.
* src/bucket.c: Use GDBM_HASH_BITS instead of the
hardcoded value.
* src/findkey.c (_gdbm_findkey): Use _gdbm_hash_key.
* src/gdbmtool.c (hash_handler): Use _gdbm_hash_key if the
database is open.
* src/hash.c (_gdbm_bucket_dir, _gdbm_hash_key): New functions.
* src/proto.h (_gdbm_bucket_dir, _gdbm_hash_key): New protos.
* src/systems.h (STATBLKSIZE): Take a struct stat as argument.
* src/gdbmopen.c (STATBLKSIZE): Takes argument now.
|
|
* src/gdbmtool.c (format_key_start): New function.
(print_bucket): Take variadic arguments, use mesg
as prinf-style format.
Display first bytes of each non-empty key.
(print_current_bucket_begin): Avoid coredump if
gdbm_file is not initialized.
(print_current_bucket_handler): Change header depending on the
invoking command.
(hash_handler): In presence of a database, print also the
bucket number and offset within the bucket.
|
|
|
|
|
|
* src/gdbm.magic: Recognize dumpfiles.
|
|
* src/gdbm.magic: New file.
* README: Document existence of the magic file.
* src/Makefile.am (EXTRA_DIST): Add gdbm.magic.
|
|
* src/gdbmtool.h (PARAM_STRING, PARAM_DATUM)
(PARAM_KVPAIR): New defines.
* src/gdbmtool.c: Use above for accessing handler arguments.
|
|
* configure.ac: Check if GNU Readline is available.
* src/Makefile.am: Add new files.
* src/input-rl.c: New file.
* src/input-std.c: New file.
* src/gdbmtool.c (handler_param): Move declaration to
the header file.
(quit_handler): Call input_done.
(command_tab): Add the "history" command.
(command_generator): New function.
(slist_new_s, slist_new_l)
(slist_insert): New functions.
(main): Call input_init and input_done.
* src/gdbmtool.h: New protos.
* src/gram.y: Use slist_insert to construct string lists.
* src/lex.l (read_input): Remove. Use input_read instead.
(print_prompt_at_bol): New function.
(print_prompt): Remove.
(make_prompt): New function.
* NEWS: Document changes.
* README: Document readline support.
* doc/gdbm.texi: Document line editing in gdbmtool.
* doc/gdbmtool.1: Likewise.
|
|
* src/bucket.c (_gdbm_get_bucket)
(_gdbm_split_bucket, _gdbm_write_bucket): Return error code. All callers
updated.
* src/proto.h (_gdbm_get_bucket)
(_gdbm_split_bucket, _gdbm_write_bucket): Update declarations
* src/falloc.c (push_avail_block)
(pop_avail_block): Return error code. All callers
updated.
* src/update.c (_gdbm_fatal): Exit only if the user defined
fatal_err function.
* src/gdbmerrno.c (gdbm_needs_recovery): New function.
* src/gdbm.h.in (gdbm_needs_recovery): New proto.
* compat/dbminit.c: Set gdbm_errno on fatal errors.
* compat/dbmopen.c: Likewise.
* src/findkey.c: Likewise.
* src/gdbm_load.c: Likewise.
* src/gdbmcount.c: Likewise.
* src/gdbmdefs.h: Likewise.
* src/gdbmdelete.c: Likewise.
* src/gdbmdump.c: Likewise.
* src/gdbmexists.c: Likewise.
* src/gdbmexp.c: Likewise.
* src/gdbmfetch.c: Likewise.
* src/gdbmimp.c: Likewise.
* src/gdbmload.c: Likewise.
* src/gdbmopen.c: Likewise.
* src/gdbmreorg.c: Likewise.
* src/gdbmseq.c: Likewise.
* src/gdbmsetopt.c: Likewise.
* src/gdbmstore.c: Likewise.
* src/gdbmsync.c: Likewise.
* src/mmap.c: Likewise.
|
|
(needs recovery).
* src/gdbm.h.in (GDBM_NEED_RECOVERY): New error code.
* src/gdbmdefs.h (GDBM_ASSERT_CONSISTENCY): New macro.
* src/gdbmerrno.c: Update.
* src/gdbmopen.c (gdbm_open): Initialize need_recovery
and last_error.
* src/gdbmcount.c (gdbm_count): Return immediately if the
database needs recovery.
* src/gdbmdelete.c (gdbm_delete): Likewise.
* src/gdbmdump.c (gdbm_dump_to_file, gdbm_dump): Likewise.
* src/gdbmexists.c (gdbm_exists): Likewise.
* src/gdbmexp.c (gdbm_export_to_file): Likewise.
* src/gdbmfetch.c (gdbm_fetch): Likewise.
* src/gdbmimp.c (gdbm_import_from_file): Likewise.
* src/gdbmreorg.c (gdbm_reorganize): Likewise.
* src/gdbmseq.c (gdbm_firstkey): Likewise.
* src/gdbmsetopt.c (gdbm_nextkey): Likewise.
* src/gdbmstore.c (gdbm_store): Likewise.
* src/gdbmsync.c (gdbm_sync): Likewise.
|
|
|
|
Last error code is stored in the database file structure as
well as in the global gdbm_errno. Special functions are provided
for retrieving and clearing the last error state.
* src/gdbmdefs.h (gdbm_file_info): New member: last_error
* src/gdbm.h.in (gdbm_last_errno, gdbm_set_errno)
(gdbm_clear_error): New protos.
* src/gdbmerrno.c (gdbm_last_errno, gdbm_set_errno)
(gdbm_clear_error): New functions
* NEWS: Update.
* compat/dbminit.c: Use gdbm_set_errno to set error state.
* compat/dbmopen.c: Likewise.
* src/bucket.c: Likewise.
* src/findkey.c: Likewise.
* src/gdbm_load.c: Likewise.
* src/gdbmcount.c: Likewise.
* src/gdbmdelete.c: Likewise.
* src/gdbmdump.c: Likewise.
* src/gdbmexists.c: Likewise.
* src/gdbmexp.c: Likewise.
* src/gdbmfetch.c: Likewise.
* src/gdbmimp.c: Likewise.
* src/gdbmload.c: Likewise.
* src/gdbmopen.c: Likewise.
* src/gdbmreorg.c: Likewise.
* src/gdbmseq.c: Likewise.
* src/gdbmsetopt.c: Likewise.
* src/gdbmstore.c: Likewise.
* src/gdbmsync.c: Likewise.
* src/mmap.c: Likewise.
|
|
|
|
* doc/gdbm.texi: Document gdbm_exists in detail.
* src/findkey.c (_gdbm_findkey): return parameters can be
NULL.
* src/gdbmexists.c (gdbm_exists): Remove unnecessary
local variables. Reset gdbm_errno to 0 if the key was
not found.
* src/gdbmdelete.c (gdbm_delete): Remove unnecessary
local variables.
* src/gdbmfetch.c: Likewise.
* src/gdbmseq.c: Likewise.
* src/gdbmstore.c: Likewise.
|
|
* src/gdbmfetch.c: Hanlde out of memory error.
* src/findkey.c: Set gdbm_errno to GDBM_ITEM_NOT_FOUND
if nothing was found.
* src/gdbmdelete.c: Don't set gdbm_errno after
_gdbm_findkey returns -1. It's been done already.
* src/gdbmexp.c (gdbm_export_to_file): Return -1 if
gdbm_fetch fails.
* src/gdbmseq.c (get_next_key): Set gdbm_errno to
GDBM_ITEM_NOT_FOUND if there's no next key.
Don't call _gdbm_fatal on out of memory condition.
(gdbm_nextkey): Set gdbm_errno to
GDBM_ITEM_NOT_FOUND if there's no next key.
* src/gdbmtool.c (fetch_handler)
(firstkey_handler,nextkey_handler): Check gdbm_errno.
* src/gdbmstore.c: Handle error return from _gdbm_findkey.
* tests/gtdump.c: Likewise.
* tests/gtfetch.c: Likewise.
* doc/gdbm.texi: Document changes.
* doc/gdbm.3: Likewise.
* configure.ac: Version 1.12.90
* NEWS: Update.
* .gitignore: Update.
|
|
|
|
|
|
* src/gdbmtool.c (_gdbm_print_bucket_cache): Use %zu to print
size_t.
* src/gdbmtool.h (variable_unset): New proto.
(yyerror): Argument is char const *.
src/gram.y: Likewise.
* src/lex.l: Add option noinput
* src/parseopt.c (print_option_descr): Use fwrite instead of
printf.
* src/var.c: Fix initializers to suppress warnings.
|
|
|
|
|
|
* doc/Config: Rewrite.
* doc/Makefile.am: Use Makeinfo 5 instead of texi2htm
* doc/gendocs_template: Ps is not built
* imprimatur: Upgrade.
|
|
* src/lex.l (expand_char): Don't return any value.
|
|
* THANKS: Add Thomas Klausner.
* src/gdbmtool.h: Rename ARG_ constants to GDBM_ARG_
* src/gdbmtool.c: Likewise.
* tests/create00.at: Use modern sort -k syntax.
* tests/dbmcreate00.at: Likewise.
* tests/dbmdel00.at: Likewise.
* tests/delete00.at: Likewise.
|
|
|
|
|
|
* src/gdbm_load.c: New options: --mmap, --cache-size and --block-size.
* doc/gdbm.texinfo: Document new gdbm_load options.
* doc/gdbm_load.1: Likewise.
* src/gdbmdelete.c: Stylistic changes.
* src/gdbmstore.c: Likewise.
|
|
* configure.ac: Check for unsigned long long, define
substitution variable GDBM_COUNT_T.
* src/gdbmcount.c: New file.
* src/Makefile.am (libgdbm_la_SOURCES): Add gdbmcount.c.
* src/bucket.c (_gdbm_read_bucket_at): New function.
* src/gdbm.h.in (gdbm_count_t): New typedef.
(gdbm_count): New proto.
* src/gdbmdefs.h (GDBM_DIR_COUNT): New define.
* src/proto.h (_gdbm_read_bucket_at): New proto.
* src/var.c: New variable "filemode".
* src/gdbmtool.c: Use gdbm_count. Various bugfixes.
* NEWS: Update.
* doc/gdbm.texinfo: Update.
|