mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
-use size_t
-recheckin header as unix file
This commit is contained in:
parent
3944ce41c3
commit
4dd5fc67b7
@ -80,7 +80,8 @@ PHPAPI int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int
|
||||
*/
|
||||
PHPAPI datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC) {
|
||||
datum value_datum = {NULL, 0};
|
||||
int num=0, buf_size=1024;
|
||||
size_t num=0;
|
||||
size_t buf_size = 1024;
|
||||
char *buf;
|
||||
|
||||
if (flatfile_findkey(dba, key_datum TSRMLS_CC)) {
|
||||
@ -108,11 +109,12 @@ PHPAPI datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC) {
|
||||
*/
|
||||
PHPAPI int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) {
|
||||
char *key = key_datum.dptr;
|
||||
int size = key_datum.dsize;
|
||||
size_t size = key_datum.dsize;
|
||||
|
||||
char *buf;
|
||||
int num, buf_size = 1024;
|
||||
long pos;
|
||||
size_t num;
|
||||
size_t buf_size = 1024;
|
||||
size_t pos;
|
||||
|
||||
php_stream_rewind(dba->fp);
|
||||
|
||||
@ -167,11 +169,11 @@ PHPAPI int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC) {
|
||||
*/
|
||||
PHPAPI int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC) {
|
||||
char *buf = NULL;
|
||||
int num;
|
||||
int buf_size=1024;
|
||||
size_t num;
|
||||
size_t buf_size = 1024;
|
||||
int ret=0;
|
||||
void *key = key_datum.dptr;
|
||||
int size = key_datum.dsize;
|
||||
size_t size = key_datum.dsize;
|
||||
|
||||
php_stream_rewind(dba->fp);
|
||||
buf = emalloc((buf_size+1)*sizeof(char));
|
||||
@ -214,8 +216,8 @@ PHPAPI int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC) {
|
||||
*/
|
||||
PHPAPI datum flatfile_firstkey(flatfile *dba TSRMLS_DC) {
|
||||
datum buf;
|
||||
int num;
|
||||
int buf_size=1024;
|
||||
size_t num;
|
||||
size_t buf_size = 1024;
|
||||
|
||||
php_stream_rewind(dba->fp);
|
||||
buf.dptr = emalloc((buf_size+1)*sizeof(char));
|
||||
@ -255,8 +257,8 @@ PHPAPI datum flatfile_firstkey(flatfile *dba TSRMLS_DC) {
|
||||
*/
|
||||
PHPAPI datum flatfile_nextkey(flatfile *dba TSRMLS_DC) {
|
||||
datum buf;
|
||||
int num;
|
||||
int buf_size=1024;
|
||||
size_t num;
|
||||
size_t buf_size = 1024;
|
||||
|
||||
php_stream_seek(dba->fp, dba->CurrentFlatFilePos, SEEK_SET);
|
||||
buf.dptr = emalloc((buf_size+1)*sizeof(char));
|
||||
|
@ -23,14 +23,14 @@
|
||||
|
||||
typedef struct {
|
||||
char *dptr;
|
||||
int dsize;
|
||||
size_t dsize;
|
||||
} datum;
|
||||
|
||||
typedef struct {
|
||||
char *lockfn;
|
||||
int lockfd;
|
||||
php_stream *fp;
|
||||
long CurrentFlatFilePos;
|
||||
size_t CurrentFlatFilePos;
|
||||
datum nextkey;
|
||||
} flatfile;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user