Permalink
Browse files

Merged pull request mongodb#931

  • Loading branch information...
derickr committed Oct 3, 2018
2 parents 8de5632 + 55eb5b3 commit 605469f835fbf7b4f7b5c4e2d6d5c669db108d0e
View
@@ -81,7 +81,6 @@
#define phongo_get_gc_table zval**
#define PHONGO_ALLOC_OBJECT_T(_obj_t, _class_type) (_obj_t*) ecalloc(1, sizeof(_obj_t) + zend_object_properties_size(_class_type))
#define PHONGO_TSRMLS_FETCH_FROM_CTX(user_data)
#define SUPPRESS_UNUSED_WARNING(x)
#define DECLARE_RETURN_VALUE_USED int return_value_used = 1;
#define EXCEPTION_P(_ex, _zp) ZVAL_OBJ(&_zp, _ex)
#define ADD_ASSOC_STRING(_zv, _key, _value) add_assoc_string_ex(_zv, ZEND_STRL(_key), (char*) (_value));
@@ -118,7 +117,6 @@
#define phongo_get_gc_table zval***
#define PHONGO_ALLOC_OBJECT_T(_obj_t, _class_type) (_obj_t*) ecalloc(1, sizeof(_obj_t))
#define PHONGO_TSRMLS_FETCH_FROM_CTX(user_data) TSRMLS_FETCH_FROM_CTX(user_data)
#define SUPPRESS_UNUSED_WARNING(x) (void) x;
#define DECLARE_RETURN_VALUE_USED
#define EXCEPTION_P(_ex, _zp) _zp = _ex
#define ADD_ASSOC_STRING(_zv, _key, _value) add_assoc_string_ex(_zv, ZEND_STRS(_key), (char*) (_value), 1);
View
@@ -209,8 +209,8 @@ static void phongo_exception_add_error_labels(bson_t* reply TSRMLS_DC)
bson_iter_recurse(&iter, &error_labels);
while (bson_iter_next(&error_labels)) {
if (BSON_ITER_HOLDS_UTF8(&error_labels)) {
const char* error_label;
uint32_t error_label_len;
const char* error_label;
uint32_t error_label_len;
error_label = bson_iter_utf8(&error_labels, &error_label_len);
#if PHP_VERSION_ID >= 70000
@@ -807,7 +807,7 @@ bool phongo_cursor_advance_and_check_for_error(mongoc_cursor_t* cursor TSRMLS_DC
bool phongo_execute_query(mongoc_client_t* client, const char* namespace, zval* zquery, zval* options, uint32_t server_id, zval* return_value, int return_value_used TSRMLS_DC) /* {{{ */
{
const php_phongo_query_t* query;
bson_t opts = BSON_INITIALIZER;
bson_t opts = BSON_INITIALIZER;
mongoc_cursor_t* cursor;
char* dbname;
char* collname;
View
@@ -36,10 +36,6 @@ PHP_FUNCTION(MongoDB_BSON_fromPHP)
zval* data;
bson_t* bson;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(this_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used) /* We don't use these */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "A", &data) == FAILURE) {
return;
}
@@ -60,10 +56,6 @@ PHP_FUNCTION(MongoDB_BSON_toPHP)
zval* typemap = NULL;
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(this_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used) /* We don't use these */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|a!", &data, &data_len, &typemap) == FAILURE) {
return;
}
@@ -96,10 +88,6 @@ PHP_FUNCTION(MongoDB_BSON_fromJSON)
bson_t bson = BSON_INITIALIZER;
bson_error_t error = { 0 };
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(this_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used) /* We don't use these */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &json, &json_len) == FAILURE) {
return;
}
@@ -122,10 +110,6 @@ static void phongo_bson_to_json(INTERNAL_FUNCTION_PARAMETERS, php_phongo_json_mo
char* json = NULL;
size_t json_len;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(this_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used) /* We don't use these */
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) {
return;
}
View
@@ -243,9 +243,6 @@ static PHP_METHOD(BulkWrite, __construct)
zend_error_handling error_handling;
zval* options = NULL;
zend_bool ordered = 1;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value)
SUPPRESS_UNUSED_WARNING(return_value_used)
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_BULKWRITE_OBJ_P(getThis());
@@ -283,7 +280,6 @@ static PHP_METHOD(BulkWrite, insert)
int bson_flags = PHONGO_BSON_ADD_ID;
bson_error_t error = { 0 };
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
intern = Z_BULKWRITE_OBJ_P(getThis());
@@ -326,9 +322,6 @@ static PHP_METHOD(BulkWrite, update)
zval * zquery, *zupdate, *zoptions = NULL;
bson_t bquery = BSON_INITIALIZER, bupdate = BSON_INITIALIZER, boptions = BSON_INITIALIZER;
bson_error_t error = { 0 };
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_BULKWRITE_OBJ_P(getThis());
@@ -392,9 +385,6 @@ static PHP_METHOD(BulkWrite, delete)
zval * zquery, *zoptions = NULL;
bson_t bquery = BSON_INITIALIZER, boptions = BSON_INITIALIZER;
bson_error_t error = { 0 };
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_BULKWRITE_OBJ_P(getThis());
@@ -436,9 +426,6 @@ static PHP_METHOD(BulkWrite, delete)
static PHP_METHOD(BulkWrite, count)
{
php_phongo_bulkwrite_t* intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_BULKWRITE_OBJ_P(getThis());
View
@@ -99,9 +99,6 @@ static PHP_METHOD(Command, __construct)
zend_error_handling error_handling;
zval* document;
zval* options = NULL;
SUPPRESS_UNUSED_WARNING(return_value)
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
intern = Z_COMMAND_OBJ_P(getThis());
View
@@ -224,9 +224,6 @@ static PHP_METHOD(Cursor, setTypeMap)
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
zval* typemap = NULL;
bool restore_current_element = false;
SUPPRESS_UNUSED_WARNING(return_value)
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSOR_OBJ_P(getThis());
@@ -297,9 +294,6 @@ static int php_phongo_cursor_to_array_apply(zend_object_iterator* iter, void* pu
Returns an array of all result documents for this cursor */
static PHP_METHOD(Cursor, toArray)
{
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
if (zend_parse_parameters_none() == FAILURE) {
return;
}
@@ -317,8 +311,6 @@ static PHP_METHOD(Cursor, toArray)
static PHP_METHOD(Cursor, getId)
{
php_phongo_cursor_t* intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSOR_OBJ_P(getThis());
@@ -334,8 +326,6 @@ static PHP_METHOD(Cursor, getId)
static PHP_METHOD(Cursor, getServer)
{
php_phongo_cursor_t* intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSOR_OBJ_P(getThis());
@@ -351,8 +341,6 @@ static PHP_METHOD(Cursor, getServer)
static PHP_METHOD(Cursor, isDead)
{
php_phongo_cursor_t* intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSOR_OBJ_P(getThis());
View
@@ -33,8 +33,6 @@ static PHP_METHOD(CursorId, __toString)
php_phongo_cursorid_t* intern;
char* tmp;
int tmp_len;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_CURSORID_OBJ_P(getThis());
@@ -52,7 +52,7 @@ static bool php_phongo_has_string_array_element(zval* labels, char* label TSRMLS
#else
{
HashPosition pos;
zval** z_label;
zval** z_label;
for (
zend_hash_internal_pointer_reset_ex(ht_data, &pos);
@@ -75,9 +75,9 @@ static bool php_phongo_has_string_array_element(zval* labels, char* label TSRMLS
Returns whether a specific error label has been set */
static PHP_METHOD(RuntimeException, hasErrorLabel)
{
char* label;
phongo_zpp_char_len label_len;
zval* error_labels;
char* label;
phongo_zpp_char_len label_len;
zval* error_labels;
#if PHP_VERSION_ID >= 70000
zval rv;
#endif
View
@@ -295,9 +295,6 @@ static PHP_METHOD(Manager, __construct)
phongo_zpp_char_len uri_string_len = 0;
zval* options = NULL;
zval* driverOptions = NULL;
SUPPRESS_UNUSED_WARNING(return_value)
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
zend_replace_error_handling(EH_THROW, phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), &error_handling TSRMLS_CC);
@@ -341,7 +338,6 @@ static PHP_METHOD(Manager, executeCommand)
zval* zreadPreference = NULL;
uint32_t server_id = 0;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|z!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
return;
@@ -381,7 +377,6 @@ static PHP_METHOD(Manager, executeReadCommand)
zval* zreadPreference = NULL;
uint32_t server_id = 0;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
return;
@@ -413,7 +408,6 @@ static PHP_METHOD(Manager, executeWriteCommand)
zval* options = NULL;
uint32_t server_id = 0;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
return;
@@ -440,7 +434,6 @@ static PHP_METHOD(Manager, executeReadWriteCommand)
zval* options = NULL;
uint32_t server_id = 0;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|a!", &db, &db_len, &command, php_phongo_command_ce, &options) == FAILURE) {
return;
@@ -469,7 +462,6 @@ static PHP_METHOD(Manager, executeQuery)
zval* zreadPreference = NULL;
uint32_t server_id = 0;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|z!", &namespace, &namespace_len, &query, php_phongo_query_ce, &options) == FAILURE) {
return;
@@ -510,7 +502,6 @@ static PHP_METHOD(Manager, executeBulkWrite)
bool free_options = false;
uint32_t server_id = 0;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sO|z!", &namespace, &namespace_len, &zbulk, php_phongo_bulkwrite_ce, &options) == FAILURE) {
return;
@@ -540,7 +531,6 @@ static PHP_METHOD(Manager, getReadConcern)
{
php_phongo_manager_t* intern;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
intern = Z_MANAGER_OBJ_P(getThis());
@@ -559,7 +549,6 @@ static PHP_METHOD(Manager, getReadPreference)
{
php_phongo_manager_t* intern;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
intern = Z_MANAGER_OBJ_P(getThis());
@@ -579,8 +568,6 @@ static PHP_METHOD(Manager, getServers)
php_phongo_manager_t* intern;
mongoc_server_description_t** sds;
size_t i, n = 0;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_MANAGER_OBJ_P(getThis());
@@ -615,7 +602,6 @@ static PHP_METHOD(Manager, getWriteConcern)
{
php_phongo_manager_t* intern;
DECLARE_RETURN_VALUE_USED
SUPPRESS_UNUSED_WARNING(return_value_ptr)
intern = Z_MANAGER_OBJ_P(getThis());
@@ -635,8 +621,6 @@ static PHP_METHOD(Manager, selectServer)
php_phongo_manager_t* intern;
zval* zreadPreference = NULL;
uint32_t server_id = 0;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_MANAGER_OBJ_P(getThis());
@@ -662,8 +646,6 @@ static PHP_METHOD(Manager, startSession)
mongoc_client_session_t* cs;
bson_error_t error = { 0 };
mongoc_transaction_opt_t* txn_opts = NULL;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_MANAGER_OBJ_P(getThis());
@@ -684,8 +666,7 @@ static PHP_METHOD(Manager, startSession)
phongo_throw_exception(
PHONGO_ERROR_INVALID_ARGUMENT TSRMLS_CC,
"Expected \"defaultTransactionOptions\" option to be an array, %s given",
PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(txn_options)
);
PHONGO_ZVAL_CLASS_OR_TYPE_NAME_P(txn_options));
goto cleanup;
}
@@ -31,8 +31,6 @@ zend_class_entry* php_phongo_commandfailedevent_ce;
PHP_METHOD(CommandFailedEvent, getCommandName)
{
php_phongo_commandfailedevent_t* intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
@@ -48,8 +46,6 @@ PHP_METHOD(CommandFailedEvent, getCommandName)
PHP_METHOD(CommandFailedEvent, getDurationMicros)
{
php_phongo_commandfailedevent_t* intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
@@ -65,8 +61,6 @@ PHP_METHOD(CommandFailedEvent, getDurationMicros)
PHP_METHOD(CommandFailedEvent, getError)
{
php_phongo_commandfailedevent_t* intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
@@ -87,8 +81,6 @@ PHP_METHOD(CommandFailedEvent, getOperationId)
{
php_phongo_commandfailedevent_t* intern;
char int_as_string[20];
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
@@ -106,8 +98,6 @@ PHP_METHOD(CommandFailedEvent, getReply)
{
php_phongo_commandfailedevent_t* intern;
php_phongo_bson_state state = PHONGO_BSON_STATE_INITIALIZER;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
@@ -129,8 +119,6 @@ PHP_METHOD(CommandFailedEvent, getRequestId)
{
php_phongo_commandfailedevent_t* intern;
char int_as_string[20];
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
@@ -147,8 +135,6 @@ PHP_METHOD(CommandFailedEvent, getRequestId)
PHP_METHOD(CommandFailedEvent, getServer)
{
php_phongo_commandfailedevent_t* intern;
SUPPRESS_UNUSED_WARNING(return_value_ptr)
SUPPRESS_UNUSED_WARNING(return_value_used)
intern = Z_COMMANDFAILEDEVENT_OBJ_P(getThis());
Oops, something went wrong.

0 comments on commit 605469f

Please sign in to comment.