summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2011-08-01 11:22:50 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-08-01 11:22:50 (GMT)
commita5088330ed9d2e672152b81720f3f35ad15a3bce (patch) (side-by-side diff)
treedee3cdcf3719c3c80ace9ca7ac75a65282587fff
parente11023671fa3e05c404d1277a6fe6855c79ce923 (diff)
downloadgdbm-a5088330ed9d2e672152b81720f3f35ad15a3bce.tar.gz
gdbm-a5088330ed9d2e672152b81720f3f35ad15a3bce.tar.bz2
Use GDBM_FILE instead of gdbm_file_info *.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog45
-rw-r--r--compat/dbmclose.c2
-rw-r--r--compat/dbmdelete.c2
-rw-r--r--compat/dbmdirfno.c2
-rw-r--r--compat/dbmfetch.c2
-rw-r--r--compat/dbmopen.c21
-rw-r--r--compat/dbmpagfno.c2
-rw-r--r--compat/dbmrdonly.c2
-rw-r--r--compat/dbmseq.c4
-rw-r--r--compat/dbmstore.c2
-rw-r--r--src/bucket.c8
-rw-r--r--src/extern.h2
-rw-r--r--src/falloc.c20
-rw-r--r--src/findkey.c4
-rw-r--r--src/flatfile.c5
-rw-r--r--src/gdbmclose.c2
-rw-r--r--src/gdbmdelete.c3
-rw-r--r--src/gdbmexists.c3
-rw-r--r--src/gdbmfdesc.c2
-rw-r--r--src/gdbmfetch.c3
-rw-r--r--src/gdbmreorg.c5
-rw-r--r--src/gdbmseq.c9
-rw-r--r--src/gdbmsetopt.c3
-rw-r--r--src/gdbmstore.c3
-rw-r--r--src/gdbmsync.c3
-rw-r--r--src/global.c3
-rw-r--r--src/lock.c7
-rw-r--r--src/mmap.c19
-rw-r--r--src/testgdbm.c7
-rw-r--r--src/update.c8
30 files changed, 120 insertions, 83 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e73b14..b1b789f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,48 @@
+2011-08-01 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * Makefile.am (ACLOCAL_AMFLAGS): New variable.
+ * configure.ac: Use AM_INIT_AUTOMAKE with arguments.
+
+ * src/gdbm.proto (GDBM_FILE): Change typedef.
+ * src/gdbmdefs.h: Include gdbm.h
+ (datum): Remove duplicate declaration.
+ (gdbm_file_info): Change to struct gdbm_file_info
+
+ * src/proto.h: Use GDBM_FILE instead of gdbm_file_info *.
+ Remove duplicate declarations.
+
+ * src/gdbmopen.c: Use GDBM_FILE instead of gdbm_file_info *.
+ (gdbm_open): Fix signature to match global declaration.
+
+ * compat/dbmclose.c: Use GDBM_FILE instead of gdbm_file_info *.
+ * compat/dbmdirfno.c: Likewise.
+ * compat/dbmfetch.c: Likewise.
+ * compat/dbmopen.c: Likewise.
+ * compat/dbmpagfno.c: Likewise.
+ * compat/dbmrdonly.c: Likewise.
+ * compat/dbmseq.c: Likewise.
+ * compat/dbmstore.c: Likewise.
+ * src/bucket.c: Likewise.
+ * src/extern.h: Likewise.
+ * src/falloc.c: Likewise.
+ * src/findkey.c: Likewise.
+ * src/flatfile.c: Likewise.
+ * src/gdbmclose.c: Likewise.
+ * src/gdbmdelete.c: Likewise.
+ * src/gdbmexists.c: Likewise.
+ * src/gdbmfdesc.c: Likewise.
+ * src/gdbmfetch.c: Likewise.
+ * src/gdbmreorg.c: Likewise.
+ * src/gdbmseq.c: Likewise.
+ * src/gdbmsetopt.c: Likewise.
+ * src/gdbmstore.c: Likewise.
+ * src/gdbmsync.c: Likewise.
+ * src/global.c: Likewise.
+ * src/lock.c: Likewise.
+ * src/mmap.c: Likewise.
+ * src/testgdbm.c: Likewise.
+ * src/update.c: Likewise.
+
2009-01-03 Sergey Poznyakoff <gray@gnu.org.ua>
* configure.ac: Update bug-reporting address.
diff --git a/compat/dbmclose.c b/compat/dbmclose.c
index 30626cc..c0c3f61 100644
--- a/compat/dbmclose.c
+++ b/compat/dbmclose.c
@@ -26,7 +26,7 @@
/* Close the DBF file. */
void
-dbm_close (gdbm_file_info *dbf)
+dbm_close (GDBM_FILE dbf)
{
gdbm_close (dbf);
}
diff --git a/compat/dbmdelete.c b/compat/dbmdelete.c
index f5b5d6b..c24d053 100644
--- a/compat/dbmdelete.c
+++ b/compat/dbmdelete.c
@@ -28,7 +28,7 @@
/* Remove the KEYed item and the KEY from the database DBF. */
int
-dbm_delete (gdbm_file_info *dbf, datum key)
+dbm_delete (GDBM_FILE dbf, datum key)
{
return gdbm_delete (dbf,key);
}
diff --git a/compat/dbmdirfno.c b/compat/dbmdirfno.c
index ae22cc2..79d9c24 100644
--- a/compat/dbmdirfno.c
+++ b/compat/dbmdirfno.c
@@ -27,7 +27,7 @@
file number. Since we have only one file number, we return it. */
int
-dbm_dirfno (gdbm_file_info *dbf)
+dbm_dirfno (GDBM_FILE dbf)
{
return (dbf->desc);
}
diff --git a/compat/dbmfetch.c b/compat/dbmfetch.c
index bb650a4..54784c4 100644
--- a/compat/dbmfetch.c
+++ b/compat/dbmfetch.c
@@ -29,7 +29,7 @@
dynamically allocated memory block. */
datum
-dbm_fetch (gdbm_file_info *dbf, datum key)
+dbm_fetch (GDBM_FILE dbf, datum key)
{
datum ret_val; /* The return value. */
diff --git a/compat/dbmopen.c b/compat/dbmopen.c
index 257da77..309d08f 100644
--- a/compat/dbmopen.c
+++ b/compat/dbmopen.c
@@ -42,15 +42,15 @@
a GDBM_NEWDB. All other values of FLAGS in the flags are
ignored. */
-gdbm_file_info *
+GDBM_FILE
dbm_open (char *file, int flags, int mode)
{
char* pag_file; /* Used to construct "file.pag". */
char* dir_file; /* Used to construct "file.dir". */
struct stat dir_stat; /* Stat information for "file.dir". */
- gdbm_file_info *temp_dbf; /* Temporary file pointer storage. */
-
-
+ GDBM_FILE temp_dbf; /* Temporary file pointer storage. */
+ int open_flags;
+
/* Prepare the correct names of "file.pag" and "file.dir". */
pag_file = (char *) malloc (strlen (file)+5);
dir_file = (char *) malloc (strlen (file)+5);
@@ -68,23 +68,28 @@ dbm_open (char *file, int flags, int mode)
/* Call the actual routine, saving the pointer to the file information. */
flags &= O_RDONLY | O_RDWR | O_CREAT | O_TRUNC;
+
if (flags == O_RDONLY)
{
- temp_dbf = gdbm_open (pag_file, 0, GDBM_READER, 0, NULL);
+ open_flags = GDBM_READER;
+ mode = 0;
}
else if (flags == (O_RDWR | O_CREAT))
{
- temp_dbf = gdbm_open (pag_file, 0, GDBM_WRCREAT, mode, NULL);
+ open_flags = GDBM_WRCREAT;
}
else if ( (flags & O_TRUNC) == O_TRUNC)
{
- temp_dbf = gdbm_open (pag_file, 0, GDBM_NEWDB, mode, NULL);
+ open_flags = GDBM_NEWDB;
}
else
{
- temp_dbf = gdbm_open (pag_file, 0, GDBM_WRITER, 0, NULL);
+ open_flags = GDBM_WRITER;
+ mode = 0;
}
+ temp_dbf = gdbm_open (pag_file, 0, open_flags | GDBM_NOLOCK, mode, NULL);
+
/* Did we successfully open the file? */
if (temp_dbf == NULL)
{
diff --git a/compat/dbmpagfno.c b/compat/dbmpagfno.c
index ae9d8cb..8532c03 100644
--- a/compat/dbmpagfno.c
+++ b/compat/dbmpagfno.c
@@ -27,7 +27,7 @@
file number. Since we have only one file number, we return it. */
int
-dbm_pagfno (gdbm_file_info *dbf)
+dbm_pagfno (GDBM_FILE dbf)
{
return (dbf->desc);
}
diff --git a/compat/dbmrdonly.c b/compat/dbmrdonly.c
index 14d89c7..33e3274 100644
--- a/compat/dbmrdonly.c
+++ b/compat/dbmrdonly.c
@@ -26,7 +26,7 @@
/* not much of a routine, but should be a function for compatibility. */
int
-dbm_rdonly(gdbm_file_info *dbf)
+dbm_rdonly(GDBM_FILE dbf)
{
return (dbf->read_write == GDBM_READER);
}
diff --git a/compat/dbmseq.c b/compat/dbmseq.c
index d702241..7e1bed5 100644
--- a/compat/dbmseq.c
+++ b/compat/dbmseq.c
@@ -30,7 +30,7 @@
information pointer. */
datum
-dbm_firstkey (gdbm_file_info *dbf)
+dbm_firstkey (GDBM_FILE dbf)
{
datum ret_val;
@@ -49,7 +49,7 @@ dbm_firstkey (gdbm_file_info *dbf)
DBF is the file information pointer. */
datum
-dbm_nextkey (gdbm_file_info *dbf)
+dbm_nextkey (GDBM_FILE dbf)
{
datum ret_val;
diff --git a/compat/dbmstore.c b/compat/dbmstore.c
index ac102ea..9d904ff 100644
--- a/compat/dbmstore.c
+++ b/compat/dbmstore.c
@@ -29,7 +29,7 @@
database before returning from this procedure. */
int
-dbm_store (gdbm_file_info *dbf, datum key, datum content, int flags)
+dbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
{
return gdbm_store (dbf, key, content, flags);
}
diff --git a/src/bucket.c b/src/bucket.c
index 2374d07..65a5405 100644
--- a/src/bucket.c
+++ b/src/bucket.c
@@ -25,7 +25,7 @@
/* Initializing a new hash buckets sets all bucket entries to -1 hash value. */
void
-_gdbm_new_bucket (gdbm_file_info *dbf, hash_bucket *bucket, int bits)
+_gdbm_new_bucket (GDBM_FILE dbf, hash_bucket *bucket, int bits)
{
int index;
@@ -50,7 +50,7 @@ _gdbm_new_bucket (gdbm_file_info *dbf, hash_bucket *bucket, int bits)
and dbf->bucket points to the correct bucket. */
void
-_gdbm_get_bucket (gdbm_file_info *dbf, int dir_index)
+_gdbm_get_bucket (GDBM_FILE dbf, int dir_index)
{
off_t bucket_adr; /* The address of the correct hash bucket. */
int num_bytes; /* The number of bytes read. */
@@ -110,7 +110,7 @@ _gdbm_get_bucket (gdbm_file_info *dbf, int dir_index)
are stored in the buckets. Splitting the current bucket may require
doubling the size of the hash directory. */
void
-_gdbm_split_bucket (gdbm_file_info *dbf, int next_insert)
+_gdbm_split_bucket (GDBM_FILE dbf, int next_insert)
{
hash_bucket *bucket[2]; /* Pointers to the new buckets. */
@@ -301,7 +301,7 @@ _gdbm_split_bucket (gdbm_file_info *dbf, int next_insert)
cache entry containing the bucket to be written. */
void
-_gdbm_write_bucket (gdbm_file_info *dbf, cache_elem *ca_entry)
+_gdbm_write_bucket (GDBM_FILE dbf, cache_elem *ca_entry)
{
int num_bytes; /* The return value for write. */
off_t file_pos; /* The return value for lseek. */
diff --git a/src/extern.h b/src/extern.h
index 86029f1..43f180d 100644
--- a/src/extern.h
+++ b/src/extern.h
@@ -18,7 +18,7 @@
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
/* The global variables used for the "original" interface. */
-extern gdbm_file_info *_gdbm_file;
+extern GDBM_FILE _gdbm_file;
/* Memory for return data for the "original" interface. */
extern datum _gdbm_memory;
diff --git a/src/falloc.c b/src/falloc.c
index e18f597..27b7ba0 100644
--- a/src/falloc.c
+++ b/src/falloc.c
@@ -27,10 +27,10 @@
the definition of the function. */
static avail_elem get_elem (int, avail_elem [], int *);
-static avail_elem get_block (int, gdbm_file_info *);
-static void push_avail_block (gdbm_file_info *);
-static void pop_avail_block (gdbm_file_info *);
-static void adjust_bucket_avail (gdbm_file_info *);
+static avail_elem get_block (int, GDBM_FILE);
+static void push_avail_block (GDBM_FILE);
+static void pop_avail_block (GDBM_FILE);
+static void adjust_bucket_avail (GDBM_FILE);
/* Allocate space in the file DBF for a block NUM_BYTES in length. Return
the file address of the start of the block.
@@ -49,7 +49,7 @@ static void adjust_bucket_avail (gdbm_file_info *);
the value of 0 will be returned. */
off_t
-_gdbm_alloc (gdbm_file_info *dbf, int num_bytes)
+_gdbm_alloc (GDBM_FILE dbf, int num_bytes)
{
off_t file_adr; /* The address of the block. */
avail_elem av_el; /* For temporary use. */
@@ -97,7 +97,7 @@ _gdbm_alloc (gdbm_file_info *dbf, int num_bytes)
avail structure. */
void
-_gdbm_free (gdbm_file_info *dbf, off_t file_adr, int num_bytes)
+_gdbm_free (GDBM_FILE dbf, off_t file_adr, int num_bytes)
{
avail_elem temp;
@@ -156,7 +156,7 @@ _gdbm_free (gdbm_file_info *dbf, off_t file_adr, int num_bytes)
smart about things. */
static void
-pop_avail_block (gdbm_file_info *dbf)
+pop_avail_block (GDBM_FILE dbf)
{
int num_bytes; /* For use with the read system call. */
off_t file_pos; /* For use with the lseek system call. */
@@ -231,7 +231,7 @@ pop_avail_block (gdbm_file_info *dbf)
/* Splits the header avail block and pushes half onto the avail stack. */
static void
-push_avail_block (gdbm_file_info *dbf)
+push_avail_block (GDBM_FILE dbf)
{
int num_bytes;
int av_size;
@@ -412,7 +412,7 @@ _gdbm_put_av_elem (avail_elem new_el, avail_elem av_table[], int *av_count,
no I/O. */
static avail_elem
-get_block (int size, gdbm_file_info *dbf)
+get_block (int size, GDBM_FILE dbf)
{
avail_elem val;
@@ -438,7 +438,7 @@ get_block (int size, gdbm_file_info *dbf)
/* When the header already needs writing, we can make sure the current
bucket has its avail block as close to 1/3 full as possible. */
static void
-adjust_bucket_avail (gdbm_file_info *dbf)
+adjust_bucket_avail (GDBM_FILE dbf)
{
int third = BUCKET_AVAIL / 3;
avail_elem av_el;
diff --git a/src/findkey.c b/src/findkey.c
index e1ca476..56a2c9d 100644
--- a/src/findkey.c
+++ b/src/findkey.c
@@ -27,7 +27,7 @@
return a pointer to it. Also, cache the read value. */
char *
-_gdbm_read_entry (gdbm_file_info *dbf, int elem_loc)
+_gdbm_read_entry (GDBM_FILE dbf, int elem_loc)
{
int num_bytes; /* For seeking and reading. */
int key_size;
@@ -75,7 +75,7 @@ _gdbm_read_entry (gdbm_file_info *dbf, int elem_loc)
in DPTR. If it is not found, the value -1 is returned. Since find
key computes the hash value of key, that value */
int
-_gdbm_findkey (gdbm_file_info *dbf, datum key, char **dptr, int *new_hash_val)
+_gdbm_findkey (GDBM_FILE dbf, datum key, char **dptr, int *new_hash_val)
{
int bucket_hash_val; /* The hash value from the bucket. */
char *file_key; /* The complete key as stored in the file. */
diff --git a/src/flatfile.c b/src/flatfile.c
index 4d182d8..4589864 100644
--- a/src/flatfile.c
+++ b/src/flatfile.c
@@ -23,13 +23,12 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
#include "extern.h"
extern const char * gdbm_version;
int
-gdbm_export (gdbm_file_info *dbf, const char *exportfile, int flags, int mode)
+gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
#else
int
gdbm_export (GDBM_FILE dbf, const char *exportfile, int flags, int mode)
@@ -117,7 +116,7 @@ write_fail:
#ifndef _GDBMEXPORT_
int
-gdbm_import (gdbm_file_info *dbf, const char *importfile, int flag)
+gdbm_import (GDBM_FILE dbf, const char *importfile, int flag)
{
int ifd, seenbang, seennewline, rsize, size, kbufsize, dbufsize, rret;
char c, *kbuffer, *dbuffer;
diff --git a/src/gdbmclose.c b/src/gdbmclose.c
index c9ddf0f..24b92d0 100644
--- a/src/gdbmclose.c
+++ b/src/gdbmclose.c
@@ -27,7 +27,7 @@
allocated. */
void
-gdbm_close (gdbm_file_info *dbf)
+gdbm_close (GDBM_FILE dbf)
{
int index; /* For freeing the bucket cache. */
diff --git a/src/gdbmdelete.c b/src/gdbmdelete.c
index 0227334..2226c2d 100644
--- a/src/gdbmdelete.c
+++ b/src/gdbmdelete.c
@@ -21,14 +21,13 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
/* Remove the KEYed item and the KEY from the database DBF. The file on disk
is updated to reflect the structure of the new database before returning
from this procedure. */
int
-gdbm_delete (gdbm_file_info *dbf, datum key)
+gdbm_delete (GDBM_FILE dbf, datum key)
{
int elem_loc; /* The location in the current hash bucket. */
int last_loc; /* Last location emptied by the delete. */
diff --git a/src/gdbmexists.c b/src/gdbmexists.c
index 74da121..b1fb4cf 100644
--- a/src/gdbmexists.c
+++ b/src/gdbmexists.c
@@ -21,13 +21,12 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
/* This is nothing more than a wrapper around _gdbm_findkey(). The
point? It doesn't alloate any memory. */
int
-gdbm_exists (gdbm_file_info *dbf, datum key)
+gdbm_exists (GDBM_FILE dbf, datum key)
{
char *find_data; /* Dummy */
int hash_val; /* Dummy */
diff --git a/src/gdbmfdesc.c b/src/gdbmfdesc.c
index 67e8b89..152b5b2 100644
--- a/src/gdbmfdesc.c
+++ b/src/gdbmfdesc.c
@@ -25,7 +25,7 @@
/* Return the file number of the DBF file. */
int
-gdbm_fdesc(gdbm_file_info *dbf)
+gdbm_fdesc(GDBM_FILE dbf)
{
return (dbf->desc);
}
diff --git a/src/gdbmfetch.c b/src/gdbmfetch.c
index 3cd868e..a3749ae 100644
--- a/src/gdbmfetch.c
+++ b/src/gdbmfetch.c
@@ -21,14 +21,13 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
/* Look up a given KEY and return the information associated with that KEY.
The pointer in the structure that is returned is a pointer to dynamically
allocated memory block. */
datum
-gdbm_fetch (gdbm_file_info *dbf, datum key)
+gdbm_fetch (GDBM_FILE dbf, datum key)
{
datum return_val; /* The return value. */
int elem_loc; /* The location in the bucket. */
diff --git a/src/gdbmreorg.c b/src/gdbmreorg.c
index fccffff..797d75a 100644
--- a/src/gdbmreorg.c
+++ b/src/gdbmreorg.c
@@ -21,7 +21,6 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
#include "extern.h"
#if !HAVE_RENAME
@@ -58,9 +57,9 @@ _gdbm_rename (char *old_name, char *new_name)
after a successful reorganization. */
int
-gdbm_reorganize (gdbm_file_info *dbf)
+gdbm_reorganize (GDBM_FILE dbf)
{
- gdbm_file_info *new_dbf; /* The new file. */
+ GDBM_FILE new_dbf; /* The new file. */
char *new_name; /* A temporary name. */
int len; /* Used in new_name construction. */
datum key, nextkey, data; /* For the sequential sweep. */
diff --git a/src/gdbmseq.c b/src/gdbmseq.c
index 2fe7b3c..59c05cd 100644
--- a/src/gdbmseq.c
+++ b/src/gdbmseq.c
@@ -21,10 +21,9 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
/* Special extern for this file. */
-extern char *_gdbm_read_entry (gdbm_file_info *, int);
+extern char *_gdbm_read_entry (GDBM_FILE , int);
/* Find and read the next entry in the hash structure for DBF starting
@@ -32,7 +31,7 @@ extern char *_gdbm_read_entry (gdbm_file_info *, int);
put the data that is found. */
static void
-get_next_key (gdbm_file_info *dbf, int elem_loc, datum *return_val)
+get_next_key (GDBM_FILE dbf, int elem_loc, datum *return_val)
{
int found; /* Have we found the next key. */
char *find_data; /* Data pointer returned by find_key. */
@@ -80,7 +79,7 @@ get_next_key (gdbm_file_info *dbf, int elem_loc, datum *return_val)
hash order, not in any sorted order. */
datum
-gdbm_firstkey (gdbm_file_info *dbf)
+gdbm_firstkey (GDBM_FILE dbf)
{
datum return_val; /* To return the first key. */
@@ -103,7 +102,7 @@ gdbm_firstkey (gdbm_file_info *dbf)
/* Continue visiting all keys. The next key following KEY is returned. */
datum
-gdbm_nextkey (gdbm_file_info *dbf, datum key)
+gdbm_nextkey (GDBM_FILE dbf, datum key)
{
datum return_val; /* The return value. */
int elem_loc; /* The location in the bucket. */
diff --git a/src/gdbmsetopt.c b/src/gdbmsetopt.c
index 7280163..5c7fbbd 100644
--- a/src/gdbmsetopt.c
+++ b/src/gdbmsetopt.c
@@ -21,13 +21,12 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
/* operate on an already open descriptor. */
/* ARGSUSED */
int
-gdbm_setopt(gdbm_file_info *dbf, int optflag, int *optval, int optlen)
+gdbm_setopt(GDBM_FILE dbf, int optflag, int *optval, int optlen)
{
switch(optflag)
{
diff --git a/src/gdbmstore.c b/src/gdbmstore.c
index cc2bee7..26874fe 100644
--- a/src/gdbmstore.c
+++ b/src/gdbmstore.c
@@ -21,7 +21,6 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
/* Add a new element to the database. CONTENT is keyed by KEY. The
@@ -37,7 +36,7 @@
the database. */
int
-gdbm_store (gdbm_file_info *dbf, datum key, datum content, int flags)
+gdbm_store (GDBM_FILE dbf, datum key, datum content, int flags)
{
int new_hash_val; /* The new hash value. */
int elem_loc; /* The location in hash bucket. */
diff --git a/src/gdbmsync.c b/src/gdbmsync.c
index 74e8c25..9b7c326 100644
--- a/src/gdbmsync.c
+++ b/src/gdbmsync.c
@@ -21,12 +21,11 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
/* Make sure the database is all on disk. */
void
-gdbm_sync (gdbm_file_info *dbf)
+gdbm_sync (GDBM_FILE dbf)
{
/* Initialize the gdbm_errno variable. */
diff --git a/src/global.c b/src/global.c
index e53db3f..b5e4279 100644
--- a/src/global.c
+++ b/src/global.c
@@ -22,11 +22,10 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
/* The global variables used for the "original" interface. */
-gdbm_file_info *_gdbm_file = NULL;
+GDBM_FILE _gdbm_file = NULL;
/* Memory for return data for the "original" interface. */
datum _gdbm_memory = {NULL, 0}; /* Used by firstkey and nextkey. */
diff --git a/src/lock.c b/src/lock.c
index 9f40f4f..062ac0c 100644
--- a/src/lock.c
+++ b/src/lock.c
@@ -21,7 +21,6 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
#include "extern.h"
#include <errno.h>
@@ -52,14 +51,14 @@
#if 0
int
-gdbm_locked (gdbm_file_info *dbf)
+gdbm_locked (GDBM_FILE dbf)
{
return (dbf->lock_type != LOCKING_NONE);
}
#endif
void
-_gdbm_unlock_file (gdbm_file_info *dbf)
+_gdbm_unlock_file (GDBM_FILE dbf)
{
#if HAVE_FCNTL_LOCK
struct flock fl;
@@ -94,7 +93,7 @@ _gdbm_unlock_file (gdbm_file_info *dbf)
/* Try each supported locking mechanism. */
int
-_gdbm_lock_file (gdbm_file_info *dbf)
+_gdbm_lock_file (GDBM_FILE dbf)
{
#if HAVE_FCNTL_LOCK
struct flock fl;
diff --git a/src/mmap.c b/src/mmap.c
index 1e420e2..46292ea 100644
--- a/src/mmap.c
+++ b/src/mmap.c
@@ -20,7 +20,6 @@
#if HAVE_MMAP
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -54,7 +53,7 @@
/* Store the size of the GDBM file DBF in *PSIZE.
Return 0 on success and -1 on failure. */
int
-_gdbm_file_size (gdbm_file_info *dbf, off_t *psize)
+_gdbm_file_size (GDBM_FILE dbf, off_t *psize)
{
struct stat sb;
if (fstat (dbf->desc, &sb))
@@ -65,7 +64,7 @@ _gdbm_file_size (gdbm_file_info *dbf, off_t *psize)
/* Unmap the region. Reset all mapped_ fields to initial values. */
void
-_gdbm_mapped_unmap (gdbm_file_info *dbf)
+_gdbm_mapped_unmap (GDBM_FILE dbf)
{
if (dbf->mapped_region)
{
@@ -83,7 +82,7 @@ _gdbm_mapped_unmap (gdbm_file_info *dbf)
Take care to recompute {mapped_off,mapped_pos} so that the former lies
on a page size boundary. */
int
-_gdbm_internal_remap (gdbm_file_info *dbf)
+_gdbm_internal_remap (GDBM_FILE dbf)
{
void *p;
int flags = PROT_READ;
@@ -115,7 +114,7 @@ _gdbm_internal_remap (gdbm_file_info *dbf)
Otherwise, trim SIZE to the actual size of the file.
Return 0 on success, -1 on failure. */
int
-_gdbm_mapped_remap (gdbm_file_info *dbf, off_t size, int extend)
+_gdbm_mapped_remap (GDBM_FILE dbf, off_t size, int extend)
{
off_t file_size;
@@ -177,7 +176,7 @@ _gdbm_mapped_remap (gdbm_file_info *dbf, off_t size, int extend)
map the entire file into the memory. Otherwise, map first SIZE_T_MAX
bytes. */
int
-_gdbm_mapped_init (gdbm_file_info *dbf)
+_gdbm_mapped_init (GDBM_FILE dbf)
{
off_t file_size;
@@ -192,7 +191,7 @@ _gdbm_mapped_init (gdbm_file_info *dbf)
not initialized or if it fails, fall back to the classical read(1).
Return number of bytes read or -1 on failure. */
ssize_t
-_gdbm_mapped_read (gdbm_file_info *dbf, void *buffer, size_t len)
+_gdbm_mapped_read (GDBM_FILE dbf, void *buffer, size_t len)
{
if (dbf->mapped_region)
{
@@ -239,7 +238,7 @@ _gdbm_mapped_read (gdbm_file_info *dbf, void *buffer, size_t len)
not initialized or if it fails, fall back to the classical write(1).
Return number of bytes written or -1 on failure. */
ssize_t
-_gdbm_mapped_write (gdbm_file_info *dbf, void *buffer, size_t len)
+_gdbm_mapped_write (GDBM_FILE dbf, void *buffer, size_t len)
{
if (dbf->mapped_region)
{
@@ -290,7 +289,7 @@ _gdbm_mapped_write (gdbm_file_info *dbf, void *buffer, size_t len)
Return number of bytes written or -1 on failure. */
off_t
-_gdbm_mapped_lseek (gdbm_file_info *dbf, off_t offset, int whence)
+_gdbm_mapped_lseek (GDBM_FILE dbf, off_t offset, int whence)
{
if (dbf->mapped_region)
{
@@ -340,7 +339,7 @@ _gdbm_mapped_lseek (gdbm_file_info *dbf, off_t offset, int whence)
/* Sync the mapped region to disk. */
int
-_gdbm_mapped_sync(gdbm_file_info *dbf)
+_gdbm_mapped_sync(GDBM_FILE dbf)
{
if (dbf->mapped_region)
{
diff --git a/src/testgdbm.c b/src/testgdbm.c
index fe3cca7..bd4e96d 100644
--- a/src/testgdbm.c
+++ b/src/testgdbm.c
@@ -22,7 +22,6 @@
#include "autoconf.h"
#include "gdbmdefs.h"
-#include "gdbmerrno.h"
#include "extern.h"
#include <errno.h>
@@ -41,7 +40,7 @@ extern const char *gdbm_strerror (gdbm_error);
char *progname; /* Program name */
char *file_name = NULL; /* Database file name */
-gdbm_file_info *gdbm_file = NULL; /* Database to operate upon */
+GDBM_FILE gdbm_file = NULL; /* Database to operate upon */
int interactive; /* Are we running in interactive mode? */
datum key_data; /* Current key */
datum return_data; /* Current data */
@@ -77,7 +76,7 @@ print_bucket (hash_bucket * bucket, char *mesg)
void
-_gdbm_print_avail_list (gdbm_file_info * dbf)
+_gdbm_print_avail_list (GDBM_FILE dbf)
{
int temp;
int size;
@@ -122,7 +121,7 @@ _gdbm_print_avail_list (gdbm_file_info * dbf)
}
void
-_gdbm_print_bucket_cache (FILE *fp, gdbm_file_info * dbf)
+_gdbm_print_bucket_cache (FILE *fp, GDBM_FILE dbf)
{
int index;
char changed;
diff --git a/src/update.c b/src/update.c
index 390f4f6..a92d284 100644
--- a/src/update.c
+++ b/src/update.c
@@ -22,12 +22,12 @@
#include "gdbmdefs.h"
-static void write_header (gdbm_file_info *);
+static void write_header (GDBM_FILE);
/* This procedure writes the header back to the file described by DBF. */
static void
-write_header (gdbm_file_info *dbf)
+write_header (GDBM_FILE dbf)
{
int num_bytes; /* Return value for write. */
off_t file_pos; /* Return value for lseek. */
@@ -47,7 +47,7 @@ write_header (gdbm_file_info *dbf)
/* After all changes have been made in memory, we now write them
all to disk. */
void
-_gdbm_end_update (gdbm_file_info *dbf)
+_gdbm_end_update (GDBM_FILE dbf)
{
int num_bytes; /* Return value for write. */
off_t file_pos; /* Return value for lseek. */
@@ -103,7 +103,7 @@ _gdbm_end_update (gdbm_file_info *dbf)
error occured. */
void
-_gdbm_fatal (gdbm_file_info *dbf, const char *val)
+_gdbm_fatal (GDBM_FILE dbf, const char *val)
{
if ((dbf != NULL) && (dbf->fatal_err != NULL))
(*dbf->fatal_err) (val);

Return to:

Send suggestions and report system problems to the System administrator.