[haiku-commits] haiku: hrev47644 - in src: add-ons/kernel/busses/usb kits/tracker

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 7 Aug 2014 13:51:33 +0200 (CEST)

hrev47644 adds 2 changesets to branch 'master'
old head: 1ec28f7117b7d703a2645b0776b8ba121f889c46
new head: 848bfaa602d9bcd8976d0c83ce649686f1d09760
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=848bfaa+%5E1ec28f7

----------------------------------------------------------------------------

267d1d7: More efficient clearing of the entryList.
  
  As pointed out by Ingo, using RemoveAt(0) here is needlessly
  inneficient.

848bfaa: More style fixes to ehci.

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 10 insertions(+), 11 deletions(-)
src/add-ons/kernel/busses/usb/ehci.cpp | 16 ++++++++--------
src/kits/tracker/PoseViewScripting.cpp |  5 ++---

############################################################################

Commit:      267d1d780c710d431aee4fb22b9c05820187c48d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=267d1d7
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Thu Aug  7 11:50:25 2014 UTC

More efficient clearing of the entryList.

As pointed out by Ingo, using RemoveAt(0) here is needlessly
inneficient.

----------------------------------------------------------------------------

diff --git a/src/kits/tracker/PoseViewScripting.cpp 
b/src/kits/tracker/PoseViewScripting.cpp
index 5966096..41781bb 100644
--- a/src/kits/tracker/PoseViewScripting.cpp
+++ b/src/kits/tracker/PoseViewScripting.cpp
@@ -466,9 +466,8 @@ BPoseView::DeleteProperty(BMessage* specifier, int32 form,
                        } else
                                Delete(entryList, false, 
settings.AskBeforeDeleteFile());
                } else {
-                       entry_ref* ref;
-                       while ((ref = entryList->RemoveItemAt(0)) != NULL)
-                               delete ref;
+                       for (int i = 0; i < entryList->CountItems(); i++)
+                               delete entryList->ItemAt(i);
                        delete entryList;
                }
 

############################################################################

Revision:    hrev47644
Commit:      848bfaa602d9bcd8976d0c83ce649686f1d09760
URL:         http://cgit.haiku-os.org/haiku/commit/?id=848bfaa
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Thu Aug  7 11:51:36 2014 UTC

More style fixes to ehci.

----------------------------------------------------------------------------

diff --git a/src/add-ons/kernel/busses/usb/ehci.cpp 
b/src/add-ons/kernel/busses/usb/ehci.cpp
index 7cc5beb..9bae7f1 100644
--- a/src/add-ons/kernel/busses/usb/ehci.cpp
+++ b/src/add-ons/kernel/busses/usb/ehci.cpp
@@ -700,7 +700,7 @@ EHCI::SubmitTransfer(Transfer *transfer)
                return fRootHub->ProcessTransfer(this, transfer);
 
        Pipe *pipe = transfer->TransferPipe();
-       if (pipe->Type() & USB_OBJECT_ISO_PIPE)
+       if ((pipe->Type() & USB_OBJECT_ISO_PIPE) != 0)
                return SubmitIsochronous(transfer);
 
        ehci_qh *queueHead = CreateQueueHead();
@@ -718,7 +718,7 @@ EHCI::SubmitTransfer(Transfer *transfer)
 
        bool directionIn;
        ehci_qtd *dataDescriptor;
-       if (pipe->Type() & USB_OBJECT_CONTROL_PIPE) {
+       if ((pipe->Type() & USB_OBJECT_CONTROL_PIPE) != 0) {
                result = FillQueueWithRequest(transfer, queueHead, 
&dataDescriptor,
                        &directionIn);
        } else {
@@ -745,7 +745,7 @@ EHCI::SubmitTransfer(Transfer *transfer)
        print_queue(queueHead);
 #endif
 
-       if (pipe->Type() & USB_OBJECT_INTERRUPT_PIPE)
+       if ((pipe->Type() & USB_OBJECT_INTERRUPT_PIPE) != 0)
                result = LinkInterruptQueueHead(queueHead, pipe);
        else
                result = LinkQueueHead(queueHead);
@@ -803,7 +803,7 @@ EHCI::SubmitIsochronous(Transfer *transfer)
                restSize);
 
        // Find the entry where to start inserting the first Isochronous 
descriptor
-       if (isochronousData->flags & USB_ISO_ASAP ||
+       if ((isochronousData->flags & USB_ISO_ASAP) != 0 ||
                isochronousData->starting_frame_number == NULL) {
 
                if (fFirstIsochronousTransfer != NULL && fNextStartingFrame != 
-1)
@@ -1430,7 +1430,7 @@ EHCI::AddPendingIsochronousTransfer(Transfer *transfer, 
ehci_itd **isoRequest,
 status_t
 EHCI::CancelQueuedTransfers(Pipe *pipe, bool force)
 {
-       if (pipe->Type() & USB_OBJECT_ISO_PIPE)
+       if ((pipe->Type() & USB_OBJECT_ISO_PIPE) != 0)
                return CancelQueuedIsochronousTransfers(pipe, force);
 
        if (!Lock())
@@ -1648,8 +1648,8 @@ EHCI::FinishTransfers()
                                        && ((status >> EHCI_QTD_BYTES_SHIFT) & 
EHCI_QTD_BYTES_MASK)
                                                !=0) {
                                        // a short packet condition existed on 
this descriptor
-                                       if 
(transfer->transfer->TransferPipe()->Type()
-                                               & USB_OBJECT_CONTROL_PIPE != 0) 
{
+                                       if 
((transfer->transfer->TransferPipe()->Type()
+                                               & USB_OBJECT_CONTROL_PIPE) != 
0) {
                                                // for control pipes, the next 
descriptor
                                                // executed is the Status 
descriptor
                                                while (!(descriptor->next_phy & 
EHCI_ITEM_TERMINATE)) {
@@ -1996,7 +1996,7 @@ EHCI::InitQueueHead(ehci_qh *queueHead, Pipe *pipe)
 
        queueHead->endpoint_caps = (1 << EHCI_QH_CAPS_MULT_SHIFT);
        if (pipe->Speed() != USB_SPEED_HIGHSPEED) {
-               if (pipe->Type() & USB_OBJECT_CONTROL_PIPE)
+               if ((pipe->Type() & USB_OBJECT_CONTROL_PIPE) != 0)
                        queueHead->endpoint_chars |= EHCI_QH_CHARS_CONTROL;
 
                queueHead->endpoint_caps |= (pipe->HubPort() << 
EHCI_QH_CAPS_PORT_SHIFT)


Other related posts: