summaryrefslogtreecommitdiff
path: root/internal/util/ptr.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-11-21 14:09:58 +0100
committerLibravatar GitHub <noreply@github.com>2024-11-21 13:09:58 +0000
commit301543616b5376585a7caff097499421acdf1806 (patch)
tree4cac6aea2c33687b1339fc3bc18e6eb64def6f9a /internal/util/ptr.go
parent[feature] Allow emoji shortcode to be 1-character length (#3556) (diff)
downloadgotosocial-301543616b5376585a7caff097499421acdf1806.tar.xz
[feature] Add domain permission drafts and excludes (#3547)
* [feature] Add domain permission drafts and excludes * fix typescript complaining * lint * make filenames more consistent * test own domain excluded
Diffstat (limited to 'internal/util/ptr.go')
-rw-r--r--internal/util/ptr.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/util/ptr.go b/internal/util/ptr.go
index 8a89666c4..d0e835c9e 100644
--- a/internal/util/ptr.go
+++ b/internal/util/ptr.go
@@ -17,6 +17,8 @@
package util
+import "unsafe"
+
// EqualPtrs returns whether the values contained within two comparable ptr types are equal.
func EqualPtrs[T comparable](t1, t2 *T) bool {
switch {
@@ -59,3 +61,8 @@ func PtrOrValue[T any](t *T, value T) T {
}
return value
}
+
+func IsNil(i interface{}) bool {
+ type eface struct{ _, data unsafe.Pointer }
+ return (*eface)(unsafe.Pointer(&i)).data == nil
+}