From af0fd7f3c9e7bcf632309fcba36fc5f93d2a0044 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 1 Mar 2022 17:08:13 +0000 Subject: GDBM: fix build --- src/src/dbstuff.h | 19 +++++++++++-------- 1 file 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 */ -- cgit v1.2.3