remove ia64 keywords
[gentoo-zh.git] / net-misc / baidupcs-go / files / baidupcs-go-3.9.5-0001-fix-go-1.23.0-build.patch
blob969b193d6a033066d0098c6f2f81801e0d9e9e6a
1 diff --git a/BaiduPCS-Go b/BaiduPCS-Go
2 new file mode 100755
3 index 0000000..d029fb4
4 Binary files /dev/null and b/BaiduPCS-Go differ
5 diff --git a/pcsutil/cachepool/malloc.go b/pcsutil/cachepool/malloc.go
6 index 307a2d4..612fdd9 100644
7 --- a/pcsutil/cachepool/malloc.go
8 +++ b/pcsutil/cachepool/malloc.go
9 @@ -1,3 +1,6 @@
10 +//go:build !go1.23
11 +// +build !go1.23
13 package cachepool
15 import (
16 @@ -5,6 +8,8 @@ import (
17 "unsafe"
20 +// 函数声明可以省略主体。 这样的声明为Go外部实现的功能(例如汇编例程)提供了签名。这是在汇编中实现函数的方式。
22 //go:linkname mallocgc runtime.mallocgc
23 func mallocgc(size uintptr, typ uintptr, needzero bool) unsafe.Pointer
25 @@ -30,4 +35,4 @@ func RawMallocByteSlice(size int) []byte {
26 Cap: size,
27 }))
28 return b
31 \ No newline at end of file
32 diff --git a/pcsutil/cachepool/malloc_go_1.23.go b/pcsutil/cachepool/malloc_go_1.23.go
33 new file mode 100644
34 index 0000000..8c2b78d
35 --- /dev/null
36 +++ b/pcsutil/cachepool/malloc_go_1.23.go
37 @@ -0,0 +1,31 @@
38 +//go:build go1.23
39 +// +build go1.23
41 +package cachepool
43 +import (
44 + "unsafe"
47 +// 说明:
48 +// 由于GO 1.23版本取消了 go:linkname 的支持,所以1.23以及以上版本需要使用本文件替代原始文件 malloc.go
50 +// RawByteSlice point to runtime.rawbyteslice
51 +func RawByteSlice(size int) (b []byte) {
52 + bytesArray := make([]byte, size)
53 + return bytesArray
56 +// RawMalloc allocates a new slice. The slice is not zeroed.
57 +func RawMalloc(size int) unsafe.Pointer {
58 + bytesArray := make([]byte, size)
59 + // 使用unsafe.Pointer获取字节数组的指针
60 + bytesPtr := unsafe.Pointer(&bytesArray[0])
61 + return bytesPtr
64 +// RawMallocByteSlice allocates a new byte slice. The slice is not zeroed.
65 +func RawMallocByteSlice(size int) []byte {
66 + bytesArray := make([]byte, size)
67 + return bytesArray
69 \ No newline at end of file