summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/ext/ODBM_File
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-10-27 22:25:41 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-10-27 22:25:41 +0000
commitd85c2f57f17d991a6ca78d3e1c9f3308a2bbb271 (patch)
tree8c9a359433cbb3488b0a848e99bd869c76295dfd /gnu/usr.bin/perl/ext/ODBM_File
parent74cfb115ac810480c0000dc742b20383c1578bac (diff)
Resolve conflicts, remove old files, merge local changes
Diffstat (limited to 'gnu/usr.bin/perl/ext/ODBM_File')
-rw-r--r--gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm6
-rw-r--r--gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs32
2 files changed, 33 insertions, 5 deletions
diff --git a/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm b/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm
index 9e8e008e024..c7b61d84ffe 100644
--- a/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm
+++ b/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.pm
@@ -28,11 +28,11 @@ ODBM_File - Tied access to odbm files
$h{newkey} = newvalue;
print $h{oldkey};
...
-
+
untie %h;
-
+
=head1 DESCRIPTION
-
+
C<ODBM_File> establishes a connection between a Perl hash variable and
a file in ODBM_File format;. You can manipulate the data in the file
just as if it were in a Perl hash, but when your program exits, the
diff --git a/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs b/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs
index 27174ef062b..3bc94fe0730 100644
--- a/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs
+++ b/gnu/usr.bin/perl/ext/ODBM_File/ODBM_File.xs
@@ -15,6 +15,16 @@
# endif
#endif
+#ifndef HAS_DBMINIT_PROTO
+int dbminit(char* filename);
+int dbmclose(void);
+datum fetch(datum key);
+int store(datum key, datum dat);
+int delete(datum key);
+datum firstkey(void);
+datum nextkey(datum key);
+#endif
+
#ifdef DBM_BUG_DUPLICATE_FREE
/*
* DBM on at least Ultrix and HPUX call dbmclose() from dbminit(),
@@ -43,6 +53,7 @@ typedef struct {
typedef ODBM_File_type * ODBM_File ;
typedef datum datum_key ;
+typedef datum datum_key_copy ;
typedef datum datum_value ;
#define ckFilter(arg,type,name) \
@@ -70,7 +81,15 @@ typedef datum datum_value ;
#define odbm_FIRSTKEY(db) firstkey()
#define odbm_NEXTKEY(db,key) nextkey(key)
-static int dbmrefcnt;
+#define MY_CXT_KEY "ODBM_File::_guts" XS_VERSION
+
+typedef struct {
+ int x_dbmrefcnt;
+} my_cxt_t;
+
+START_MY_CXT
+
+#define dbmrefcnt (MY_CXT.x_dbmrefcnt)
#ifndef DBM_REPLACE
#define DBM_REPLACE 0
@@ -78,6 +97,11 @@ static int dbmrefcnt;
MODULE = ODBM_File PACKAGE = ODBM_File PREFIX = odbm_
+BOOT:
+{
+ MY_CXT_INIT;
+}
+
ODBM_File
odbm_TIEHASH(dbtype, filename, flags, mode)
char * dbtype
@@ -88,6 +112,8 @@ odbm_TIEHASH(dbtype, filename, flags, mode)
{
char *tmpbuf;
void * dbp ;
+ dMY_CXT;
+
if (dbmrefcnt++)
croak("Old dbm can only open one database");
New(0, tmpbuf, strlen(filename) + 5, char);
@@ -115,6 +141,8 @@ odbm_TIEHASH(dbtype, filename, flags, mode)
void
DESTROY(db)
ODBM_File db
+ PREINIT:
+ dMY_CXT;
CODE:
dbmrefcnt--;
dbmclose();
@@ -123,7 +151,7 @@ DESTROY(db)
datum_value
odbm_FETCH(db, key)
ODBM_File db
- datum_key key
+ datum_key_copy key
int
odbm_STORE(db, key, value, flags = DBM_REPLACE)