mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-21 15:45:01 +00:00
app/vmselect/netstorage: usae unsafe.SliceData instead of deprecated reflect.SliceHeader
This commit is contained in:
parent
01d8bee14c
commit
319d21eddf
1 changed files with 5 additions and 4 deletions
|
@ -9,7 +9,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -1396,9 +1395,11 @@ func canAppendToBlockAddrPool(pool, a []tmpBlockAddr) bool {
|
||||||
// a doesn't belong to pool
|
// a doesn't belong to pool
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
shPool := (*reflect.SliceHeader)(unsafe.Pointer(&pool))
|
return getBlockAddrsEnd(pool) == getBlockAddrsEnd(a)
|
||||||
shA := (*reflect.SliceHeader)(unsafe.Pointer(&a))
|
}
|
||||||
return shPool.Data+uintptr(shPool.Len)*unsafe.Sizeof(tmpBlockAddr{}) == shA.Data+uintptr(shA.Len)*unsafe.Sizeof(tmpBlockAddr{})
|
|
||||||
|
func getBlockAddrsEnd(a []tmpBlockAddr) uintptr {
|
||||||
|
return uintptr(unsafe.Pointer(unsafe.SliceData(a))) + uintptr(len(a))*unsafe.Sizeof(tmpBlockAddr{})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tbfwLocal *tmpBlocksFileWrapperShard) newBlockAddrs() int {
|
func (tbfwLocal *tmpBlocksFileWrapperShard) newBlockAddrs() int {
|
||||||
|
|
Loading…
Reference in a new issue