diff --git a/core/stat/base/leap_array.go b/core/stat/base/leap_array.go index 9d6a253b7..897380818 100644 --- a/core/stat/base/leap_array.go +++ b/core/stat/base/leap_array.go @@ -90,9 +90,7 @@ func NewAtomicBucketWrapArrayWithTime(len int, bucketLengthInMs uint32, now uint startTime += uint64(bucketLengthInMs) } - // calculate base address for real data array - sliHeader := (*util.SliceHeader)(unsafe.Pointer(&ret.data)) - ret.base = unsafe.Pointer((**BucketWrap)(unsafe.Pointer(sliHeader.Data))) + ret.base = unsafe.Pointer(&ret.data[0]) return ret } diff --git a/util/safe.go b/util/safe.go deleted file mode 100644 index 3eedc6db9..000000000 --- a/util/safe.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 1999-2020 Alibaba Group Holding Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package util - -import "unsafe" - -// SliceHeader is a safe version of SliceHeader used within this project. -type SliceHeader struct { - Data unsafe.Pointer - Len int - Cap int -} - -// StringHeader is a safe version of StringHeader used within this project. -type StringHeader struct { - Data unsafe.Pointer - Len int -}