VirtualBox

Changeset 32469 in vbox


Ignore:
Timestamp:
Sep 14, 2010 10:01:17 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
65842
Message:

Main/USB/linux: minor fixes to USBGetDevides

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/USBGetDevices.h

    r32324 r32469  
    5757
    5858/**
     59 * Free a linked list of USB devices created by the Linux enumeration code.
     60 * @param  pHead  Pointer to the first device in the linked list
     61 */
     62static inline void deviceListFree(PUSBDEVICE *ppHead)
     63{
     64    PUSBDEVICE pHead, pNext;
     65    pHead = *ppHead;
     66    while (pHead)
     67    {
     68        pNext = pHead->pNext;
     69        deviceFree(pHead);
     70        pHead = pNext;
     71    }
     72    *ppHead = NULL;
     73}
     74
     75RT_C_DECLS_BEGIN
     76
     77/**
    5978 * Check whether @a pcszDevices is a valid usbfs devices file for checking
    6079 * whether usbfs is supported or not.
     
    7392extern PUSBDEVICE USBProxyLinuxGetDevices(const char *pcszUsbfsRoot);
    7493
     94RT_C_DECLS_END
     95
    7596#endif /* ___USBGetDevices_h */
  • trunk/src/VBox/Main/linux/USBGetDevices.cpp

    r32431 r32469  
    536536{
    537537    PUSBDEVICE pFirst = NULL;
    538     FILE *pFile;
     538    FILE *pFile = NULL;
    539539    int rc;
    540540    rc = openDevicesFile(pcszUsbfsRoot, &pFile);
     
    13791379    }
    13801380    if (RT_FAILURE(rc))
    1381         while (pFirst)
    1382         {
    1383             PUSBDEVICE pNext = pFirst->pNext;
    1384             deviceFree(pFirst);
    1385             pFirst = pNext;
    1386         }
     1381        deviceListFree(&pFirst);
    13871382
    13881383    VEC_CLEANUP_OBJ(&vecDevInfo);
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