diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2022-03-01 17:08:13 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2022-03-01 17:08:13 +0000 |
commit | af0fd7f3c9e7bcf632309fcba36fc5f93d2a0044 (patch) | |
tree | 2db30b67eee285c20536bab48b5a780bfb611e76 | |
parent | 703cc8957f4f367364b6a13c16afb1e971299278 (diff) |
GDBM: fix build
-rw-r--r-- | src/src/dbstuff.h | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/src/dbstuff.h b/src/src/dbstuff.h index 296a8e18c..b28db1867 100644 --- a/src/src/dbstuff.h +++ b/src/src/dbstuff.h @@ -323,7 +323,9 @@ before use, but we don't have to free anything after reading data. */ typedef struct { GDBM_FILE gdbm; /* Database */ datum lkey; /* Last key, for scans */ -} EXIM_DB; +} gdbm_db; + +#define EXIM_DB gdbm_db /* Cursor type, not used with gdbm: just set up a dummy */ # define EXIM_CURSOR int @@ -339,15 +341,16 @@ typedef struct { /* EXIM_DBOPEN - returns a EXIM_DB *, NULL if failed */ # define EXIM_DBOPEN__(name, dirname, flags, mode, dbpp) \ - { (*(dbpp)) = (EXIM_DB *) malloc(sizeof(EXIM_DB));\ - if (*(dbpp) != NULL) { \ - (*(dbpp))->lkey.dptr = NULL;\ - (*(dbpp))->gdbm = gdbm_open(CS name, 0, (((flags) & O_CREAT))?GDBM_WRCREAT:(((flags) & (O_RDWR|O_WRONLY))?GDBM_WRITER:GDBM_READER), mode, 0);\ - if ((*(dbpp))->gdbm == NULL) {\ - free(*(dbpp));\ - *(dbpp) = NULL;\ + { EXIM_DB * dbp = malloc(sizeof(EXIM_DB));\ + if (dbp) { \ + dbp->lkey.dptr = NULL;\ + dbp->gdbm = gdbm_open(CS name, 0, (((flags) & O_CREAT))?GDBM_WRCREAT:(((flags) & (O_RDWR|O_WRONLY))?GDBM_WRITER:GDBM_READER), (mode), 0);\ + if (!dbp->gdbm) {\ + free(dbp);\ + dbp = NULL;\ }\ }\ + *(dbpp) = dbp;\ } /* EXIM_DBGET - returns TRUE if successful, FALSE otherwise */ |