Skip to content

Commit

Permalink
Avoid copy addresses array
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana committed Jan 24, 2025
1 parent 76a43d0 commit c6f363d
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions appsec/src/extension/ddappsec.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,23 +498,8 @@ static PHP_FUNCTION(datadog_appsec_push_addresses)
return;
}

zend_array *parameters_arr =
zend_new_array(zend_hash_num_elements(addresses));
zval parameters_zv;
ZVAL_ARR(&parameters_zv, parameters_arr);

zend_string *key;
zval *value;
ZEND_HASH_FOREACH_STR_KEY_VAL(addresses, key, value)
{
if (!key) {
continue;
}

zend_hash_add(Z_ARRVAL(parameters_zv), key, value);
Z_TRY_ADDREF_P(value);
}
ZEND_HASH_FOREACH_END();
ZVAL_ARR(&parameters_zv, addresses);

dd_conn *conn = dd_helper_mgr_cur_conn();
if (conn == NULL) {
Expand Down

0 comments on commit c6f363d

Please sign in to comment.