VirtualBox

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


Ignore:
Timestamp:
Jul 29, 2021 8:50:51 AM (4 years ago)
Author:
vboxsync
Message:

IPRT/RTThreadCreate: Modernize assertions.

File:
1 edited

Legend:

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

    r85126 r90396  
    770770     * Validate input.
    771771     */
    772     if (!VALID_PTR(pThread) && pThread)
    773     {
    774         Assert(VALID_PTR(pThread));
    775         return VERR_INVALID_PARAMETER;
    776     }
    777     if (!VALID_PTR(pfnThread))
    778     {
    779         Assert(VALID_PTR(pfnThread));
    780         return VERR_INVALID_PARAMETER;
    781     }
    782     if (!pszName || !*pszName || strlen(pszName) >= RTTHREAD_NAME_LEN)
    783     {
    784         AssertMsgFailed(("pszName=%s (max len is %d because of logging)\n", pszName, RTTHREAD_NAME_LEN - 1));
    785         return VERR_INVALID_PARAMETER;
    786     }
    787     if (fFlags & ~RTTHREADFLAGS_MASK)
    788     {
    789         AssertMsgFailed(("fFlags=%#x\n", fFlags));
    790         return VERR_INVALID_PARAMETER;
    791     }
     772    AssertPtrNullReturn(pThread, VERR_INVALID_POINTER);
     773    AssertPtrReturn(pfnThread, VERR_INVALID_POINTER);
     774    AssertMsgReturn(pszName && *pszName != '\0' && strlen(pszName) < RTTHREAD_NAME_LEN,
     775                    ("pszName=%s (max len is %d because of logging)\n", pszName, RTTHREAD_NAME_LEN - 1),
     776                    VERR_INVALID_PARAMETER);
     777    AssertMsgReturn(!(fFlags & ~RTTHREADFLAGS_MASK), ("fFlags=%#x\n", fFlags), VERR_INVALID_FLAGS);
    792778
    793779    /*
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