Skip to content

Commit 0bf7264

Browse files
committed
Use zend_hash ptr functions for PHP7
1 parent 017d0fe commit 0bf7264

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

php_phongo.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,8 +1511,7 @@ void phongo_manager_init(php_phongo_manager_t *manager, const char *uri_string,
15111511
bson_iter_t iter;
15121512

15131513
#if PHP_VERSION_ID >= 70000
1514-
zval *client_ptr;
1515-
zval new_client_ptr;
1514+
mongoc_client_t *client_ptr;
15161515
#else
15171516
mongoc_client_t **client_ptr;
15181517
#endif
@@ -1523,9 +1522,9 @@ void phongo_manager_init(php_phongo_manager_t *manager, const char *uri_string,
15231522
}
15241523

15251524
#if PHP_VERSION_ID >= 70000
1526-
if ((client_ptr = zend_hash_str_find(&MONGODB_G(clients), hash, hash_len)) && Z_TYPE_P(client_ptr) == IS_PTR) {
1525+
if ((client_ptr = zend_hash_str_find_ptr(&MONGODB_G(clients), hash, hash_len)) != NULL) {
15271526
MONGOC_DEBUG("Found client for hash: %s\n", hash);
1528-
manager->client = (mongoc_client_t *)Z_PTR_P(client_ptr);
1527+
manager->client = client_ptr;
15291528
goto cleanup;
15301529
}
15311530
#else
@@ -1582,8 +1581,7 @@ void phongo_manager_init(php_phongo_manager_t *manager, const char *uri_string,
15821581

15831582
MONGOC_DEBUG("Created client hash: %s\n", hash);
15841583
#if PHP_VERSION_ID >= 70000
1585-
ZVAL_PTR(&new_client_ptr, manager->client);
1586-
zend_hash_str_update(&MONGODB_G(clients), hash, hash_len, &new_client_ptr);
1584+
zend_hash_str_update_ptr(&MONGODB_G(clients), hash, hash_len, manager->client);
15871585
#else
15881586
zend_hash_update(&MONGODB_G(clients), hash, hash_len + 1, &manager->client, sizeof(mongoc_client_t *), NULL);
15891587
#endif

0 commit comments

Comments
 (0)