blob: 628903f41c5282a60c4c2956a50b44f2e64c29d9 [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001From aacd2398e766500cb5d83c4d76b642fcf31d997a Mon Sep 17 00:00:00 2001
2From: Sergey Poznyakoff <gray@gnu.org>
3Date: Wed, 23 Jun 2021 10:26:50 +0300
4Subject: [PATCH] Fix GDBM_File to compile with version 1.20 and earlier
5
6* ext/GDBM_File/GDBM_File.xs (ITEM_NOT_FOUND): Define conditionally,
7depending on the GDBM_VERSION_MAJOR and GDBM_VERSION_MINOR.
8Don't assume GDBM_ITEM_NOT_FOUND is a define (it isn't since
9gdbm commit d3e27957).
10
11Upstream-Status: Backport
12Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
13---
14 ext/GDBM_File/GDBM_File.xs | 11 +++++------
15 1 file changed, 5 insertions(+), 6 deletions(-)
16
17diff --git a/ext/GDBM_File/GDBM_File.xs b/ext/GDBM_File/GDBM_File.xs
18index cd0bb6f26ffa..494c2889ca89 100644
19--- a/ext/GDBM_File/GDBM_File.xs
20+++ b/ext/GDBM_File/GDBM_File.xs
21@@ -145,14 +145,13 @@ output_datum(pTHX_ SV *arg, char *str, int size)
22 #define gdbm_setopt(db,optflag,optval,optlen) not_here("gdbm_setopt")
23 #endif
24
25-#ifndef GDBM_ITEM_NOT_FOUND
26-# define GDBM_ITEM_NOT_FOUND GDBM_NO_ERROR
27-#endif
28-
29+#if GDBM_VERSION_MAJOR == 1 && GDBM_VERSION_MINOR < 13
30 /* Prior to 1.13, gdbm_fetch family functions set gdbm_errno to GDBM_NO_ERROR
31 if the requested key did not exist */
32-#define ITEM_NOT_FOUND() \
33- (gdbm_errno == GDBM_ITEM_NOT_FOUND || gdbm_errno == GDBM_NO_ERROR)
34+# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_NO_ERROR)
35+#else
36+# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_ITEM_NOT_FOUND)
37+#endif
38
39 #define CHECKDB(db) do { \
40 if (!db->dbp) { \