Lines Matching refs:info

96 	dba_info *info = NULL; 										\
179 #define DBA_FETCH_RESOURCE(info, id) \ argument
180 …if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NUL…
184 #define DBA_FETCH_RESOURCE_WITH_ID(info, id) \ argument
185 …if ((info = (dba_info *)zend_fetch_resource2(Z_RES_P(id), "DBA identifier", le_db, le_pdb)) == NUL…
190 #define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_FETCH_RESOURCE_WITH_ID(info, id)
191 #define DBA_ID_GET2_3 DBA_ID_PARS; DBA_GET2_3; DBA_FETCH_RESOURCE_WITH_ID(info, id)
208 if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
215 if(info->mode != DBA_WRITER && info->mode != DBA_TRUNC && info->mode != DBA_CREAT) { \
323 static void dba_close(dba_info *info) in dba_close() argument
325 if (info->hnd) { in dba_close()
326 info->hnd->close(info); in dba_close()
328 if (info->path) { in dba_close()
329 pefree(info->path, info->flags&DBA_PERSISTENT); in dba_close()
331 if (info->fp && info->fp != info->lock.fp) { in dba_close()
332 if (info->flags & DBA_PERSISTENT) { in dba_close()
333 php_stream_pclose(info->fp); in dba_close()
335 php_stream_close(info->fp); in dba_close()
338 if (info->lock.fp) { in dba_close()
339 if (info->flags & DBA_PERSISTENT) { in dba_close()
340 php_stream_pclose(info->lock.fp); in dba_close()
342 php_stream_close(info->lock.fp); in dba_close()
345 if (info->lock.name) { in dba_close()
346 pefree(info->lock.name, info->flags&DBA_PERSISTENT); in dba_close()
348 pefree(info, info->flags&DBA_PERSISTENT); in dba_close()
355 dba_info *info = (dba_info *)rsrc->ptr; in dba_close_rsrc() local
357 dba_close(info); in dba_close_rsrc()
379 dba_info *info = (dba_info *)rsrc->ptr; in dba_close_pe_rsrc() local
382 zend_hash_apply_with_argument(&EG(persistent_list), dba_close_pe_rsrc_deleter, info); in dba_close_pe_rsrc()
472 dba_info *info = NULL; in php_dba_update() local
487 DBA_FETCH_RESOURCE_WITH_ID(info, id); in php_dba_update()
491 if (info->hnd->update(info, key_str, key_len, val, val_len, mode) == SUCCESS) { in php_dba_update()
507 dba_info *info; in php_dba_find() local
516 info = (dba_info *)(le->ptr); in php_dba_find()
517 if (!strcmp(info->path, path)) { in php_dba_find()
533 dba_info *info, *other; in php_dba_open() local
593 info = (dba_info *)le->ptr; in php_dba_open()
596 RETURN_RES(zend_register_resource(info, le_pdb)); in php_dba_open()
758 info = pemalloc(sizeof(dba_info), persistent); in php_dba_open()
759 memset(info, 0, sizeof(dba_info)); in php_dba_open()
760 info->path = pestrdup(Z_STRVAL(args[0]), persistent); in php_dba_open()
761 info->mode = modenr; in php_dba_open()
762 info->argc = ac - 3; in php_dba_open()
763 info->argv = args + 3; in php_dba_open()
764info->flags = (hptr->flags & ~DBA_LOCK_ALL) | (lock_flag & DBA_LOCK_ALL) | (persistent ? DBA_PERSI… in php_dba_open()
765 info->lock.mode = lock_mode; in php_dba_open()
772 if ((other = php_dba_find(info->path)) != NULL) { in php_dba_open()
788 spprintf(&lock_name, 0, "%s.lck", info->path); in php_dba_open()
793info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|pe… in php_dba_open()
795 if (!info->lock.fp) { in php_dba_open()
800 info->lock.name = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); in php_dba_open()
805 if (!info->lock.fp) { in php_dba_open()
806info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|… in php_dba_open()
807 if (info->lock.fp) { in php_dba_open()
810 pefree(info->path, persistent); in php_dba_open()
811 info->path = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); in php_dba_open()
814 info->lock.name = pestrndup(ZSTR_VAL(opened_path), ZSTR_LEN(opened_path), persistent); in php_dba_open()
821 if (!info->lock.fp) { in php_dba_open()
822 dba_close(info); in php_dba_open()
827 if (!php_stream_supports_lock(info->lock.fp)) { in php_dba_open()
830 if (php_stream_lock(info->lock.fp, lock_mode)) { in php_dba_open()
837 if (info->lock.fp && lock_dbf) { in php_dba_open()
838 info->fp = info->lock.fp; /* use the same stream for locking and database access */ in php_dba_open()
840info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PA… in php_dba_open()
842 if (!info->fp) { in php_dba_open()
843 dba_close(info); in php_dba_open()
852 if (SUCCESS != php_stream_cast(info->fp, PHP_STREAM_AS_FD, (void*)&info->fd, 1)) { in php_dba_open()
854 dba_close(info); in php_dba_open()
859 int flags = fcntl(info->fd, F_GETFL); in php_dba_open()
860 fcntl(info->fd, F_SETFL, flags & ~O_APPEND); in php_dba_open()
863 if (info->lock.fp != NULL) { in php_dba_open()
864 …php_stream_free(info->lock.fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLO… in php_dba_open()
866 if (info->fp != info->lock.fp) { in php_dba_open()
867 … php_stream_free(info->fp, persistent ? PHP_STREAM_FREE_CLOSE_PERSISTENT : PHP_STREAM_FREE_CLOSE); in php_dba_open()
869 info->fp = NULL; in php_dba_open()
870 info->lock.fp = NULL; in php_dba_open()
871 info->fd = -1; in php_dba_open()
873 pefree(info->lock.name, persistent); in php_dba_open()
884 if (error || hptr->open(info, &error) != SUCCESS) { in php_dba_open()
885 dba_close(info); in php_dba_open()
891 info->hnd = hptr; in php_dba_open()
892 info->argc = 0; in php_dba_open()
893 info->argv = NULL; in php_dba_open()
896 if (zend_register_persistent_resource(key, keylen, info, le_pdb) == NULL) { in php_dba_open()
897 dba_close(info); in php_dba_open()
904 RETVAL_RES(zend_register_resource(info, (persistent ? le_pdb : le_db))); in php_dba_open()
928 dba_info *info = NULL; in PHP_FUNCTION() local
934 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
945 if(info->hnd->exists(info, key_str, key_len) == SUCCESS) { in PHP_FUNCTION()
962 if (!strcmp(info->hnd->name, "cdb")) { in PHP_FUNCTION()
964 …Handler %s accepts only skip values greater than or equal to zero, using skip=0", info->hnd->name); in PHP_FUNCTION()
967 } else if (!strcmp(info->hnd->name, "inifile")) { in PHP_FUNCTION()
975 …ULL, E_NOTICE, "Handler %s accepts only skip value -1 and greater, using skip=0", info->hnd->name); in PHP_FUNCTION()
979 …"Handler %s does not support optional skip parameter, the value will be ignored", info->hnd->name); in PHP_FUNCTION()
985 if((val = info->hnd->fetch(info, key_str, key_len, skip, &len)) != NULL) { in PHP_FUNCTION()
1031 dba_info *info = NULL; in PHP_FUNCTION() local
1037 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1039 fkey = info->hnd->firstkey(info, &len); in PHP_FUNCTION()
1057 dba_info *info = NULL; in PHP_FUNCTION() local
1063 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1065 nkey = info->hnd->nextkey(info, &len); in PHP_FUNCTION()
1085 if(info->hnd->delete(info, key_str, key_len) == SUCCESS) in PHP_FUNCTION()
1115 dba_info *info = NULL; in PHP_FUNCTION() local
1121 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1125 if (info->hnd->optimize(info) == SUCCESS) { in PHP_FUNCTION()
1137 dba_info *info = NULL; in PHP_FUNCTION() local
1143 DBA_FETCH_RESOURCE(info, id); in PHP_FUNCTION()
1145 if (info->hnd->sync(info) == SUCCESS) { in PHP_FUNCTION()
1168 char *str = hptr->info(hptr, NULL); in PHP_FUNCTION()
1183 dba_info *info; in PHP_FUNCTION() local
1197 info = (dba_info *)(le->ptr); in PHP_FUNCTION()
1198 add_index_string(return_value, i, info->path); in PHP_FUNCTION()