aboutsummaryrefslogtreecommitdiff
path: root/src/gdbmcount.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-07-09 08:40:04 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2016-07-09 08:47:16 +0300
commit479a469033903a76b9c073806037dd66176f3da0 (patch)
tree2841b611288f9343868e6ded82909b096a62e121 /src/gdbmcount.c
parent2efd8358711ab3ea6c0ecaab75d195837b4b3e37 (diff)
downloadgdbm-479a469033903a76b9c073806037dd66176f3da0.tar.gz
gdbm-479a469033903a76b9c073806037dd66176f3da0.tar.bz2
Per-database error state.
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.
Diffstat (limited to 'src/gdbmcount.c')
-rw-r--r--src/gdbmcount.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gdbmcount.c b/src/gdbmcount.c
index 8e22213..17016b2 100644
--- a/src/gdbmcount.c
+++ b/src/gdbmcount.c
@@ -1,7 +1,8 @@
/* 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 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 2007, 2011, 2013,
+ 2016 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
@@ -42,7 +43,7 @@ gdbm_count (GDBM_FILE dbf, gdbm_count_t *pcount)
sdir = malloc (dbf->header->dir_size);
if (!sdir)
{
- gdbm_errno = GDBM_MALLOC_ERROR;
+ gdbm_set_errno (dbf, GDBM_MALLOC_ERROR, 0);
return -1;
}

Return to:

Send suggestions and report system problems to the System administrator.