ODBM_File.xs revision 7c478bd95313f5f23a4c958a745db2134aa03244
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef I_DBM
/* If using the DB3 emulation, ENTER is defined both
* by DB3 and Perl. We drop the Perl definition now.
* See also INSTALL section on DB3.
* -- Stanislav Brabec <utx@penguin.cz> */
# include <dbm.h>
#else
# ifdef I_RPCSVC_DBM
# endif
#endif
/* Added for C99 cleanliness, copied from 5.8.4 */
#ifndef HAS_DBMINIT_PROTO
int dbmclose(void);
#endif
#ifdef DBM_BUG_DUPLICATE_FREE
/*
* DBM on at least Ultrix and HPUX call dbmclose() from dbminit(),
* resulting in duplicate free() because dbmclose() does *not*
* check if it has already been called for this DBM.
* the next dbminit(), the memory might be used for something else when
* it is freed.
* Set DBM_BUG_DUPLICATE_FREE in the extension hint file.
*/
/* Close the previous dbm, and fail to open a new dbm */
#endif
#include <fcntl.h>
typedef struct {
void * dbp ;
SV * filter_fetch_key ;
SV * filter_store_key ;
SV * filter_fetch_value ;
SV * filter_store_value ;
int filtering ;
typedef ODBM_File_type * ODBM_File ;
typedef datum datum_value ;
SV * save_defsv ; \
/* printf("filtering %s\n", name) ;*/ \
SvREFCNT_dec(save_defsv) ; \
/*printf("end of filtering %s\n", name) ;*/ \
}
static int dbmrefcnt;
#ifndef DBM_REPLACE
#define DBM_REPLACE 0
#endif
char * dbtype
char * filename
int flags
int mode
CODE:
{
char *tmpbuf;
void * dbp ;
if (dbmrefcnt++)
croak("Old dbm can only open one database");
}
else
}
}
void
CODE:
dbmrefcnt--;
dbmclose();
int
int flags
if (RETVAL) {
croak("No write permission to odbm file");
croak("odbm store returned %d, errno %d, key \"%s\"",
}
int
{ \
} \
else if (code) { \
else \
} \
}
SV *
CODE:
SV *
CODE:
SV *
CODE:
SV *
CODE: