Skip to content

Commit

Permalink
Fix definition of ITEM_NOT_FOUND for pre-1.13 versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
graygnuorg committed Jun 23, 2021
1 parent ea57297 commit 5bc1e5f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ext/GDBM_File/GDBM_File.xs
Expand Up @@ -145,10 +145,11 @@ output_datum(pTHX_ SV *arg, char *str, int size)
#define gdbm_setopt(db,optflag,optval,optlen) not_here("gdbm_setopt")
#endif

#if GDBM_VERSION_MAJOR == 1 && GDBM_VERSION_MINOR < 13
/* Prior to 1.13, gdbm_fetch family functions set gdbm_errno to GDBM_NO_ERROR
if the requested key did not exist */
# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_NO_ERROR)
#if GDBM_VERSION_MAJOR == 1 && GDBM_VERSION_MINOR < 13
/* Prior to 1.13, only gdbm_fetch set GDBM_ITEM_NOT_FOUND if the requested
key did not exist. Other similar function wouls set GDBM_NO_ERROR instead.
The GDBM_ITEM_NOT_FOUND existeds as early as in 1.7.3 */
# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_NO_ERROR || gdbm_errno == GDBM_ITEM_NOT_FOUND)
#else
# define ITEM_NOT_FOUND() (gdbm_errno == GDBM_ITEM_NOT_FOUND)
#endif
Expand Down

0 comments on commit 5bc1e5f

Please sign in to comment.