[PHP-CVS] cvs: php-src(PHP_5_3) /ext/dba dba.c
indeyetsFri Nov 7 12:39:11 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/dbadba.c Log: new parameter-parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/dba/dba.c?r1=1.111.2.4.2.5.2.6&r2=1.111.2.4.2.5.2.7&diff_format=u Index: php-src/ext/dba/dba.c diff -u php-src/ext/dba/dba.c:1.111.2.4.2.5.2.6 php-src/ext/dba/dba.c:1.111.2.4.2.5.2.7 --- php-src/ext/dba/dba.c:1.111.2.4.2.5.2.6 Sun Nov 2 21:19:31 2008 +++ php-src/ext/dba/dba.c Fri Nov 7 12:39:11 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: dba.c,v 1.111.2.4.2.5.2.6 2008/11/02 21:19:31 felipe Exp $ */ +/* $Id: dba.c,v 1.111.2.4.2.5.2.7 2008/11/07 12:39:11 indeyets Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -207,33 +207,28 @@ /* {{{ macromania */ #define DBA_ID_PARS \ - zval **id; \ + zval *id; \ dba_info *info = NULL; \ int ac = ZEND_NUM_ARGS() /* these are used to get the standard arguments */ -#define DBA_GET1 \ - if(ac != 1 || zend_get_parameters_ex(ac, &id) != SUCCESS) { \ - WRONG_PARAM_COUNT; \ - } - /* {{{ php_dba_myke_key */ -static size_t php_dba_make_key(zval **key, char **key_str, char **key_free TSRMLS_DC) +static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS_DC) { - if (Z_TYPE_PP(key) == IS_ARRAY) { + if (Z_TYPE_P(key) == IS_ARRAY) { zval **group, **name; HashPosition pos; size_t len; - if (zend_hash_num_elements(Z_ARRVAL_PP(key)) != 2) { + if (zend_hash_num_elements(Z_ARRVAL_P(key)) != 2) { php_error_docref(NULL TSRMLS_CC, E_RECOVERABLE_ERROR, "Key does not have exactly two elements: (key, name)"); return -1; } - zend_hash_internal_pointer_reset_ex(Z_ARRVAL_PP(key), &pos); - zend_hash_get_current_data_ex(Z_ARRVAL_PP(key), (void **) &group, &pos); - zend_hash_move_forward_ex(Z_ARRVAL_PP(key), &pos); - zend_hash_get_current_data_ex(Z_ARRVAL_PP(key), (void **) &name, &pos); + zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(key), &pos); + zend_hash_get_current_data_ex(Z_ARRVAL_P(key), (void **) &group, &pos); + zend_hash_move_forward_ex(Z_ARRVAL_P(key), &pos); + zend_hash_get_current_data_ex(Z_ARRVAL_P(key), (void **) &name, &pos); convert_to_string_ex(group); convert_to_string_ex(name); if (Z_STRLEN_PP(group) == 0) { @@ -245,43 +240,42 @@ *key_free = *key_str; return len; } else { - convert_to_string_ex(key); - *key_str = Z_STRVAL_PP(key); *key_free = NULL; - return Z_STRLEN_PP(key); + + convert_to_string(key); + *key_str = Z_STRVAL_P(key); + + return Z_STRLEN_P(key); } } /* }}} */ #define DBA_GET2 \ - zval **key; \ + zval *key; \ char *key_str, *key_free; \ size_t key_len; \ - if(ac != 2 || zend_get_parameters_ex(ac, &key, &id) != SUCCESS) { \ - WRONG_PARAM_COUNT; \ + if (zend_parse_parameters(ac TSRMLS_CC, "zr", &key, &id) == FAILURE) { \ + return; \ } \ if ((key_len = php_dba_make_key(key, &key_str, &key_free TSRMLS_CC)) == 0) {\ RETURN_FALSE; \ } #define DBA_GET2_3
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/dba dba.c dba_db4.c /ext/dba/tests dba_db4.phpt
sixdThu Jun 19 22:39:56 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/dbadba.c dba_db4.c /php-src/ext/dba/tests dba_db4.phpt Log: MFH: Fix bug #45266 (Fix build with BDB 4) Fix bug #45267 (Revert invalid assumption about BDB 4 locking; let DBA handle locking) Fix bug #45268 (Fix error callback prototype) http://cvs.php.net/viewvc.cgi/php-src/ext/dba/dba.c?r1=1.111.2.4.2.5.2.3&r2=1.111.2.4.2.5.2.4&diff_format=u Index: php-src/ext/dba/dba.c diff -u php-src/ext/dba/dba.c:1.111.2.4.2.5.2.3 php-src/ext/dba/dba.c:1.111.2.4.2.5.2.4 --- php-src/ext/dba/dba.c:1.111.2.4.2.5.2.3 Mon Mar 10 22:12:33 2008 +++ php-src/ext/dba/dba.c Thu Jun 19 22:39:56 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: dba.c,v 1.111.2.4.2.5.2.3 2008/03/10 22:12:33 felipe Exp $ */ +/* $Id: dba.c,v 1.111.2.4.2.5.2.4 2008/06/19 22:39:56 sixd Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -360,7 +360,7 @@ DBA_HND(db3, DBA_LOCK_ALL) /* No lock in lib */ #endif #if DBA_DB4 - DBA_HND(db4, DBA_LOCK_EXT) /* Locking done in library itself */ + DBA_HND(db4, DBA_LOCK_ALL) /* No lock in lib */ #endif #if DBA_INIFILE DBA_HND(inifile, DBA_STREAM_OPEN|DBA_LOCK_ALL|DBA_CAST_AS_FD) /* No lock in lib */ http://cvs.php.net/viewvc.cgi/php-src/ext/dba/dba_db4.c?r1=1.15.2.3.2.1.2.1&r2=1.15.2.3.2.1.2.2&diff_format=u Index: php-src/ext/dba/dba_db4.c diff -u php-src/ext/dba/dba_db4.c:1.15.2.3.2.1.2.1 php-src/ext/dba/dba_db4.c:1.15.2.3.2.1.2.2 --- php-src/ext/dba/dba_db4.c:1.15.2.3.2.1.2.1 Mon Dec 31 07:17:07 2007 +++ php-src/ext/dba/dba_db4.c Thu Jun 19 22:39:56 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: dba_db4.c,v 1.15.2.3.2.1.2.1 2007/12/31 07:17:07 sebastian Exp $ */ +/* $Id: dba_db4.c,v 1.15.2.3.2.1.2.2 2008/06/19 22:39:56 sixd Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -36,7 +36,11 @@ #include #endif -static void php_dba_db4_errcall_fcn(const char *errpfx, char *msg) +static void php_dba_db4_errcall_fcn( +#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3) + const DB_ENV *dbenv, +#endif + const char *errpfx, const char *msg) { TSRMLS_FETCH(); @@ -81,7 +85,6 @@ return FAILURE; /* not possible */ } - gmode |= DB_INIT_LOCK; if (info->flags & DBA_PERSISTENT) { gmode |= DB_THREAD; } @@ -91,10 +94,6 @@ filemode = Z_LVAL_PP(info->argv[0]); } -#ifdef DB_FCNTL_LOCKING - gmode |= DB_FCNTL_LOCKING; -#endif - if ((err=db_create(&dbp, NULL, 0)) == 0) { dbp->set_errcall(dbp, php_dba_db4_errcall_fcn); if ( http://cvs.php.net/viewvc.cgi/php-src/ext/dba/tests/dba_db4.phpt?r1=1.4.4.1&r2=1.4.4.1.4.1&diff_format=u Index: php-src/ext/dba/tests/dba_db4.phpt diff -u php-src/ext/dba/tests/dba_db4.phpt:1.4.4.1 php-src/ext/dba/tests/dba_db4.phpt:1.4.4.1.4.1 --- php-src/ext/dba/tests/dba_db4.phpt:1.4.4.1 Thu Dec 8 19:35:05 2005 +++ php-src/ext/dba/tests/dba_db4.phpt Thu Jun 19 22:39:56 2008 @@ -9,7 +9,6 @@ ===DONE=== @@ -18,7 +17,22 @@ 3NYNYY Content String 2 Content 2 replaced -Read during write: allowed +Read during write: not allowed +Content 2 replaced 2nd time +The 6th value +array(3) { + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" +} +--NO-LOCK-- +3NYNYY +Content String 2 +Content 2 replaced +Read during write: not allowed Content 2 replaced 2nd time The 6th value array(3) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php