diff options
author | 2023-11-08 14:32:17 +0000 | |
---|---|---|
committer | 2023-11-08 14:32:17 +0000 | |
commit | e9e5dc5a40926e5320cb131b035c46b1e1b0bd59 (patch) | |
tree | 52edc9fa5742f28e1e5223f51cda628ec1c35a24 /internal/util | |
parent | [chore]: Bump github.com/spf13/cobra from 1.7.0 to 1.8.0 (#2338) (diff) | |
download | gotosocial-e9e5dc5a40926e5320cb131b035c46b1e1b0bd59.tar.xz |
[feature] add support for polls + receiving federated status edits (#2330)
Diffstat (limited to 'internal/util')
-rw-r--r-- | internal/util/ptr.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/util/ptr.go b/internal/util/ptr.go index 4b7450b66..2ce96e1d1 100644 --- a/internal/util/ptr.go +++ b/internal/util/ptr.go @@ -17,6 +17,18 @@ package util +// EqualPtrs returns whether the values contained within two comparable ptr types are equal. +func EqualPtrs[T comparable](t1, t2 *T) bool { + switch { + case t1 == nil: + return (t2 == nil) + case t2 == nil: + return false + default: + return (*t1 == *t2) + } +} + // Ptr returns a pointer to the passed in type func Ptr[T any](t T) *T { return &t |