refactor: using unsafe.String and unsafe.SliceData (#21412)
This commit is contained in:
parent
292d7b49c3
commit
d56bbb8991
@ -48,6 +48,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
|
||||
### Improvements
|
||||
|
||||
* (client) [#21436](https://github.com/cosmos/cosmos-sdk/pull/21436) Use `address.Codec` from client.Context in `tx.Sign`.
|
||||
* (internal) [#21412](https://github.com/cosmos/cosmos-sdk/pull/21412) Using unsafe.String and unsafe.SliceData.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
@ -15,5 +15,5 @@ func UnsafeStrToBytes(s string) []byte {
|
||||
// to be used generally, but for a specific pattern to delete keys
|
||||
// from a map.
|
||||
func UnsafeBytesToStr(b []byte) string {
|
||||
return *(*string)(unsafe.Pointer(&b))
|
||||
return unsafe.String(unsafe.SliceData(b), len(b))
|
||||
}
|
||||
|
||||
@ -15,5 +15,5 @@ func UnsafeStrToBytes(s string) []byte {
|
||||
// to be used generally, but for a specific pattern to delete keys
|
||||
// from a map.
|
||||
func UnsafeBytesToStr(b []byte) string {
|
||||
return *(*string)(unsafe.Pointer(&b))
|
||||
return unsafe.String(unsafe.SliceData(b), len(b))
|
||||
}
|
||||
|
||||
@ -15,5 +15,5 @@ func UnsafeStrToBytes(s string) []byte {
|
||||
// to be used generally, but for a specific pattern to delete keys
|
||||
// from a map.
|
||||
func UnsafeBytesToStr(b []byte) string {
|
||||
return *(*string)(unsafe.Pointer(&b))
|
||||
return unsafe.String(unsafe.SliceData(b), len(b))
|
||||
}
|
||||
|
||||
@ -13,5 +13,5 @@ func UnsafeStrToBytes(s string) []byte {
|
||||
// to be used generally, but for a specific pattern to delete keys
|
||||
// from a map.
|
||||
func UnsafeBytesToStr(b []byte) string {
|
||||
return *(*string)(unsafe.Pointer(&b))
|
||||
return unsafe.String(unsafe.SliceData(b), len(b))
|
||||
}
|
||||
|
||||
@ -15,5 +15,5 @@ func UnsafeStrToBytes(s string) []byte {
|
||||
// to be used generally, but for a specific pattern to delete keys
|
||||
// from a map.
|
||||
func UnsafeBytesToStr(b []byte) string {
|
||||
return *(*string)(unsafe.Pointer(&b))
|
||||
return unsafe.String(unsafe.SliceData(b), len(b))
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user