Skip to content

Commit aa59037

Browse files
committed
Return const struct pointers from zval getters
1 parent b5f8c34 commit aa59037

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

php_phongo.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ mongoc_stream_t* phongo_stream_initiator(const mongoc_uri_t *uri, const mongoc_h
897897

898898
/* }}} */
899899

900-
mongoc_write_concern_t* phongo_write_concern_from_zval(zval *zwrite_concern TSRMLS_DC) /* {{{ */
900+
const mongoc_write_concern_t* phongo_write_concern_from_zval(zval *zwrite_concern TSRMLS_DC) /* {{{ */
901901
{
902902
if (zwrite_concern) {
903903
php_phongo_writeconcern_t *intern = (php_phongo_writeconcern_t *)zend_object_store_get_object(zwrite_concern TSRMLS_CC);
@@ -910,7 +910,7 @@ mongoc_write_concern_t* phongo_write_concern_from_zval(zval *zwrite_concern TSRM
910910
return NULL;
911911
} /* }}} */
912912

913-
mongoc_read_prefs_t* phongo_read_preference_from_zval(zval *zread_preference TSRMLS_DC) /* {{{ */
913+
const mongoc_read_prefs_t* phongo_read_preference_from_zval(zval *zread_preference TSRMLS_DC) /* {{{ */
914914
{
915915
if (zread_preference) {
916916
php_phongo_readpreference_t *intern = (php_phongo_readpreference_t *)zend_object_store_get_object(zread_preference TSRMLS_CC);
@@ -923,7 +923,7 @@ mongoc_read_prefs_t* phongo_read_preference_from_zval(zval *zread_preference TSR
923923
return NULL;
924924
} /* }}} */
925925

926-
php_phongo_query_t* phongo_query_from_zval(zval *zquery TSRMLS_DC) /* {{{ */
926+
const php_phongo_query_t* phongo_query_from_zval(zval *zquery TSRMLS_DC) /* {{{ */
927927
{
928928
php_phongo_query_t *intern = (php_phongo_query_t *)zend_object_store_get_object(zquery TSRMLS_CC);
929929

php_phongo.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ int phongo_execute_single_delete(mongoc_client_t *client, c
115115
mongoc_stream_t* phongo_stream_initiator (const mongoc_uri_t *uri, const mongoc_host_list_t *host, void *user_data, bson_error_t *error);
116116
zend_object_iterator* phongo_result_get_iterator (zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
117117
zend_object_iterator* phongo_cursor_get_iterator (zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
118-
mongoc_read_prefs_t* phongo_read_preference_from_zval(zval *zread_preference TSRMLS_DC);
119-
mongoc_write_concern_t* phongo_write_concern_from_zval (zval *zwrite_concern TSRMLS_DC);
120-
php_phongo_query_t* phongo_query_from_zval (zval *zquery TSRMLS_DC);
118+
const mongoc_read_prefs_t* phongo_read_preference_from_zval(zval *zread_preference TSRMLS_DC);
119+
const mongoc_write_concern_t* phongo_write_concern_from_zval (zval *zwrite_concern TSRMLS_DC);
120+
const php_phongo_query_t* phongo_query_from_zval (zval *zquery TSRMLS_DC);
121121

122122
void php_phongo_read_preference_to_zval(zval *retval, const mongoc_read_prefs_t *read_prefs);
123123
void php_phongo_write_concern_to_zval(zval *retval, const mongoc_write_concern_t *write_concern);

src/MongoDB/ReadPreference.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ zend_object_value php_phongo_readpreference_create_object(zend_class_entry *clas
147147
HashTable *php_phongo_readpreference_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
148148
{
149149
zval retval = zval_used_for_init;
150-
mongoc_read_prefs_t *read_prefs = phongo_read_preference_from_zval(object TSRMLS_CC);
150+
const mongoc_read_prefs_t *read_prefs = phongo_read_preference_from_zval(object TSRMLS_CC);
151151

152152

153153
*is_temp = 1;

src/MongoDB/WriteConcern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ zend_object_value php_phongo_writeconcern_create_object(zend_class_entry *class_
157157
HashTable *php_phongo_writeconcern_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */
158158
{
159159
zval retval = zval_used_for_init;
160-
mongoc_write_concern_t *write_concern = phongo_write_concern_from_zval(object TSRMLS_CC);
160+
const mongoc_write_concern_t *write_concern = phongo_write_concern_from_zval(object TSRMLS_CC);
161161

162162

163163
*is_temp = 1;

0 commit comments

Comments
 (0)