Changeset 86386 in vbox
- Timestamp:
- Oct 1, 2020 2:42:09 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/log/tracelogreader.cpp
r85949 r86386 52 52 * Structures and Typedefs * 53 53 *********************************************************************************************************************************/ 54 55 54 /** Pointer to a trace log reader instance. */ 56 55 typedef struct RTTRACELOGRDRINT *PRTTRACELOGRDRINT; … … 102 101 { 103 102 /** List node for the global list of events. */ 104 RTLIST ANCHORNdGlob;103 RTLISTNODE NdGlob; 105 104 /** The trace log reader instance the event belongs to. */ 106 105 PRTTRACELOGRDRINT pRdr; … … 120 119 size_t cbEvtData; 121 120 /** Event data, variable in size. */ 122 uint8_t abEvtData[1]; 121 RT_FLEXIBLE_ARRAY_EXTENSION 122 uint8_t abEvtData[RT_FLEXIBLE_ARRAY]; 123 123 } RTTRACELOGRDREVTINT; 124 124 /** Pointer to a trace log reader event. */ … … 150 150 RTTRACELOGEVTDESC EvtDesc; 151 151 /** Array of event item descriptors, variable in size. */ 152 RTTRACELOGEVTITEMDESC aEvtItemDesc[1]; 152 RT_FLEXIBLE_ARRAY_EXTENSION 153 RTTRACELOGEVTITEMDESC aEvtItemDesc[RT_FLEXIBLE_ARRAY]; 153 154 } RTTRACELOGRDREVTDESC; 154 155 … … 179 180 /** Pointer to the description if set. */ 180 181 const char *pszDesc; 181 /** List of received events . */182 /** List of received events (PRTTRACELOGRDREVTINT::NdGlob). */ 182 183 RTLISTANCHOR LstEvts; 183 184 /** Number of event descriptors known. */ … … 1005 1006 /** @todo Group handling and parenting. */ 1006 1007 1007 pThis->pEvtCur = pEvt;1008 1008 size_t cbEvtDataRecv = pEvtStrm->cRawEvtDataSz * pThis->cbTypeSize + pEvtStrm->cbEvtData; 1009 1009 if (cbEvtDataRecv) 1010 { 1011 pThis->pEvtCur = pEvt; 1010 1012 rc = rtTraceLogRdrStateAdvance(pThis, RTTRACELOGRDRSTATE_RECV_EVT_DATA, cbEvtDataRecv); 1013 } 1011 1014 else 1012 1015 { … … 1607 1610 RTDECL(int) RTTraceLogRdrDestroy(RTTRACELOGRDR hTraceLogRdr) 1608 1611 { 1612 if (hTraceLogRdr == NIL_RTTRACELOGRDR) 1613 return VINF_SUCCESS; 1609 1614 PRTTRACELOGRDRINT pThis = hTraceLogRdr; 1610 1615 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1616 AssertReturn(pThis->u32Magic == RTTRACELOGRDR_MAGIC, VERR_INVALID_HANDLE); 1611 1617 1612 1618 pThis->u32Magic = RTTRACELOGRDR_MAGIC_DEAD; 1613 pThis->pfnStreamClose(pThis->pvUser); 1619 int rc = pThis->pfnStreamClose(pThis->pvUser); 1620 AssertRC(rc); 1621 1614 1622 for (unsigned i = 0; i < pThis->cEvtDescsCur; i++) 1615 1623 RTMemFree(pThis->papEvtDescs[i]); 1616 1624 if (pThis->papEvtDescs) 1625 { 1617 1626 RTMemFree(pThis->papEvtDescs); 1627 pThis->papEvtDescs = NULL; 1628 } 1629 1630 if (pThis->pEvtCur) 1631 { 1632 RTMemFree(pThis->pEvtCur); 1633 pThis->pEvtCur = NULL; 1634 } 1635 1636 PRTTRACELOGRDREVTINT pCur, pNext; 1637 RTListForEachSafe(&pThis->LstEvts, pCur, pNext, RTTRACELOGRDREVTINT, NdGlob) 1638 { 1639 RTMemFree(pCur); 1640 } 1641 1618 1642 RTSemMutexDestroy(pThis->hMtx); 1643 pThis->hMtx = NIL_RTSEMMUTEX; 1644 1619 1645 RTMemFree(pThis->pbScratch); 1646 pThis->pbScratch = NULL; 1647 1620 1648 RTStrCacheDestroy(pThis->hStrCache); 1649 pThis->hStrCache = NIL_RTSTRCACHE; 1650 1621 1651 RTMemFree(pThis); 1622 1652 return VINF_SUCCESS; … … 1628 1658 PRTTRACELOGRDRINT pThis = hTraceLogRdr; 1629 1659 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1660 AssertReturn(pThis->u32Magic == RTTRACELOGRDR_MAGIC, VERR_INVALID_HANDLE); 1630 1661 AssertPtrReturn(penmEvt, VERR_INVALID_POINTER); 1631 1662 … … 1659 1690 PRTTRACELOGRDRINT pThis = hTraceLogRdr; 1660 1691 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1692 AssertReturn(pThis->u32Magic == RTTRACELOGRDR_MAGIC, VERR_INVALID_HANDLE); 1661 1693 AssertPtrReturn(phRdrEvt, VERR_INVALID_POINTER); 1662 1694 … … 1677 1709 PRTTRACELOGRDRINT pThis = hTraceLogRdr; 1678 1710 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1711 AssertReturn(pThis->u32Magic == RTTRACELOGRDR_MAGIC, VERR_INVALID_HANDLE); 1679 1712 AssertPtrReturn(phIt, VERR_INVALID_POINTER); 1680 1713 … … 1701 1734 PRTTRACELOGRDRINT pThis = hTraceLogRdr; 1702 1735 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 1736 AssertReturn(pThis->u32Magic == RTTRACELOGRDR_MAGIC, VERR_INVALID_HANDLE); 1703 1737 AssertPtrReturn(paMapDesc, VERR_INVALID_PARAMETER); 1704 1738 AssertPtrReturn(ppaEvtHdr, VERR_INVALID_POINTER);
Note:
See TracChangeset
for help on using the changeset viewer.