Skip to content

Commit

Permalink
Merge branch 'extism:main' into bugfix/php-7.4-host-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
oatmael authored Jul 3, 2024
2 parents e1cba43 + 6ab7293 commit c32d331
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/LibExtism.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function extism_current_plugin_memory_length(FFI\CData $plugin, int $offset): in
return $this->ffi->extism_current_plugin_memory_length($plugin, $offset);
}

function extism_plugin_new(string $wasm, int $wasm_size, FFI\CData $functions, int $n_functions, bool $with_wasi, ?FFI\CData $errmsg): FFI\CData|null
function extism_plugin_new(string $wasm, int $wasm_size, FFI\CData $functions, int $n_functions, bool $with_wasi, ?FFI\CData $errmsg): ?FFI\CData
{
$ptr = $this->owned("uint8_t", $wasm);
$wasi = $with_wasi ? 1 : 0;
Expand Down Expand Up @@ -154,7 +154,7 @@ function extism_function_set_namespace(FFI\CData $handle, string $name)
$this->ffi->extism_function_set_namespace($handle, $namePtr);
}

function toCArray(array $array, string $type): FFI\CData | null
function toCArray(array $array, string $type): ?FFI\CData
{
if (count($array) == 0) {
return $this->ffi->new($type . "*");
Expand All @@ -168,7 +168,7 @@ function toCArray(array $array, string $type): FFI\CData | null
return $cArray;
}

function owned(string $type, string $string): FFI\CData|null
function owned(string $type, string $string): ?FFI\CData
{
if (strlen($string) == 0) {
return null;
Expand All @@ -179,7 +179,7 @@ function owned(string $type, string $string): FFI\CData|null
return $str;
}

function ownedZero(string $string): FFI\CData|null
function ownedZero(string $string): ?FFI\CData
{
return $this->owned("char", "$string\0");
}
Expand All @@ -189,4 +189,4 @@ function startsWith($haystack, $needle) {
}
}

?>
?>

0 comments on commit c32d331

Please sign in to comment.