Changeset 32262 in vbox for trunk/src/VBox/Main
- Timestamp:
- Sep 6, 2010 11:37:00 PM (14 years ago)
- Location:
- trunk/src/VBox/Main
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/HostHardwareLinux.h
r32258 r32262 142 142 143 143 /** Constructor */ 144 static inline intVBoxMainUSBDevInfoInit(VBoxMainUSBDeviceInfo *pSelf)145 { 146 returnVEC_INIT_OBJ(&pSelf->mvecDevInfo, USBDeviceInfo, USBDevInfoCleanup);144 static inline void VBoxMainUSBDevInfoInit(VBoxMainUSBDeviceInfo *pSelf) 145 { 146 VEC_INIT_OBJ(&pSelf->mvecDevInfo, USBDeviceInfo, USBDevInfoCleanup); 147 147 } 148 148 -
trunk/src/VBox/Main/include/vector.h
r32258 r32262 163 163 pvec->muTypeHash = uTypeHash; \ 164 164 pvec->mpfnCleanup = pfnCleanup ? pfnCleanup : vecNoCleanup; \ 165 pvec->mpvaElements = NULL; \ 166 return VEC_EXPAND(pvec); 165 pvec->mpvaElements = NULL; 167 166 168 167 /** Initialise a vector. */ 169 DECLINLINE( int) vecInitObj(VECTOR_OBJ *pvec, size_t cbElement,170 168 DECLINLINE(void) vecInitObj(VECTOR_OBJ *pvec, size_t cbElement, 169 unsigned uTypeHash, void (*pfnCleanup)(void *)) 171 170 { 172 171 VEC_INIT(pvec, cbElement, uTypeHash, pfnCleanup) … … 174 173 175 174 /** Initialise a pointer vector. */ 176 DECLINLINE( int) vecInitPtr(VECTOR_PTR *pvec, size_t cbElement,177 175 DECLINLINE(void) vecInitPtr(VECTOR_PTR *pvec, size_t cbElement, 176 unsigned uTypeHash, void (*pfnCleanup)(void *)) 178 177 { 179 178 VEC_INIT(pvec, cbElement, uTypeHash, pfnCleanup) … … 212 211 213 212 /** 214 * Initialise a vector structure. 215 * @returns iprt status code (VINF_SUCCESS or VERR_NO_MEMORY) 213 * Initialise a vector structure. Always succeeds. 216 214 * @param pvec pointer to an uninitialised vector structure 217 215 * @param type the type of the objects in the vector. As this is … … 227 225 228 226 /** 229 * Initialise a vector-of-pointers structure. 230 * @returns iprt status code (VINF_SUCCESS or VERR_NO_MEMORY) 227 * Initialise a vector-of-pointers structure. Always succeeds. 231 228 * @param pvec pointer to an uninitialised vector structure 232 229 * @param type the type of the pointers in the vector, including the -
trunk/src/VBox/Main/linux/HostHardwareLinux.cpp
r32261 r32262 1323 1323 1324 1324 AssertRCReturn(mStatus, VERR_WRONG_ORDER); 1325 if (RT_FAILURE(rc = VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree)))1326 return rc;1327 1325 bool fEntered = ASMAtomicCmpXchgU32(&mfWaiting, 1, 0); 1328 if (!fEntered)1329 VEC_CLEANUP_PTR(&vecpchDevs);1330 1326 AssertReturn(fEntered, VERR_WRONG_ORDER); 1327 VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree); 1331 1328 do { 1332 1329 struct pollfd pollFD[MAX_POLLID]; … … 1418 1415 pSelf->mDevice = aDevice ? RTStrDup(aDevice) : NULL; 1419 1416 pSelf->mSysfsPath = aSystemID ? RTStrDup(aSystemID) : NULL; 1420 if ( RT_FAILURE(VEC_INIT_PTR(&pSelf->mvecpszInterfaces, char *, RTStrFree))1421 ||(aDevice && !pSelf->mDevice) || (aSystemID && ! pSelf->mSysfsPath))1417 VEC_INIT_PTR(&pSelf->mvecpszInterfaces, char *, RTStrFree); 1418 if ((aDevice && !pSelf->mDevice) || (aSystemID && ! pSelf->mSysfsPath)) 1422 1419 { 1423 1420 USBDevInfoCleanup(pSelf); … … 1584 1581 int USBDevInfoUpdateDevices (VBoxMainUSBDeviceInfo *pSelf) 1585 1582 { 1583 int rc = VINF_SUCCESS; 1584 1586 1585 LogFlowFunc(("entered\n")); 1587 1586 VECTOR_PTR(char *) vecpchDevs; 1588 int rc = VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree); 1589 if (RT_FAILURE(rc)) 1590 return rc; 1587 VEC_INIT_PTR(&vecpchDevs, char *, RTStrFree); 1591 1588 VEC_CLEAR_OBJ(&pSelf->mvecDevInfo); 1592 1589 #ifdef VBOX_USB_WITH_SYSFS -
trunk/src/VBox/Main/linux/USBProxyServiceLinux.cpp
r32258 r32262 263 263 264 264 #ifdef VBOX_USB_WITH_SYSFS 265 int rc2; 266 if (RT_FAILURE((rc2 = VBoxMainUSBDevInfoInit(&mDeviceList)))) 267 return rc2; 265 VBoxMainUSBDevInfoInit(&mDeviceList); 268 266 int rc = mWaiter.getStatus(); 269 267 if (RT_SUCCESS(rc) || rc == VERR_TIMEOUT || rc == VERR_TRY_AGAIN) -
trunk/src/VBox/Main/testcase/tstHostHardwareLinux.cpp
r32258 r32262 92 92 #ifdef VBOX_USB_WITH_SYSFS 93 93 VBoxMainUSBDeviceInfo deviceInfo; 94 AssertRCReturn(VBoxMainUSBDevInfoInit(&deviceInfo), 1);94 VBoxMainUSBDevInfoInit(&deviceInfo); 95 95 rc = USBDevInfoUpdateDevices(&deviceInfo); 96 96 if (RT_FAILURE(rc))
Note:
See TracChangeset
for help on using the changeset viewer.