@@ -47,26 +47,22 @@ PHONGO_API zend_class_entry *php_phongo_writeconcern_ce;
4747
4848zend_object_handlers php_phongo_handler_writeconcern ;
4949
50- /* {{{ proto MongoDB\Driver\WriteConcern WriteConcern::__construct(integer|string $w[, integer $wtimeout[, boolean $journal[, boolean $fsync] ]])
50+ /* {{{ proto MongoDB\Driver\WriteConcern WriteConcern::__construct(integer|string $w[, integer $wtimeout[, boolean $journal]])
5151 Constructs a new WriteConcern */
5252PHP_METHOD (WriteConcern , __construct )
5353{
5454 php_phongo_writeconcern_t * intern ;
5555 zend_error_handling error_handling ;
56- zval * w ;
56+ zval * w , * journal ;
5757 long wtimeout = 0 ;
58- zend_bool journal = 0 ;
59- zend_bool journal_is_null = 0 ;
60- zend_bool fsync = 0 ;
61- zend_bool fsync_is_null = 0 ;
6258
6359 (void )return_value ; (void )return_value_ptr ; (void )return_value_used ;
6460
6561
6662 zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
6763 intern = (php_phongo_writeconcern_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
6864
69- if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "z|lb!b! " , & w , & wtimeout , & journal , & journal_is_null , & fsync , & fsync_is_null ) == FAILURE ) {
65+ if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "z|lz " , & w , & wtimeout , & journal ) == FAILURE ) {
7066 zend_restore_error_handling (& error_handling TSRMLS_CC );
7167 return ;
7268 }
@@ -93,14 +89,9 @@ PHP_METHOD(WriteConcern, __construct)
9389 }
9490
9591 switch (ZEND_NUM_ARGS ()) {
96- case 4 :
97- if (!fsync_is_null ) {
98- mongoc_write_concern_set_fsync (intern -> write_concern , fsync );
99- }
100- /* fallthrough */
10192 case 3 :
102- if (! journal_is_null ) {
103- mongoc_write_concern_set_journal (intern -> write_concern , journal );
93+ if (Z_TYPE_P ( journal ) != IS_NULL ) {
94+ mongoc_write_concern_set_journal (intern -> write_concern , Z_BVAL_P ( journal ) );
10495 }
10596 /* fallthrough */
10697 case 2 :
@@ -184,37 +175,15 @@ PHP_METHOD(WriteConcern, getJournal)
184175}
185176/* }}} */
186177
187- /* {{{ proto null|boolean WriteConcern::getFsync()
188- Returns the WriteConcern "fsync" option */
189- PHP_METHOD (WriteConcern , getFsync )
190- {
191- php_phongo_writeconcern_t * intern ;
192- (void )return_value_ptr ; (void )return_value_used ;
193-
194- intern = (php_phongo_writeconcern_t * )zend_object_store_get_object (getThis () TSRMLS_CC );
195-
196- if (zend_parse_parameters_none () == FAILURE ) {
197- return ;
198- }
199-
200- if (intern -> write_concern -> fsync_ != MONGOC_WRITE_CONCERN_FSYNC_DEFAULT ) {
201- RETURN_BOOL (mongoc_write_concern_get_fsync (intern -> write_concern ));
202- }
203-
204- RETURN_NULL ();
205- }
206- /* }}} */
207-
208178/**
209179 * Value object for write concern used in issuing write operations.
210180 */
211181/* {{{ MongoDB\Driver\WriteConcern */
212182
213183ZEND_BEGIN_ARG_INFO_EX (ai_WriteConcern___construct , 0 , 0 , 1 )
214- ZEND_ARG_INFO (0 , wstring )
184+ ZEND_ARG_INFO (0 , w )
215185 ZEND_ARG_INFO (0 , wtimeout )
216186 ZEND_ARG_INFO (0 , journal )
217- ZEND_ARG_INFO (0 , fsync )
218187ZEND_END_ARG_INFO ();
219188
220189ZEND_BEGIN_ARG_INFO_EX (ai_WriteConcern_getW , 0 , 0 , 0 )
@@ -226,15 +195,11 @@ ZEND_END_ARG_INFO();
226195ZEND_BEGIN_ARG_INFO_EX (ai_WriteConcern_getJournal , 0 , 0 , 0 )
227196ZEND_END_ARG_INFO ();
228197
229- ZEND_BEGIN_ARG_INFO_EX (ai_WriteConcern_getFsync , 0 , 0 , 0 )
230- ZEND_END_ARG_INFO ();
231-
232198static zend_function_entry php_phongo_writeconcern_me [] = {
233199 PHP_ME (WriteConcern , __construct , ai_WriteConcern___construct , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
234200 PHP_ME (WriteConcern , getW , ai_WriteConcern_getW , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
235201 PHP_ME (WriteConcern , getWtimeout , ai_WriteConcern_getWtimeout , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
236202 PHP_ME (WriteConcern , getJournal , ai_WriteConcern_getJournal , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
237- PHP_ME (WriteConcern , getFsync , ai_WriteConcern_getFsync , ZEND_ACC_PUBLIC |ZEND_ACC_FINAL )
238203 PHP_FE_END
239204};
240205
0 commit comments