0
0
mirror of https://github.com/phpv8/v8js.git synced 2025-01-06 19:51:51 +00:00

Use zend_string with zend_parse_parameters

This commit is contained in:
Stefan Siegl 2016-03-05 22:43:57 +01:00
parent bf6effba63
commit 25cf46aa0c

View File

@ -1056,14 +1056,13 @@ static PHP_METHOD(V8Js, getExtensions)
*/ */
static PHP_METHOD(V8Js, createSnapshot) static PHP_METHOD(V8Js, createSnapshot)
{ {
char *script; zend_string *script;
int script_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &script, &script_len) == FAILURE) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &script) == FAILURE) {
return; return;
} }
if (!script_len) { if (!ZSTR_LEN(script)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Script cannot be empty"); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Script cannot be empty");
RETURN_FALSE; RETURN_FALSE;
} }
@ -1071,7 +1070,7 @@ static PHP_METHOD(V8Js, createSnapshot)
/* Initialize V8, if not already done. */ /* Initialize V8, if not already done. */
v8js_v8_init(TSRMLS_C); v8js_v8_init(TSRMLS_C);
v8::StartupData snapshot_blob = v8::V8::CreateSnapshotDataBlob(script); v8::StartupData snapshot_blob = v8::V8::CreateSnapshotDataBlob(ZSTR_VAL(script));
if (!snapshot_blob.data) { if (!snapshot_blob.data) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create V8 heap snapshot. Check $embed_source for errors."); php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create V8 heap snapshot. Check $embed_source for errors.");