gdbm: patch over an ABI change in version 1.14

factor-shell
Björn Lindqvist 2018-01-25 21:53:32 +01:00
parent f976d97983
commit 66ce47e30a
2 changed files with 9 additions and 4 deletions

View File

@ -42,6 +42,9 @@ FUNCTION: int gdbm_exists ( GDBM_FILE dbf, datum key )
FUNCTION: int gdbm_setopt ( GDBM_FILE dbf, int option, int* value, int size )
FUNCTION: int gdbm_fdesc ( GDBM_FILE dbf )
! Removed in gdbm 1.14
C-GLOBAL: int gdbm_errno
! Added in gdbm 1.14
FUNCTION: int *gdbm_errno_location ( )
FUNCTION: c-string gdbm_strerror ( int errno )

View File

@ -1,8 +1,8 @@
! Copyright (C) 2010 Dmitry Shubin.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.data alien.destructors
alien.enums alien.syntax classes.struct combinators destructors
fry gdbm.ffi io.backend kernel libc locals math namespaces
alien.enums alien.syntax classes.struct combinators continuations
destructors fry gdbm.ffi io.backend kernel libc locals math namespaces
sequences serialize strings ;
IN: gdbm
@ -41,10 +41,12 @@ ENUM: gdbm-error
gdbm-option-already-set
gdbm-illegal-option ;
<PRIVATE
: gdbm-throw ( -- * ) gdbm_errno gdbm-error number>enum throw ;
: gdbm-errno ( -- n )
[ gdbm_errno ] [ drop gdbm_errno_location int deref ] recover ;
: gdbm-throw ( -- * ) gdbm-errno gdbm-error number>enum throw ;
: check-error ( ret -- ) 0 = [ gdbm-throw ] unless ;