rtmp: remove incorrect and redundant calloc implementation

This commit is contained in:
Dan Kortschak 2018-09-12 15:38:05 +09:30
parent f237b5453e
commit 66cdea021c
1 changed files with 1 additions and 7 deletions

View File

@ -200,7 +200,7 @@ func C_RTMPPacket_Alloc(p *C_RTMPPacket, nSize uint32) (ok bool) {
return 0 return 0
} }
*/ */
ptr = (*byte)(calloc(1, uintptr(nSize+RTMP_MAX_HEADER_SIZE))) ptr = (*byte)(malloc(uintptr(nSize + RTMP_MAX_HEADER_SIZE)))
if ptr == nil { if ptr == nil {
return false return false
@ -2110,12 +2110,6 @@ func malloc(nOfBytes uintptr) unsafe.Pointer {
return unsafe.Pointer(&mem[0]) return unsafe.Pointer(&mem[0])
} }
func calloc(val byte, noOfBytes uintptr) unsafe.Pointer {
mem := malloc(noOfBytes)
memset((*byte)(mem), val, int(noOfBytes))
return mem
}
// incBytePtr returns an unsafe.Pointer to a byte that is inc positive positions // incBytePtr returns an unsafe.Pointer to a byte that is inc positive positions
// from the passed ptr // from the passed ptr
func incBytePtr(ptr unsafe.Pointer, inc int) unsafe.Pointer { func incBytePtr(ptr unsafe.Pointer, inc int) unsafe.Pointer {