Skip to content

Commit 908449d

Browse files
committed
Merge pull request #27
2 parents dd16db9 + aa59037 commit 908449d

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

php_phongo.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ php_phongo_writeresult_t *phongo_writeresult_init(zval *return_value, mongoc_wri
374374

375375
/* {{{ CRUD */
376376
/* Splits a namespace name into the database and collection names, allocated with estrdup. */
377-
bool phongo_split_namespace(char *namespace, char **dbname, char **cname) /* {{{ */
377+
bool phongo_split_namespace(const char *namespace, char **dbname, char **cname) /* {{{ */
378378
{
379379
char *dot = strchr(namespace, '.');
380380

@@ -416,7 +416,7 @@ void phongo_unwrap_exception(bool retval, zval *return_value TSRMLS_DC)
416416
}
417417
}
418418

419-
int phongo_execute_single_insert(mongoc_client_t *client, char *namespace, bson_t *doc, mongoc_write_concern_t *write_concern, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
419+
int phongo_execute_single_insert(mongoc_client_t *client, const char *namespace, const bson_t *doc, const mongoc_write_concern_t *write_concern, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
420420
{
421421
bool retval = false;
422422
mongoc_bulk_operation_t *bulk;
@@ -431,7 +431,7 @@ int phongo_execute_single_insert(mongoc_client_t *client, char *namespace, bson_
431431
return retval;
432432
} /* }}} */
433433

434-
int phongo_execute_single_update(mongoc_client_t *client, char *namespace, bson_t *query, bson_t *update, mongoc_write_concern_t *write_concern, mongoc_update_flags_t flags, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
434+
int phongo_execute_single_update(mongoc_client_t *client, const char *namespace, const bson_t *query, const bson_t *update, const mongoc_write_concern_t *write_concern, mongoc_update_flags_t flags, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
435435
{
436436
bool retval = false;
437437
mongoc_bulk_operation_t *bulk;
@@ -449,7 +449,7 @@ int phongo_execute_single_update(mongoc_client_t *client, char *namespace, bson_
449449
return retval;
450450
} /* }}} */
451451

452-
int phongo_execute_single_delete(mongoc_client_t *client, char *namespace, bson_t *query, mongoc_write_concern_t *write_concern, mongoc_delete_flags_t flags, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
452+
int phongo_execute_single_delete(mongoc_client_t *client, const char *namespace, const bson_t *query, const mongoc_write_concern_t *write_concern, mongoc_delete_flags_t flags, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
453453
{
454454
bool retval = false;
455455
mongoc_bulk_operation_t *bulk;
@@ -468,7 +468,7 @@ int phongo_execute_single_delete(mongoc_client_t *client, char *namespace, bson_
468468
return retval;
469469
} /* }}} */
470470

471-
bool phongo_execute_write(mongoc_client_t *client, char *namespace, mongoc_bulk_operation_t *bulk, mongoc_write_concern_t *write_concern, int server_hint, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
471+
bool phongo_execute_write(mongoc_client_t *client, const char *namespace, mongoc_bulk_operation_t *bulk, const mongoc_write_concern_t *write_concern, int server_hint, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
472472
{
473473
bson_error_t error;
474474
char *dbname;
@@ -535,7 +535,7 @@ bool phongo_execute_write(mongoc_client_t *client, char *namespace, mongoc_bulk_
535535
return true;
536536
} /* }}} */
537537

538-
int phongo_execute_query(mongoc_client_t *client, char *namespace, php_phongo_query_t *query, mongoc_read_prefs_t *read_preference, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
538+
int phongo_execute_query(mongoc_client_t *client, const char *namespace, const php_phongo_query_t *query, const mongoc_read_prefs_t *read_preference, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
539539
{
540540
const bson_t *doc = NULL;
541541
mongoc_cursor_t *cursor;
@@ -581,7 +581,7 @@ int phongo_execute_query(mongoc_client_t *client, char *namespace, php_phongo_qu
581581
return true;
582582
} /* }}} */
583583

584-
int phongo_execute_command(mongoc_client_t *client, char *db, bson_t *command, mongoc_read_prefs_t *read_preference, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
584+
int phongo_execute_command(mongoc_client_t *client, const char *db, const bson_t *command, const mongoc_read_prefs_t *read_preference, zval *return_value, int return_value_used TSRMLS_DC) /* {{{ */
585585
{
586586
mongoc_cursor_t *cursor;
587587
const bson_t *doc;
@@ -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

@@ -1041,7 +1041,7 @@ void php_phongo_objectid_new_from_oid(zval *object, const bson_oid_t *oid TSRMLS
10411041
} /* }}} */
10421042

10431043

1044-
void php_phongo_read_preference_to_zval(zval *retval, mongoc_read_prefs_t *read_prefs) /* {{{ */
1044+
void php_phongo_read_preference_to_zval(zval *retval, const mongoc_read_prefs_t *read_prefs) /* {{{ */
10451045
{
10461046

10471047
array_init_size(retval, 2);
@@ -1058,17 +1058,17 @@ void php_phongo_read_preference_to_zval(zval *retval, mongoc_read_prefs_t *read_
10581058
}
10591059
} /* }}} */
10601060

1061-
void php_phongo_write_concern_to_zval(zval *retval, mongoc_write_concern_t *write_concern) /* {{{ */
1061+
void php_phongo_write_concern_to_zval(zval *retval, const mongoc_write_concern_t *write_concern) /* {{{ */
10621062
{
10631063
const char *wtag = mongoc_write_concern_get_wtag(write_concern);
10641064
const int32_t w = mongoc_write_concern_get_w(write_concern);
10651065

10661066
array_init_size(retval, 5);
10671067

10681068
if (wtag) {
1069-
add_assoc_string_ex(retval, ZEND_STRS("w"), wtag, 1);
1069+
add_assoc_string_ex(retval, ZEND_STRS("w"), (char *)wtag, 1);
10701070
} else if (mongoc_write_concern_get_wmajority(write_concern)) {
1071-
add_assoc_string_ex(retval, ZEND_STRS("w"), "majority", 1);
1071+
add_assoc_string_ex(retval, ZEND_STRS("w"), (char *)"majority", 1);
10721072
} else if (w != MONGOC_WRITE_CONCERN_W_DEFAULT) {
10731073
add_assoc_long_ex(retval, ZEND_STRS("w"), w);
10741074
}
@@ -1559,7 +1559,7 @@ void _phongo_debug_bson(bson_t *bson)
15591559

15601560
/* {{{ INI entries */
15611561
PHP_INI_BEGIN()
1562-
STD_PHP_INI_ENTRY("phongo.debug_log", (char *)"", PHP_INI_ALL, OnUpdateString, debug_log, zend_phongo_globals, phongo_globals)
1562+
STD_PHP_INI_ENTRY((char *)"phongo.debug_log", (char *)"", PHP_INI_ALL, OnUpdateString, debug_log, zend_phongo_globals, phongo_globals)
15631563
PHP_INI_END()
15641564
/* }}} */
15651565

php_phongo.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,22 +105,22 @@ PHONGO_API zend_object_handlers *phongo_get_std_object_handlers(void);
105105
void phongo_server_init (zval *return_value, int server_hint, mongoc_host_list_t *host TSRMLS_DC);
106106
bool phongo_query_init (php_phongo_query_t *query, zval *filter, zval *options TSRMLS_DC);
107107
mongoc_bulk_operation_t* phongo_bulkwrite_init (zend_bool ordered);
108-
bool phongo_execute_write (mongoc_client_t *client, char *namespace, mongoc_bulk_operation_t *bulk, mongoc_write_concern_t *write_concern, int server_hint, zval *return_value, int return_value_used TSRMLS_DC);
109-
int phongo_execute_command (mongoc_client_t *client, char *db, bson_t *command, mongoc_read_prefs_t *read_preference, zval *return_value, int return_value_used TSRMLS_DC);
110-
int phongo_execute_query (mongoc_client_t *client, char *namespace, php_phongo_query_t *query, mongoc_read_prefs_t *read_preference, zval *return_value, int return_value_used TSRMLS_DC);
111-
int phongo_execute_single_insert(mongoc_client_t *client, char *namespace, bson_t *doc, mongoc_write_concern_t *write_concern, zval *return_value, int return_value_used TSRMLS_DC);
112-
int phongo_execute_single_update(mongoc_client_t *client, char *namespace, bson_t *query, bson_t *update, mongoc_write_concern_t *write_concern, mongoc_update_flags_t flags, zval *return_value, int return_value_used TSRMLS_DC);
113-
int phongo_execute_single_delete(mongoc_client_t *client, char *namespace, bson_t *query, mongoc_write_concern_t *write_concern, mongoc_delete_flags_t flags, zval *return_value, int return_value_used TSRMLS_DC);
108+
bool phongo_execute_write (mongoc_client_t *client, const char *namespace, mongoc_bulk_operation_t *bulk, const mongoc_write_concern_t *write_concern, int server_hint, zval *return_value, int return_value_used TSRMLS_DC);
109+
int phongo_execute_command (mongoc_client_t *client, const char *db, const bson_t *command, const mongoc_read_prefs_t *read_preference, zval *return_value, int return_value_used TSRMLS_DC);
110+
int phongo_execute_query (mongoc_client_t *client, const char *namespace, const php_phongo_query_t *query, const mongoc_read_prefs_t *read_preference, zval *return_value, int return_value_used TSRMLS_DC);
111+
int phongo_execute_single_insert(mongoc_client_t *client, const char *namespace, const bson_t *doc, const mongoc_write_concern_t *write_concern, zval *return_value, int return_value_used TSRMLS_DC);
112+
int phongo_execute_single_update(mongoc_client_t *client, const char *namespace, const bson_t *query, const bson_t *update, const mongoc_write_concern_t *write_concern, mongoc_update_flags_t flags, zval *return_value, int return_value_used TSRMLS_DC);
113+
int phongo_execute_single_delete(mongoc_client_t *client, const char *namespace, const bson_t *query, const mongoc_write_concern_t *write_concern, mongoc_delete_flags_t flags, zval *return_value, int return_value_used TSRMLS_DC);
114114

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

122-
void php_phongo_read_preference_to_zval(zval *retval, mongoc_read_prefs_t *read_prefs);
123-
void php_phongo_write_concern_to_zval(zval *retval, mongoc_write_concern_t *write_concern);
122+
void php_phongo_read_preference_to_zval(zval *retval, const mongoc_read_prefs_t *read_prefs);
123+
void php_phongo_write_concern_to_zval(zval *retval, const mongoc_write_concern_t *write_concern);
124124
void php_phongo_result_to_zval(zval *retval, php_phongo_result_t *result);
125125

126126
void php_phongo_objectid_new_from_oid(zval *object, const bson_oid_t *oid TSRMLS_DC);

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)