summaryrefslogtreecommitdiff
path: root/wrappers/php/src/Impl
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-09-20 15:07:40 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-09-20 15:07:40 +0200
commit2a619ceba75a4c16b25de12d59a87eac795a4468 (patch)
tree1d63a35217011fa761b703633b3f91fd839ec71e /wrappers/php/src/Impl
parent7e309b67de74fe5bd5a1c70c1880c2a381c4f78b (diff)
Remove: unused wrappers
Diffstat (limited to 'wrappers/php/src/Impl')
-rw-r--r--wrappers/php/src/Impl/GoSlice.php43
1 files changed, 0 insertions, 43 deletions
diff --git a/wrappers/php/src/Impl/GoSlice.php b/wrappers/php/src/Impl/GoSlice.php
deleted file mode 100644
index b285cfd..0000000
--- a/wrappers/php/src/Impl/GoSlice.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php declare(strict_types=1);
-
-/** @internal */
-
-namespace EduVpn\Common\Impl;
-
-use FFI;
-use FFI\CData;
-use RuntimeException;
-
-/** @internal */
-class GoSlice
-{
- // Will be destroyed along with this GoSlice
- private CData $cData, $slice;
-
- public function __construct(FFI $ffi, string $data)
- {
- $len = strlen($data);
- $cData = FFI::new(FFI::arrayType(FFI::type('char'), [$len]), false);
- if ($cData === null) throw new RuntimeException('error allocating buffer');
- $this->cData = $cData;
- FFI::memcpy($cData, $data, $len);
-
- $slice = $ffi->new('GoSlice');
- if ($slice === null) throw new RuntimeException('error allocating buffer');
- $this->slice = $slice;
- $slice->data = FFI::addr($cData); // $cData must not be destroyed while $slice is in use
- $slice->cap = $slice->len = $len;
- }
-
- public function slice(): CData
- {
- return $this->slice;
- }
-
- public function __destruct()
- {
- // Make sure we do not unknowingly use a slice with deallocated data
- $this->slice->data = null;
- $this->slice->cap = $this->slice->len = 0;
- }
-}