void HGSMIHeapFree(HGSMIHEAP *pHeap,
                   void *pvData)
{
    if (pvData)
    {
        HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData(pvData);
        HGSMIHeapBufferFree(pHeap, pHeader);
    }
}
示例#2
0
void HGSMIHeapFree (HGSMIHEAP *pHeap,
                    void *pvData)
{
    if (   pvData
        && pHeap->u.hPtr != NIL_RTHEAPSIMPLE)
    {
        HGSMIBUFFERHEADER *pHeader = HGSMIBufferHeaderFromData (pvData);

        HGSMIHeapBufferFree (pHeap, pHeader);
    }
}
void *HGSMIHeapAlloc(HGSMIHEAP *pHeap,
                     HGSMISIZE cbData,
                     uint8_t u8Channel,
                     uint16_t u16ChannelInfo)
{
    HGSMISIZE cbAlloc = HGSMIBufferRequiredSize(cbData);
    HGSMIBUFFERHEADER *pHeader = (HGSMIBUFFERHEADER *)HGSMIHeapBufferAlloc(pHeap, cbAlloc);
    if (pHeader)
    {
        HGSMIOFFSET offBuffer = HGSMIBufferInitializeSingle(HGSMIHeapArea(pHeap), pHeader,
                                                            cbAlloc, u8Channel, u16ChannelInfo);
        if (offBuffer == HGSMIOFFSET_VOID)
        {
            HGSMIHeapBufferFree(pHeap, pHeader);
            pHeader = NULL;
        }
    }

    return pHeader? HGSMIBufferDataFromPtr(pHeader): NULL;
}