VirtualBox

Changeset 90803 in vbox for trunk/src/VBox/Runtime/common


Ignore:
Timestamp:
Aug 23, 2021 7:08:38 PM (3 years ago)
Author:
vboxsync
Message:

Runtime: More VALID_PTR -> RT_VALID_PTR/AssertPtr.

Location:
trunk/src/VBox/Runtime/common
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/dbg/dbgas.cpp

    r82968 r90803  
    332332        PRTDBGASMOD pMod = pDbgAs->papModules[i];
    333333        AssertPtr(pMod);
    334         if (VALID_PTR(pMod))
     334        if (RT_VALID_PTR(pMod))
    335335        {
    336336            Assert(pMod->iOrdinal == i);
  • trunk/src/VBox/Runtime/common/fuzz/fuzz.cpp

    r85121 r90803  
    21372137        rc = pMutator->pfnPrep(pThis, offStart, pMutationParent, &pMutation);
    21382138        if (   RT_SUCCESS(rc)
    2139             && VALID_PTR(pMutation))
     2139            && RT_VALID_PTR(pMutation))
    21402140        {
    21412141            pMutation->pMutator = pMutator;
  • trunk/src/VBox/Runtime/common/ldr/ldrEx.cpp

    r90789 r90803  
    394394     */
    395395    AssertMsgReturn(rtldrIsValid(hLdrMod), ("hLdrMod=%p\n", hLdrMod), VERR_INVALID_HANDLE);
    396     AssertMsgReturn(!pvBits || VALID_PTR(pvBits), ("pvBits=%p\n", pvBits), VERR_INVALID_PARAMETER);
     396    AssertPtrNullReturn(pvBits, VERR_INVALID_POINTER);
    397397    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    398398    PRTLDRMODINTERNAL pMod = (PRTLDRMODINTERNAL)hLdrMod;
     
    418418     */
    419419    AssertMsgReturn(rtldrIsValid(hLdrMod), ("hLdrMod=%p\n", hLdrMod), VERR_INVALID_HANDLE);
    420     AssertMsgReturn(!pvBits || RT_VALID_PTR(pvBits), ("pvBits=%p\n", pvBits), VERR_INVALID_PARAMETER);
     420    AssertPtrNullReturn(pvBits, VERR_INVALID_POINTER);
    421421    AssertPtrReturn(pfnCallback, VERR_INVALID_POINTER);
    422422    PRTLDRMODINTERNAL pMod = (PRTLDRMODINTERNAL)hLdrMod;
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r90693 r90803  
    799799     */
    800800    if (   (cGroups && !papszGroups)
    801         || !VALID_PTR(ppLogger) )
     801        || !RT_VALID_PTR(ppLogger) )
    802802    {
    803803        AssertMsgFailed(("Invalid parameters!\n"));
     
    997997
    998998                    /* Use the callback to generate some initial log contents. */
    999                     Assert(VALID_PTR(pLogger->pInt->pfnPhase) || pLogger->pInt->pfnPhase == NULL);
     999                    Assert(RT_VALID_PTR(pLogger->pInt->pfnPhase) || pLogger->pInt->pfnPhase == NULL);
    10001000                    if (pLogger->pInt->pfnPhase)
    10011001                        pLogger->pInt->pfnPhase(pLogger, RTLOGPHASE_BEGIN, rtlogPhaseMsgNormal);
  • trunk/src/VBox/Runtime/common/log/tracelogwriter.cpp

    r86387 r90803  
    899899
    900900    if (   RT_SUCCESS(rc)
    901         && VALID_PTR(pEvtDescInt))
     901        && RT_VALID_PTR(pEvtDescInt))
    902902    {
    903903        TRACELOGEVT Evt;
     
    933933
    934934    if (   RT_SUCCESS(rc)
    935         && VALID_PTR(pEvtDescInt))
     935        && RT_VALID_PTR(pEvtDescInt))
    936936    {
    937937        TRACELOGEVT Evt;
  • trunk/src/VBox/Runtime/common/misc/assert.cpp

    r82968 r90803  
    224224                "Expression: %s\n"
    225225                "Location  : %s(%d) %s\n",
    226                 VALID_PTR(pszExpr) ? pszExpr : "<none>",
    227                 VALID_PTR(pszFile) ? pszFile : "<none>",
     226                RT_VALID_PTR(pszExpr) ? pszExpr : "<none>",
     227                RT_VALID_PTR(pszFile) ? pszFile : "<none>",
    228228                uLine,
    229                 VALID_PTR(pszFunction) ? pszFunction : "");
     229                RT_VALID_PTR(pszFunction) ? pszFunction : "");
    230230# ifdef IPRT_WITH_ASSERT_STACK
    231231        fprintf(stderr, "Stack     :\n%s\n", szStack);
  • trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp

    r87151 r90803  
    386386    if (!pThread)
    387387        return "<NIL>";
    388     if (!VALID_PTR(pThread))
     388    if (!RT_VALID_PTR(pThread))
    389389        return "<INVALID>";
    390390    if (pThread->u32Magic != RTTHREADINT_MAGIC)
     
    450450
    451451    /* Validate the class pointer. */
    452     if (!VALID_PTR(pClass))
     452    if (!RT_VALID_PTR(pClass))
    453453    {
    454454        RTAssertMsg2AddWeak("%sbad class=%p sub-class=%s\n", pszPrefix, pClass, pszSubClass);
     
    538538    if (!pClass)
    539539        return "<nil-class>";
    540     if (!VALID_PTR(pClass))
     540    if (!RT_VALID_PTR(pClass))
    541541        return "<bad-class-ptr>";
    542542    if (pClass->u32Magic != RTLOCKVALCLASS_MAGIC)
     
    612612        {
    613613            PRTLOCKVALRECSHRD pShared = pRec->ShrdOwner.pSharedRec;
    614             if (    VALID_PTR(pShared)
     614            if (    RT_VALID_PTR(pShared)
    615615                &&  pShared->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC)
    616616#ifdef RTLOCKVAL_WITH_VERBOSE_DUMPS
     
    660660# define FIX_REC(r)     (r)
    661661#endif
    662     if (    VALID_PTR(pRec)
     662    if (    RT_VALID_PTR(pRec)
    663663        &&  !ASMAtomicUoReadBool(&g_fLockValidatorQuiet))
    664664    {
     
    683683                PRTLOCKVALRECUNION  pRealRec = pRec->Nest.pRec;
    684684                uint32_t            u32Magic;
    685                 if (   VALID_PTR(pRealRec)
     685                if (   RT_VALID_PTR(pRealRec)
    686686                    && (   (u32Magic = pRealRec->Core.u32Magic) == RTLOCKVALRECEXCL_MAGIC
    687687                        || u32Magic == RTLOCKVALRECSHRD_MAGIC
     
    720720                                            PRTLOCKVALRECUNION pHighightRec)
    721721{
    722     if (    VALID_PTR(pThread)
     722    if (    RT_VALID_PTR(pThread)
    723723        &&  !ASMAtomicUoReadBool(&g_fLockValidatorQuiet)
    724724        &&  pThread->u32Magic == RTTHREADINT_MAGIC
     
    731731                                pThread, pThread->szName, cEntries, cEntries == 1 ? "y" : "ies");
    732732            PRTLOCKVALRECUNION pCur = rtLockValidatorReadRecUnionPtr(&pThread->LockValidator.pStackTop);
    733             for (uint32_t i = 0; VALID_PTR(pCur); i++)
     733            for (uint32_t i = 0; RT_VALID_PTR(pCur); i++)
    734734            {
    735735                char szPrefix[80];
     
    771771        RTAssertMsg1Weak("RTLockValidator", pSrcPos ? pSrcPos->uLine : 0, pSrcPos ? pSrcPos->pszFile : NULL, pSrcPos ? pSrcPos->pszFunction : NULL);
    772772        if (pSrcPos && pSrcPos->uId)
    773             RTAssertMsg2Weak("%s  [uId=%p  thrd=%s]\n", pszWhat, pSrcPos->uId, VALID_PTR(pThreadSelf) ? pThreadSelf->szName : "<NIL>");
     773            RTAssertMsg2Weak("%s  [uId=%p  thrd=%s]\n", pszWhat, pSrcPos->uId, RT_VALID_PTR(pThreadSelf) ? pThreadSelf->szName : "<NIL>");
    774774        else
    775             RTAssertMsg2Weak("%s  [thrd=%s]\n", pszWhat, VALID_PTR(pThreadSelf) ? pThreadSelf->szName : "<NIL>");
     775            RTAssertMsg2Weak("%s  [thrd=%s]\n", pszWhat, RT_VALID_PTR(pThreadSelf) ? pThreadSelf->szName : "<NIL>");
    776776        rtLockValComplainAboutLock("Lock: ", pRec, "\n");
    777777        if (fDumpStack)
     
    15911591        case RTLOCKVALRECNEST_MAGIC:
    15921592            pRec = rtLockValidatorReadRecUnionPtr(&pRec->Nest.pRec);
    1593             if (VALID_PTR(pRec))
     1593            if (RT_VALID_PTR(pRec))
    15941594            {
    15951595                switch (pRec->Core.u32Magic)
     
    16331633        {
    16341634            PRTLOCKVALRECSHRD pSharedRec = pRec->ShrdOwner.pSharedRec;
    1635             if (RT_LIKELY(   VALID_PTR(pSharedRec)
     1635            if (RT_LIKELY(   RT_VALID_PTR(pSharedRec)
    16361636                          && pSharedRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC))
    16371637                return pSharedRec->hClass;
     
    16421642        {
    16431643            PRTLOCKVALRECUNION pRealRec = pRec->Nest.pRec;
    1644             if (VALID_PTR(pRealRec))
     1644            if (RT_VALID_PTR(pRealRec))
    16451645            {
    16461646                switch (pRealRec->Core.u32Magic)
     
    16521652                    {
    16531653                        PRTLOCKVALRECSHRD pSharedRec = pRealRec->ShrdOwner.pSharedRec;
    1654                         if (RT_LIKELY(   VALID_PTR(pSharedRec)
     1654                        if (RT_LIKELY(   RT_VALID_PTR(pSharedRec)
    16551655                                      && pSharedRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC))
    16561656                            return pSharedRec->hClass;
     
    17021702
    17031703            PRTLOCKVALRECSHRD pSharedRec = pRec->ShrdOwner.pSharedRec;
    1704             if (RT_LIKELY(   VALID_PTR(pSharedRec)
     1704            if (RT_LIKELY(   RT_VALID_PTR(pSharedRec)
    17051705                          && pSharedRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC))
    17061706            {
     
    17171717
    17181718            PRTLOCKVALRECUNION pRealRec = pRec->Nest.pRec;
    1719             if (VALID_PTR(pRealRec))
     1719            if (RT_VALID_PTR(pRealRec))
    17201720            {
    17211721                switch (pRealRec->Core.u32Magic)
     
    17281728                    {
    17291729                        PRTLOCKVALRECSHRD pSharedRec = pRealRec->ShrdOwner.pSharedRec;
    1730                         if (RT_LIKELY(   VALID_PTR(pSharedRec)
     1730                        if (RT_LIKELY(   RT_VALID_PTR(pSharedRec)
    17311731                                      && pSharedRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC))
    17321732                        {
     
    17741774        {
    17751775            PRTLOCKVALRECSHRD pSharedRec = pRec->ShrdOwner.pSharedRec;
    1776             if (RT_LIKELY(   VALID_PTR(pSharedRec)
     1776            if (RT_LIKELY(   RT_VALID_PTR(pSharedRec)
    17771777                          && pSharedRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC))
    17781778                return pSharedRec->uSubClass;
     
    17831783        {
    17841784            PRTLOCKVALRECUNION pRealRec = pRec->Nest.pRec;
    1785             if (VALID_PTR(pRealRec))
     1785            if (RT_VALID_PTR(pRealRec))
    17861786            {
    17871787                switch (pRealRec->Core.u32Magic)
     
    17931793                    {
    17941794                        PRTLOCKVALRECSHRD pSharedRec = pRealRec->ShrdOwner.pSharedRec;
    1795                         if (RT_LIKELY(   VALID_PTR(pSharedRec)
     1795                        if (RT_LIKELY(   RT_VALID_PTR(pSharedRec)
    17961796                                      && pSharedRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC))
    17971797                            return pSharedRec->uSubClass;
     
    18261826    uint32_t            cEntries = 0;
    18271827    PRTLOCKVALRECUNION  pCur = rtLockValidatorReadRecUnionPtr(&pThread->LockValidator.pStackTop);
    1828     while (VALID_PTR(pCur))
     1828    while (RT_VALID_PTR(pCur))
    18291829    {
    18301830        switch (pCur->Core.u32Magic)
     
    28702870            if (pStack->a[i].pRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC)
    28712871                pShrdOwner = (PRTLOCKVALRECUNION)pStack->a[i].pRec->Shared.papOwners[pStack->a[i].iEntry];
    2872             if (VALID_PTR(pShrdOwner) && pShrdOwner->Core.u32Magic == RTLOCKVALRECSHRDOWN_MAGIC)
     2872            if (RT_VALID_PTR(pShrdOwner) && pShrdOwner->Core.u32Magic == RTLOCKVALRECSHRDOWN_MAGIC)
    28732873            {
    28742874                rtLockValComplainAboutLock(szPrefix, pShrdOwner, "\n");
     
    43334333        {
    43344334            PRTLOCKVALRECUNION pCur = rtLockValidatorReadRecUnionPtr(&pThread->LockValidator.pStackTop);
    4335             while (VALID_PTR(pCur) && !fRet)
     4335            while (RT_VALID_PTR(pCur) && !fRet)
    43364336            {
    43374337                switch (pCur->Core.u32Magic)
     
    43424342                        break;
    43434343                    case RTLOCKVALRECSHRDOWN_MAGIC:
    4344                         fRet = VALID_PTR(pCur->ShrdOwner.pSharedRec)
     4344                        fRet = RT_VALID_PTR(pCur->ShrdOwner.pSharedRec)
    43454345                            && pCur->ShrdOwner.pSharedRec->hClass == hClass;
    43464346                        pCur = rtLockValidatorReadRecUnionPtr(&pCur->ShrdOwner.pDown);
     
    43534353                                break;
    43544354                            case RTLOCKVALRECSHRDOWN_MAGIC:
    4355                                 fRet = VALID_PTR(pCur->ShrdOwner.pSharedRec)
     4355                                fRet = RT_VALID_PTR(pCur->ShrdOwner.pSharedRec)
    43564356                                    && pCur->Nest.pRec->ShrdOwner.pSharedRec->hClass == hClass;
    43574357                                break;
     
    43864386        {
    43874387            PRTLOCKVALRECUNION pCur = rtLockValidatorReadRecUnionPtr(&pThread->LockValidator.pStackTop);
    4388             while (VALID_PTR(pCur) && !fRet)
     4388            while (RT_VALID_PTR(pCur) && !fRet)
    43894389            {
    43904390                switch (pCur->Core.u32Magic)
     
    43964396                        break;
    43974397                    case RTLOCKVALRECSHRDOWN_MAGIC:
    4398                         fRet = VALID_PTR(pCur->ShrdOwner.pSharedRec)
     4398                        fRet = RT_VALID_PTR(pCur->ShrdOwner.pSharedRec)
    43994399                            && pCur->ShrdOwner.pSharedRec->hClass == hClass
    44004400                            && pCur->ShrdOwner.pSharedRec->uSubClass == uSubClass;
     
    44094409                                break;
    44104410                            case RTLOCKVALRECSHRDOWN_MAGIC:
    4411                                 fRet = VALID_PTR(pCur->ShrdOwner.pSharedRec)
     4411                                fRet = RT_VALID_PTR(pCur->ShrdOwner.pSharedRec)
    44124412                                    && pCur->Nest.pRec->ShrdOwner.pSharedRec->hClass == hClass
    44134413                                    && pCur->Nest.pRec->ShrdOwner.pSharedRec->uSubClass == uSubClass;
  • trunk/src/VBox/Runtime/common/misc/sg.cpp

    r89264 r90803  
    8484{
    8585    AssertPtr(pSgBuf);
    86     Assert(   (cSegs > 0 && VALID_PTR(paSegs))
     86    Assert(   (cSegs > 0 && RT_VALID_PTR(paSegs))
    8787           || (!cSegs && !paSegs));
    8888    Assert(cSegs < (~(unsigned)0 >> 1));
  • trunk/src/VBox/Runtime/common/misc/thread.cpp

    r90396 r90803  
    304304    RTTHREAD Thread;
    305305
    306     AssertReturn(!(fFlags & RTTHREADFLAGS_WAITABLE), VERR_INVALID_PARAMETER);
    307     AssertReturn(!pszName || VALID_PTR(pszName), VERR_INVALID_POINTER);
    308     AssertReturn(!pThread || VALID_PTR(pThread), VERR_INVALID_POINTER);
     306    AssertReturn(!(fFlags & RTTHREADFLAGS_WAITABLE), VERR_INVALID_FLAGS);
     307    AssertPtrNullReturn(pszName, VERR_INVALID_POINTER);
     308    AssertPtrNullReturn(pThread, VERR_INVALID_POINTER);
    309309
    310310    rc = VINF_SUCCESS;
     
    552552DECLHIDDEN(PRTTHREADINT) rtThreadGet(RTTHREAD Thread)
    553553{
    554     if (    Thread != NIL_RTTHREAD
    555         &&  VALID_PTR(Thread))
     554    if (   Thread != NIL_RTTHREAD
     555        && RT_VALID_PTR(Thread))
    556556    {
    557557        PRTTHREADINT pThread = (PRTTHREADINT)Thread;
  • trunk/src/VBox/Runtime/common/time/time.cpp

    r82968 r90803  
    295295    int             iMonth;
    296296
    297     AssertMsg(VALID_PTR(pTime), ("%p\n", pTime));
    298     AssertMsg(VALID_PTR(pTimeSpec), ("%p\n", pTime));
     297    AssertPtr(pTime);
     298    AssertPtr(pTimeSpec);
    299299
    300300    /*
     
    414414     * Validate input.
    415415     */
    416     AssertReturn(VALID_PTR(pTimeSpec), NULL);
    417     AssertReturn(VALID_PTR(pTime), NULL);
     416    AssertPtrReturn(pTimeSpec, NULL);
     417    AssertPtrReturn(pTime, NULL);
    418418    AssertReturn(pTime->u32Nanosecond < 1000000000, NULL);
    419419    AssertReturn(pTime->u8Second < 60, NULL);
     
    696696     * Validate that we've got the minimum of stuff handy.
    697697     */
    698     AssertReturn(VALID_PTR(pTime), NULL);
     698    AssertPtrReturn(pTime, NULL);
    699699    AssertMsgReturn(!(pTime->fFlags & ~RTTIME_FLAGS_MASK), ("%#x\n", pTime->fFlags), NULL);
    700700    AssertMsgReturn((pTime->fFlags & RTTIME_FLAGS_TYPE_MASK) != RTTIME_FLAGS_TYPE_LOCAL, ("Use RTTimeLocalNormalize!\n"), NULL);
     
    736736     * Validate that we've got the minimum of stuff handy.
    737737     */
    738     AssertReturn(VALID_PTR(pTime), NULL);
     738    AssertPtrReturn(pTime, NULL);
    739739    AssertMsgReturn(!(pTime->fFlags & ~RTTIME_FLAGS_MASK), ("%#x\n", pTime->fFlags), NULL);
    740740    AssertMsgReturn((pTime->fFlags & RTTIME_FLAGS_TYPE_MASK) != RTTIME_FLAGS_TYPE_UTC, ("Use RTTimeNormalize!\n"), NULL);
     
    15541554     * Validate that we've got the minimum of stuff handy.
    15551555     */
    1556     AssertReturn(VALID_PTR(pTime), NULL);
     1556    AssertPtrReturn(pTime, NULL);
    15571557    AssertMsgReturn(!(pTime->fFlags & ~RTTIME_FLAGS_MASK), ("%#x\n", pTime->fFlags), NULL);
    15581558
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