VirtualBox

Changeset 2424 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 30, 2007 12:17:10 PM (18 years ago)
Author:
vboxsync
Message:

converted to C style declarations to shush up gcc when building the linux kernel module.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/alloc/heapsimple.cpp

    r1816 r2424  
    281281RTDECL(int) RTHeapSimpleInit(PRTHEAPSIMPLE pHeap, void *pvMemory, size_t cbMemory)
    282282{
     283    PRTHEAPSIMPLEINTERNAL pHeapInt;
     284    PRTHEAPSIMPLEFREE pFree;
     285    unsigned i;
     286
    283287    /*
    284288     * Validate input. The imposed minimum heap size is just a convenien value.
     
    292296     * enforce 32 byte alignment of it. Also align the heap size correctly.
    293297     */
    294     PRTHEAPSIMPLEINTERNAL pHeapInt = (PRTHEAPSIMPLEINTERNAL)pvMemory;
     298    pHeapInt = (PRTHEAPSIMPLEINTERNAL)pvMemory;
    295299    if ((uintptr_t)pvMemory & 31)
    296300    {
     
    310314                     - sizeof(RTHEAPSIMPLEINTERNAL);
    311315    pHeapInt->pFreeTail = pHeapInt->pFreeHead = (PRTHEAPSIMPLEFREE)(pHeapInt + 1);
    312     unsigned i;
    313316    for (i = 0; i < ELEMENTS(pHeapInt->auAlignment); i++)
    314317        pHeapInt->auAlignment[i] = ~(size_t)0;
    315318
    316319    /* Init the single free block. */
    317     PRTHEAPSIMPLEFREE pFree = pHeapInt->pFreeHead;
     320    pFree = pHeapInt->pFreeHead;
    318321    pFree->Core.pNext = NULL;
    319322    pFree->Core.pPrev = NULL;
     
    348351{
    349352    PRTHEAPSIMPLEINTERNAL pHeapInt = Heap;
     353    PRTHEAPSIMPLEBLOCK pBlock;
    350354
    351355    /*
     
    370374     * Do the allocation.
    371375     */
    372     PRTHEAPSIMPLEBLOCK pBlock = rtHeapSimpleAllocBlock(pHeapInt, cb, cbAlignment);
     376    pBlock = rtHeapSimpleAllocBlock(pHeapInt, cb, cbAlignment);
    373377    if (RT_LIKELY(pBlock))
    374378    {
     
    394398{
    395399    PRTHEAPSIMPLEINTERNAL pHeapInt = Heap;
     400    PRTHEAPSIMPLEBLOCK pBlock;
    396401
    397402    /*
     
    416421     * Do the allocation.
    417422     */
    418     PRTHEAPSIMPLEBLOCK pBlock = rtHeapSimpleAllocBlock(pHeapInt, cb, cbAlignment);
     423    pBlock = rtHeapSimpleAllocBlock(pHeapInt, cb, cbAlignment);
    419424    if (RT_LIKELY(pBlock))
    420425    {
     
    453458         pFree = pFree->pNext)
    454459    {
     460        uintptr_t offAlign;
    455461        ASSERT_BLOCK_FREE(pHeapInt, pFree);
    456462
     
    460466        if (pFree->cb < cb)
    461467            continue;
    462         uintptr_t offAlign = (uintptr_t)(&pFree->Core + 1) & (uAlignment - 1);
     468        offAlign = (uintptr_t)(&pFree->Core + 1) & (uAlignment - 1);
    463469        if (offAlign)
    464470        {
     471            RTHEAPSIMPLEFREE Free;
     472            PRTHEAPSIMPLEBLOCK pPrev;
     473
    465474            offAlign = uAlignment - offAlign;
    466475            if (pFree->cb - offAlign < cb)
     
    470479             * Make a stack copy of the free block header and adjust the pointer.
    471480             */
    472             RTHEAPSIMPLEFREE Free = *pFree;
     481            Free = *pFree;
    473482            pFree = (PRTHEAPSIMPLEFREE)((uintptr_t)pFree + offAlign);
    474483
     
    482491             * for that.)
    483492             */
    484             PRTHEAPSIMPLEBLOCK  pPrev = Free.Core.pPrev;
     493            pPrev = Free.Core.pPrev;
    485494            if (pPrev)
    486495            {
     
    606615RTDECL(void) RTHeapSimpleFree(RTHEAPSIMPLE Heap, void *pv)
    607616{
     617    PRTHEAPSIMPLEINTERNAL pHeapInt;
     618    PRTHEAPSIMPLEBLOCK pBlock;
     619
    608620    /*
    609621     * Validate input.
     
    617629     * Get the block and heap. If in strict mode, validate these.
    618630     */
    619     PRTHEAPSIMPLEBLOCK pBlock = (PRTHEAPSIMPLEBLOCK)pv - 1;
    620     PRTHEAPSIMPLEINTERNAL pHeapInt = pBlock->pHeap;
     631    pBlock = (PRTHEAPSIMPLEBLOCK)pv - 1;
     632    pHeapInt = pBlock->pHeap;
    621633    ASSERT_BLOCK_USED(pHeapInt, pBlock);
    622634    ASSERT_ANCHOR(pHeapInt);
     
    802814RTDECL(size_t) RTHeapSimpleSize(RTHEAPSIMPLE Heap, void *pv)
    803815{
     816    PRTHEAPSIMPLEINTERNAL pHeapInt;
     817    PRTHEAPSIMPLEBLOCK pBlock;
     818    size_t cbBlock;
     819
    804820    /*
    805821     * Validate input.
     
    813829     * Get the block and heap. If in strict mode, validate these.
    814830     */
    815     PRTHEAPSIMPLEBLOCK pBlock = (PRTHEAPSIMPLEBLOCK)pv - 1;
    816     PRTHEAPSIMPLEINTERNAL pHeapInt = pBlock->pHeap;
     831    pBlock = (PRTHEAPSIMPLEBLOCK)pv - 1;
     832    pHeapInt = pBlock->pHeap;
    817833    ASSERT_BLOCK_USED(pHeapInt, pBlock);
    818834    ASSERT_ANCHOR(pHeapInt);
     
    822838     * Calculate the block size.
    823839     */
    824     const size_t cbBlock = (pBlock->pNext ? (uintptr_t)pBlock->pNext : (uintptr_t)pHeapInt->pvEnd)
    825                          - (uintptr_t)pBlock- sizeof(RTHEAPSIMPLEBLOCK);
     840    cbBlock = (pBlock->pNext ? (uintptr_t)pBlock->pNext : (uintptr_t)pHeapInt->pvEnd)
     841            - (uintptr_t)pBlock- sizeof(RTHEAPSIMPLEBLOCK);
    826842    return cbBlock;
    827843}
     
    841857RTDECL(size_t) RTHeapSimpleGetHeapSize(RTHEAPSIMPLE Heap)
    842858{
     859    PRTHEAPSIMPLEINTERNAL pHeapInt;
     860
    843861    if (Heap == NIL_RTHEAPSIMPLE)
    844862        return 0;
    845     PRTHEAPSIMPLEINTERNAL pHeapInt = Heap;
     863
     864    pHeapInt = Heap;
    846865    AssertPtrReturn(pHeapInt, 0);
    847866    ASSERT_ANCHOR(pHeapInt);
     
    862881RTDECL(size_t) RTHeapSimpleGetFreeSize(RTHEAPSIMPLE Heap)
    863882{
     883    PRTHEAPSIMPLEINTERNAL pHeapInt;
     884
    864885    if (Heap == NIL_RTHEAPSIMPLE)
    865886        return 0;
    866     PRTHEAPSIMPLEINTERNAL pHeapInt = Heap;
     887
     888    pHeapInt = Heap;
    867889    AssertPtrReturn(pHeapInt, 0);
    868890    ASSERT_ANCHOR(pHeapInt);
     
    880902{
    881903    PRTHEAPSIMPLEINTERNAL pHeapInt = (PRTHEAPSIMPLEINTERNAL)Heap;
     904    PRTHEAPSIMPLEFREE pBlock;
     905
    882906    pfnPrintf("**** Dumping Heap %p - cbHeap=%zx cbFree=%zx ****\n",
    883907              Heap, pHeapInt->cbHeap, pHeapInt->cbFree);
    884908
    885     PRTHEAPSIMPLEFREE pBlock;
    886909    for (pBlock = (PRTHEAPSIMPLEFREE)(pHeapInt + 1);
    887910         pBlock;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette