rtmp: simplified C_RTMP_Alloc and zeroed C_RTMP object in C_RTMP_Init

This commit is contained in:
saxon 2018-08-25 22:32:24 +09:30
parent 0ed5d4bc72
commit 77393a1de7
1 changed files with 2 additions and 2 deletions

View File

@ -239,14 +239,14 @@ func C_RTMPPacket_Free(p *C_RTMPPacket) {
// RTMP* RTMP_IsConnected(); // RTMP* RTMP_IsConnected();
// rtmp.c +317 // rtmp.c +317
func C_RTMP_Alloc() *C_RTMP { func C_RTMP_Alloc() *C_RTMP {
var r C_RTMP return &C_RTMP{}
return (*C_RTMP)(malloc(uintptr(unsafe.Sizeof(r))))
//return (*C_RTMP)(allocate(unsafe.Sizeof(r))) //return (*C_RTMP)(allocate(unsafe.Sizeof(r)))
} }
// void RTMP_Init(RTMP *r); // void RTMP_Init(RTMP *r);
// rtmp.c +329 // rtmp.c +329
func C_RTMP_Init(r *C_RTMP) { func C_RTMP_Init(r *C_RTMP) {
*r = C_RTMP{}
r.m_sb.sb_socket = -1 r.m_sb.sb_socket = -1
r.m_inChunkSize = RTMP_DEFAULT_CHUNKSIZE r.m_inChunkSize = RTMP_DEFAULT_CHUNKSIZE
r.m_outChunkSize = RTMP_DEFAULT_CHUNKSIZE r.m_outChunkSize = RTMP_DEFAULT_CHUNKSIZE