summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2002-11-06 09:17:51 +0000
committerMarcus Boerger <helly@php.net>2002-11-06 09:17:51 +0000
commit88af7e9897dec89d0e142c387068b3cd734cb31c (patch)
tree571048c60d8111f7a2c609e7753067bef09083c0
parent4be50925ad2077cb8ea77495204a92aabb7ff93f (diff)
downloadphp-git-88af7e9897dec89d0e142c387068b3cd734cb31c.tar.gz
Use the the name 'flatfile' correctly so the handler support can be built now.
#I do not like the lock solution since a crashed php would leave the *lck #file locked now.
-rw-r--r--ext/dba/config.m42
-rw-r--r--ext/dba/dba.c1
-rw-r--r--ext/dba/dba_flatfile.c (renamed from ext/dba/dba_flatile.c)44
-rw-r--r--ext/dba/libflatfile/flatfile.c14
-rw-r--r--ext/dba/libflatfile/flatfile.h14
5 files changed, 36 insertions, 39 deletions
diff --git a/ext/dba/config.m4 b/ext/dba/config.m4
index 8be6569820..ca09b6d8d5 100644
--- a/ext/dba/config.m4
+++ b/ext/dba/config.m4
@@ -246,7 +246,7 @@ AC_ARG_WITH(flatfile,
if test "$withval" = "yes"; then
PHP_ADD_BUILD_DIR($ext_builddir/libflatfile)
AC_DEFINE(DBA_FLATFILE, 1, [ ])
- flat_sources="php_flatfile.c libflatfile/flatfile.c"
+ flat_sources="dba_flatfile.c libflatfile/flatfile.c"
THIS_RESULT="builtin"
fi
])
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 337cfa40e2..d68a291f57 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -35,6 +35,7 @@
#include "php_cdb.h"
#include "php_db2.h"
#include "php_db3.h"
+#include "php_flatfile.h"
/* {{{ dba_functions[]
*/
diff --git a/ext/dba/dba_flatile.c b/ext/dba/dba_flatfile.c
index aac535be5a..4976f32e56 100644
--- a/ext/dba/dba_flatile.c
+++ b/ext/dba/dba_flatfile.c
@@ -44,11 +44,7 @@
#endif
#endif
-typedef struct {
- datum nextkey;
-} dba_dbm_data;
-
-#define DBM_DATA dba_dbm_data *dba = info->dbf
+#define DBM_DATA flatfile *dba = info->dbf
#define DBM_GKEY datum gkey; gkey.dptr = (char *) key; gkey.dsize = keylen
#define TRUNC_IT(extension, mode) \
@@ -59,7 +55,7 @@ typedef struct {
close(fd);
-DBA_OPEN_FUNC(dbm)
+DBA_OPEN_FUNC(flatfile)
{
char *fmode;
php_stream *fp;
@@ -72,7 +68,7 @@ DBA_OPEN_FUNC(dbm)
int retries = 0;
#endif
- info->dbf = ecalloc(sizeof(dba_dbm_data), 1);
+ info->dbf = ecalloc(sizeof(flatfile), 1);
if (!info->dbf) {
*error = "Out of memory";
return FAILURE;
@@ -150,14 +146,14 @@ DBA_OPEN_FUNC(dbm)
return FAILURE;
}
- ((dba_dbm_data*)info->dbf)->fp = fp;
- ((dba_dbm_data*)info->dbf)->lockfn = lockfn;
- ((dba_dbm_data*)info->dbf)->lockfd = lockfd;
+ ((flatfile*)info->dbf)->fp = fp;
+ ((flatfile*)info->dbf)->lockfn = lockfn;
+ ((flatfile*)info->dbf)->lockfd = lockfd;
return SUCCESS;
}
-DBA_CLOSE_FUNC(dbm)
+DBA_CLOSE_FUNC(flatfile)
{
DBM_DATA;
@@ -178,13 +174,13 @@ DBA_CLOSE_FUNC(dbm)
efree(dba);
}
-#define DBM_FETCH(gkey) dbm_file_fetch((dba_dbm_data*)info->dbf, gkey TSRMLS_CC)
-#define DBM_STORE(gkey, gval) dbm_file_store((dba_dbm_data*)info->dbf, gkey, gval, DBM_REPLACE TSRMLS_CC)
-#define DBM_DELETE(gkey) dbm_file_delete((dba_dbm_data*)info->dbf, gkey TSRMLS_CC)
-#define DBM_FIRSTKEY() dbm_file_firstkey((dba_dbm_data*)info->dbf TSRMLS_CC)
-#define DBM_NEXTKEY(gkey) dbm_file_nextkey((dba_dbm_data*)info->dbf TSRMLS_CC)
+#define DBM_FETCH(gkey) dbm_file_fetch((flatfile*)info->dbf, gkey TSRMLS_CC)
+#define DBM_STORE(gkey, gval) dbm_file_store((flatfile*)info->dbf, gkey, gval, DBM_REPLACE TSRMLS_CC)
+#define DBM_DELETE(gkey) dbm_file_delete((flatfile*)info->dbf, gkey TSRMLS_CC)
+#define DBM_FIRSTKEY() dbm_file_firstkey((flatfile*)info->dbf TSRMLS_CC)
+#define DBM_NEXTKEY(gkey) dbm_file_nextkey((flatfile*)info->dbf TSRMLS_CC)
-DBA_FETCH_FUNC(dbm)
+DBA_FETCH_FUNC(flatfile)
{
datum gval;
char *new = NULL;
@@ -199,7 +195,7 @@ DBA_FETCH_FUNC(dbm)
return new;
}
-DBA_UPDATE_FUNC(dbm)
+DBA_UPDATE_FUNC(flatfile)
{
datum gval;
@@ -210,7 +206,7 @@ DBA_UPDATE_FUNC(dbm)
return (DBM_STORE(gkey, gval) == -1 ? FAILURE : SUCCESS);
}
-DBA_EXISTS_FUNC(dbm)
+DBA_EXISTS_FUNC(flatfile)
{
datum gval;
DBM_GKEY;
@@ -223,13 +219,13 @@ DBA_EXISTS_FUNC(dbm)
return FAILURE;
}
-DBA_DELETE_FUNC(dbm)
+DBA_DELETE_FUNC(flatfile)
{
DBM_GKEY;
return(DBM_DELETE(gkey) == -1 ? FAILURE : SUCCESS);
}
-DBA_FIRSTKEY_FUNC(dbm)
+DBA_FIRSTKEY_FUNC(flatfile)
{
DBM_DATA;
@@ -244,7 +240,7 @@ DBA_FIRSTKEY_FUNC(dbm)
return NULL;
}
-DBA_NEXTKEY_FUNC(dbm)
+DBA_NEXTKEY_FUNC(flatfile)
{
DBM_DATA;
datum lkey;
@@ -264,13 +260,13 @@ DBA_NEXTKEY_FUNC(dbm)
return NULL;
}
-DBA_OPTIMIZE_FUNC(dbm)
+DBA_OPTIMIZE_FUNC(flatfile)
{
/* dummy */
return SUCCESS;
}
-DBA_SYNC_FUNC(dbm)
+DBA_SYNC_FUNC(flatfile)
{
/* dummy */
return SUCCESS;
diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c
index fe86f467d5..0b74614d5f 100644
--- a/ext/dba/libflatfile/flatfile.c
+++ b/ext/dba/libflatfile/flatfile.c
@@ -36,7 +36,7 @@
#include <unistd.h>
#endif
-#include "dbm.h"
+#include "flatfile.h"
/*
* ret = -1 means that database was opened for read-only
@@ -46,7 +46,7 @@
/* {{{ dbm_file_store
*/
-PHPAPI int dbm_file_store(dba_dbm_data *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC) {
+PHPAPI int dbm_file_store(flatfile *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC) {
if (mode == DBM_INSERT) {
if (dbm_file_findkey(dba, key_datum TSRMLS_CC)) {
return 1;
@@ -77,7 +77,7 @@ PHPAPI int dbm_file_store(dba_dbm_data *dba, datum key_datum, datum value_datum,
/* {{{ dbm_file_fetch
*/
-PHPAPI datum dbm_file_fetch(dba_dbm_data *dba, datum key_datum TSRMLS_DC) {
+PHPAPI datum dbm_file_fetch(flatfile *dba, datum key_datum TSRMLS_DC) {
datum value_datum = {NULL, 0};
int num=0, buf_size=1024;
char *buf;
@@ -105,7 +105,7 @@ PHPAPI datum dbm_file_fetch(dba_dbm_data *dba, datum key_datum TSRMLS_DC) {
/* {{{ dbm_file_delete
*/
-PHPAPI int dbm_file_delete(dba_dbm_data *dba, datum key_datum TSRMLS_DC) {
+PHPAPI int dbm_file_delete(flatfile *dba, datum key_datum TSRMLS_DC) {
char *key = key_datum.dptr;
int size = key_datum.dsize;
@@ -164,7 +164,7 @@ PHPAPI int dbm_file_delete(dba_dbm_data *dba, datum key_datum TSRMLS_DC) {
/* {{{ dbm_file_findkey
*/
-PHPAPI int dbm_file_findkey(dba_dbm_data *dba, datum key_datum TSRMLS_DC) {
+PHPAPI int dbm_file_findkey(flatfile *dba, datum key_datum TSRMLS_DC) {
char *buf = NULL;
int num;
int buf_size=1024;
@@ -211,7 +211,7 @@ PHPAPI int dbm_file_findkey(dba_dbm_data *dba, datum key_datum TSRMLS_DC) {
/* {{{ dbm_file_firstkey
*/
-PHPAPI datum dbm_file_firstkey(dba_dbm_data *dba TSRMLS_DC) {
+PHPAPI datum dbm_file_firstkey(flatfile *dba TSRMLS_DC) {
datum buf;
int num;
int buf_size=1024;
@@ -252,7 +252,7 @@ PHPAPI datum dbm_file_firstkey(dba_dbm_data *dba TSRMLS_DC) {
/* {{{ latfile_nextkey
*/
-PHPAPI datum dbm_file_nextkey(dba_dbm_data *dba TSRMLS_DC) {
+PHPAPI datum dbm_file_nextkey(flatfile *dba TSRMLS_DC) {
datum buf;
int num;
int buf_size=1024;
diff --git a/ext/dba/libflatfile/flatfile.h b/ext/dba/libflatfile/flatfile.h
index 6582d71767..486af9135f 100644
--- a/ext/dba/libflatfile/flatfile.h
+++ b/ext/dba/libflatfile/flatfile.h
@@ -32,16 +32,16 @@ typedef struct {
php_stream *fp;
long CurrentFlatFilePos;
datum nextkey;
-} dba_dbm_data;
+} flatfile;
#define DBM_INSERT 0
#define DBM_REPLACE 1
-PHPAPI int dbm_file_store(dba_dbm_data *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC);
-PHPAPI datum dbm_file_fetch(dba_dbm_data *dba, datum key_datum TSRMLS_DC);
-PHPAPI int dbm_file_delete(dba_dbm_data *dba, datum key_datum TSRMLS_DC);
-PHPAPI int dbm_file_findkey(dba_dbm_data *dba, datum key_datum TSRMLS_DC);
-PHPAPI datum dbm_file_firstkey(dba_dbm_data *dba TSRMLS_DC);
-PHPAPI datum dbm_file_nextkey(dba_dbm_data *dba TSRMLS_DC);
+PHPAPI int dbm_file_store(flatfile *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC);
+PHPAPI datum dbm_file_fetch(flatfile *dba, datum key_datum TSRMLS_DC);
+PHPAPI int dbm_file_delete(flatfile *dba, datum key_datum TSRMLS_DC);
+PHPAPI int dbm_file_findkey(flatfile *dba, datum key_datum TSRMLS_DC);
+PHPAPI datum dbm_file_firstkey(flatfile *dba TSRMLS_DC);
+PHPAPI datum dbm_file_nextkey(flatfile *dba TSRMLS_DC);
#endif