[haiku-commits] Re: haiku: hrev47639 - src/kits/tracker

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 07 Aug 2014 11:29:57 +0200

On 07.08.2014 10:26, pulkomandy wrote:
On Thu, Aug 07, 2014 at 10:11:32AM +0200, Axel Dörfler wrote:
On August 7, 2014 at 9:06 AM pulkomandy@xxxxxxxxxxxxx wrote:
-                     while (ref = entryList->RemoveItemAt(0))
+                     while ((ref = entryList->RemoveItemAt(0)))

Again, our coding style demands boolean expressions:
                         while ((ref = entryList->RemoveItemAt(0)) != NULL)

If this is a BObjectList, I'm pretty sure it can delete all items with a single
call, though, anyway.

As far as I know, only in "owning" mode. This is a change more involved
than I dare to make to Tracker code.

But unless really necessary (e.g. in the rare case when the list is an attribute and item deletion has a side effect), please don't use the "remove item 0 and delete it until the list is empty" idiom. This is just horrible performance-wise.

CU, Ingo


Other related posts: