diff options
author | Marcus Boerger <helly@php.net> | 2002-11-10 17:58:46 +0000 |
---|---|---|
committer | Marcus Boerger <helly@php.net> | 2002-11-10 17:58:46 +0000 |
commit | 705a4e251c904048d1eb54a02b5886ebf9efc769 (patch) | |
tree | 71d859d78988904a998c73f79f9b8f734df2295a /ext/dba/dba_flatfile.c | |
parent | 830c2e0df6f6813217fc1bc224eeb78674530ae3 (diff) | |
download | php-git-705a4e251c904048d1eb54a02b5886ebf9efc769.tar.gz |
-Centralise open stream for builtin modules that use streams
-If locks work on database file then only one stream open call is used
Diffstat (limited to 'ext/dba/dba_flatfile.c')
-rw-r--r-- | ext/dba/dba_flatfile.c | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/ext/dba/dba_flatfile.c b/ext/dba/dba_flatfile.c index 0a90ecb971..3cecba173d 100644 --- a/ext/dba/dba_flatfile.c +++ b/ext/dba/dba_flatfile.c @@ -39,38 +39,10 @@ DBA_OPEN_FUNC(flatfile) { - char *fmode; - php_stream *fp; - info->dbf = emalloc(sizeof(flatfile)); memset(info->dbf, 0, sizeof(flatfile)); - switch(info->mode) { - case DBA_READER: - fmode = "r"; - break; - case DBA_WRITER: - fmode = "r+b"; - break; - case DBA_CREAT: - fmode = "a+b"; - break; - case DBA_TRUNC: - fmode = "w+b"; - break; - default: - efree(info->dbf); - return FAILURE; /* not possible */ - } - - fp = php_stream_open_wrapper(info->path, fmode, STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE, NULL); - if (!fp) { - *error = "Unable to open file"; - efree(info->dbf); - return FAILURE; - } - - ((flatfile*)info->dbf)->fp = fp; + ((flatfile*)info->dbf)->fp = info->fp; return SUCCESS; } @@ -79,7 +51,6 @@ DBA_CLOSE_FUNC(flatfile) { FLATFILE_DATA; - php_stream_close(dba->fp); if (dba->nextkey.dptr) efree(dba->nextkey.dptr); efree(dba); |