aboutsummaryrefslogtreecommitdiff
path: root/forged/internal/misc/unsafe.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-08-12 11:01:07 +0800
committerRunxi Yu <me@runxiyu.org>2025-09-16 08:58:16 +0800
commitc12fe030fe5935882047e75ac8a3792faea27574 (patch)
treee2b6f795410348596a7965694bed7e85511d0874 /forged/internal/misc/unsafe.go
parentRemove forge-specific functions from misc (diff)
downloadforge-c12fe030fe5935882047e75ac8a3792faea27574.tar.gz
forge-c12fe030fe5935882047e75ac8a3792faea27574.tar.zst
forge-c12fe030fe5935882047e75ac8a3792faea27574.zip
RefactorHEADmaster
Diffstat (limited to 'forged/internal/misc/unsafe.go')
-rw-r--r--forged/internal/misc/unsafe.go20
1 files changed, 0 insertions, 20 deletions
diff --git a/forged/internal/misc/unsafe.go b/forged/internal/misc/unsafe.go
deleted file mode 100644
index 6c2192f..0000000
--- a/forged/internal/misc/unsafe.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: AGPL-3.0-only
-// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
-
-package misc
-
-import "unsafe"
-
-// StringToBytes converts a string to a byte slice without copying the string.
-// Memory is borrowed from the string.
-// The resulting byte slice must not be modified in any form.
-func StringToBytes(s string) (bytes []byte) {
- return unsafe.Slice(unsafe.StringData(s), len(s))
-}
-
-// BytesToString converts a byte slice to a string without copying the bytes.
-// Memory is borrowed from the byte slice.
-// The source byte slice must not be modified.
-func BytesToString(b []byte) string {
- return unsafe.String(unsafe.SliceData(b), len(b))
-}