diff options
Diffstat (limited to 'ext/dbm/GDBM_File.xs.bak')
-rw-r--r-- | ext/dbm/GDBM_File.xs.bak | 122 |
1 files changed, 0 insertions, 122 deletions
diff --git a/ext/dbm/GDBM_File.xs.bak b/ext/dbm/GDBM_File.xs.bak deleted file mode 100644 index 03b86c5739..0000000000 --- a/ext/dbm/GDBM_File.xs.bak +++ /dev/null @@ -1,122 +0,0 @@ -#include "EXTERN.h" -#include "perl.h" -#include "XSUB.h" -#include <gdbm.h> - -#include <fcntl.h> - -typedef GDBM_FILE GDBM_File; - -#define gdbm_new(dbtype,filename,flags,mode) \ - gdbm_open(filename, 0, flags & O_CREAT ? GDBM_WRCREAT : GDBM_WRITER, \ - mode, fatal) - -typedef datum gdatum; - -typedef struct gdbm_file_desc { - GDBM_File ptr; - SV* curkey; -} GDBM_FILE_DESC; - -GDBM_FILE_DESC* GDBM_File_desc; - -GDBM_FILE_DESC* -newGDBM_FILE_DESC(ptr) -void* ptr; -{ - New(0, GDBM_File_desc, 1, GDBM_FILE_DESC); - GDBM_File_desc->ptr = ptr; - GDBM_File_desc->curkey = 0; - return GDBM_File_desc; -} - -void -deleteGDBM_FILE_DESC() -{ - sv_free(GDBM_File_desc->curkey); - Safefree(GDBM_File_desc); -} - -typedef void (*FATALFUNC)(); - -static datum -get_current_key() -{ - datum key; - key.dptr = SvPVn( GDBM_File_desc->curkey, key.dsize); - return key; -} - -static void -set_current_key(sv) -SV *sv; -{ - sv_free(GDBM_File_desc->curkey); - GDBM_File_desc->curkey = sv_ref(sv); -} - - -MODULE = GDBM_File PACKAGE = GDBM_File PREFIX = gdbm_ - -GDBM_File -gdbm_new(dbtype, filename, flags, mode) - char * dbtype - char * filename - int flags - int mode - -GDBM_File -gdbm_open(name, block_size, read_write, mode, fatal_func = (FATALFUNC)fatal) - char * name - int block_size - int read_write - int mode - FATALFUNC fatal_func - -void -gdbm_close(db) - GDBM_File db - CLEANUP: - deleteGDBM_FILE_DESC(); - -void -gdbm_DESTROY(db) - GDBM_File db - CODE: - gdbm_close(db); - deleteGDBM_FILE_DESC(); - -gdatum -gdbm_fetch(db, key) - GDBM_File db - datum key - -int -gdbm_store(db, key, value, flags = GDBM_REPLACE) - GDBM_File db - datum key - datum value - int flags - -int -gdbm_delete(db, key) - GDBM_File db - datum key - -gdatum -gdbm_firstkey(db) - GDBM_File db - CLEANUP: - set_current_key(ST(0)); - -gdatum -gdbm_nextkey(db, key = get_current_key()) - GDBM_File db - datum key - CLEANUP: - set_current_key(ST(0)); - -int -gdbm_reorganize(db) - GDBM_File db - |