VirtualBox

Ignore:
Timestamp:
May 20, 2009 1:33:14 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
47538
Message:

IPRT: Made handletable.cpp and handletablectx.cpp build cleanly as C.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/misc/handletable.cpp

    r10789 r19865  
    4848                                  PFNRTHANDLETABLERETAIN pfnRetain, void *pvUser)
    4949{
     50    PRTHANDLETABLEINT   pThis;
     51    uint32_t            cLevel1;
     52    size_t              cb;
     53
    5054    /*
    5155     * Validate input.
     
    6569    cMax = ((cMax + RTHT_LEVEL2_ENTRIES - 1) / RTHT_LEVEL2_ENTRIES) * RTHT_LEVEL2_ENTRIES;
    6670
    67     uint32_t const cLevel1 = cMax / RTHT_LEVEL2_ENTRIES;
     71    cLevel1 = cMax / RTHT_LEVEL2_ENTRIES;
    6872    Assert(cLevel1 * RTHT_LEVEL2_ENTRIES == cMax);
    6973
     
    7276     * if it's below the threshold size.
    7377     */
    74     size_t cb = sizeof(RTHANDLETABLEINT);
     78    cb = sizeof(RTHANDLETABLEINT);
    7579    if (cLevel1 < RTHT_LEVEL1_DYN_ALLOC_THRESHOLD)
    7680        cb = RT_ALIGN(cb, sizeof(void *)) + cLevel1 * sizeof(void *);
    77     PRTHANDLETABLEINT pThis = (PRTHANDLETABLEINT)RTMemAllocZ(cb);
     81    pThis = (PRTHANDLETABLEINT)RTMemAllocZ(cb);
    7882    if (!pThis)
    7983        return VERR_NO_MEMORY;
     
    121125RTDECL(int) RTHandleTableDestroy(RTHANDLETABLE hHandleTable, PFNRTHANDLETABLEDELETE pfnDelete, void *pvUser)
    122126{
     127    PRTHANDLETABLEINT   pThis;
     128    RTSPINLOCKTMP       Tmp;
     129    uint32_t            i1;
     130    uint32_t            i;
     131
    123132    /*
    124133     * Validate input, quitely ignore the NIL handle.
     
    126135    if (hHandleTable == NIL_RTHANDLETABLE)
    127136        return VINF_SUCCESS;
    128     PRTHANDLETABLEINT pThis = (PRTHANDLETABLEINT)hHandleTable;
     137    pThis = (PRTHANDLETABLEINT)hHandleTable;
    129138    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    130139    AssertReturn(pThis->u32Magic == RTHANDLETABLE_MAGIC, VERR_INVALID_HANDLE);
     
    135144     * Then kill the lock.
    136145     */
    137     RTSPINLOCKTMP Tmp;
    138146    rtHandleTableLock(pThis, &Tmp);
    139147    ASMAtomicWriteU32(&pThis->u32Magic, ~RTHANDLETABLE_MAGIC);
     
    157165        if (pThis->fFlags & RTHANDLETABLE_FLAGS_CONTEXT)
    158166        {
    159             for (uint32_t i1 = 0; cLeft > 0 && i1 < pThis->cLevel1; i1++)
     167            for (i1 = 0; cLeft > 0 && i1 < pThis->cLevel1; i1++)
    160168            {
    161169                PRTHTENTRYCTX paTable = (PRTHTENTRYCTX)pThis->papvLevel1[i1];
    162170                if (paTable)
    163                     for (uint32_t i = 0; i < RTHT_LEVEL2_ENTRIES; i++)
     171                    for (i = 0; i < RTHT_LEVEL2_ENTRIES; i++)
    164172                        if (!RTHT_IS_FREE(paTable[i].pvObj))
    165173                        {
     
    173181        else
    174182        {
    175             for (uint32_t i1 = 0; cLeft > 0 && i1 < pThis->cLevel1; i1++)
     183            for (i1 = 0; cLeft > 0 && i1 < pThis->cLevel1; i1++)
    176184            {
    177185                PRTHTENTRY paTable = (PRTHTENTRY)pThis->papvLevel1[i1];
    178186                if (paTable)
    179                     for (uint32_t i = 0; i < RTHT_LEVEL2_ENTRIES; i++)
     187                    for (i = 0; i < RTHT_LEVEL2_ENTRIES; i++)
    180188                        if (!RTHT_IS_FREE(paTable[i].pvObj))
    181189                        {
     
    193201     * Free the memory.
    194202     */
    195     for (uint32_t i1 = 0; i1 < pThis->cLevel1; i1++)
     203    for (i1 = 0; i1 < pThis->cLevel1; i1++)
    196204        if (pThis->papvLevel1[i1])
    197205        {
Note: See TracChangeset for help on using the changeset viewer.

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