[haiku-commits] haiku: hrev54397 - in src/apps/haikudepot: server model

  • From: Andrew Lindesay <apl@xxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 5 Jul 2020 05:13:43 -0400 (EDT)

hrev54397 adds 1 changeset to branch 'master'
old head: 981f67b9c8d84cf200e4f9b9bf4af3f95414ffa7
new head: 66a4cd11c2cea133dc099876712ba41bec75131e
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=66a4cd11c2ce+%5E981f67b9c8d8

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

66a4cd11c2ce: HaikuDepot: Custom List Removal
  
  Remove use of custom list class where it is not
  really required.
  
  Relates To #15534
  
  Change-Id: I4bdc258a64055b6e36c7be93672c52d0499e512b
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/2991
  Reviewed-by: Adrien Destugues <pulkomandy@xxxxxxxxx>

                                    [ Andrew Lindesay <apl@xxxxxxxxxxxxxx> ]

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

Revision:    hrev54397
Commit:      66a4cd11c2cea133dc099876712ba41bec75131e
URL:         https://git.haiku-os.org/haiku/commit/?id=66a4cd11c2ce
Author:      Andrew Lindesay <apl@xxxxxxxxxxxxxx>
Date:        Sun Jul  5 00:16:00 2020 UTC

Ticket:      https://dev.haiku-os.org/ticket/15534

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

5 files changed, 23 insertions(+), 24 deletions(-)
src/apps/haikudepot/model/LocalIconStore.cpp     | 20 ++++++++++----------
.../haikudepot/server/ProcessCoordinator.cpp     |  4 ++--
src/apps/haikudepot/server/ProcessCoordinator.h  |  7 ++++---
src/apps/haikudepot/server/ProcessNode.cpp       |  6 +++---
src/apps/haikudepot/server/ProcessNode.h         | 10 ++++------

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

diff --git a/src/apps/haikudepot/model/LocalIconStore.cpp 
b/src/apps/haikudepot/model/LocalIconStore.cpp
index 5cc8823127..a1b925355f 100644
--- a/src/apps/haikudepot/model/LocalIconStore.cpp
+++ b/src/apps/haikudepot/model/LocalIconStore.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2017, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
+ * Copyright 2017-2020, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
  * All rights reserved. Distributed under the terms of the MIT License.
  */
 
@@ -68,22 +68,22 @@ status_t
 LocalIconStore::_IdentifyBestIconFileAtDirectory(const BPath& directory,
        BPath& bestIconPath) const
 {
-       StringList iconLeafnames;
-
-       iconLeafnames.Add("icon.hvif");
-       iconLeafnames.Add("64.png");
-       iconLeafnames.Add("32.png");
-       iconLeafnames.Add("16.png");
+       static const char* kIconLeafnames[] = {
+               "icon.hvif",
+               "64.png",
+               "32.png",
+               "16.png",
+               NULL
+       };
 
        bestIconPath.Unset();
 
-       for (int32 i = 0; i < iconLeafnames.CountItems(); i++) {
-               BString iconLeafname = iconLeafnames.ItemAt(i);
+       for (int32 i = 0; kIconLeafnames[i] != NULL; i++) {
                BPath workingPath(directory);
                bool exists;
                bool isDir;
 
-               if ( (workingPath.Append(iconLeafname) == B_OK
+               if ( (workingPath.Append(kIconLeafnames[i]) == B_OK
                        && StorageUtils::ExistsObject(
                                workingPath, &exists, &isDir, NULL) == B_OK)
                        && exists
diff --git a/src/apps/haikudepot/server/ProcessCoordinator.cpp 
b/src/apps/haikudepot/server/ProcessCoordinator.cpp
index e1cccdb180..dad63c7ef9 100644
--- a/src/apps/haikudepot/server/ProcessCoordinator.cpp
+++ b/src/apps/haikudepot/server/ProcessCoordinator.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
+ * Copyright 2018-2020, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
  * All rights reserved. Distributed under the terms of the MIT License.
  */
 
@@ -104,7 +104,7 @@ void
 ProcessCoordinator::AddNode(ProcessNode* node)
 {
        AutoLocker<BLocker> locker(&fLock);
-       fNodes.Add(node);
+       fNodes.AddItem(node);
        node->Process()->SetListener(this);
 }
 
diff --git a/src/apps/haikudepot/server/ProcessCoordinator.h 
b/src/apps/haikudepot/server/ProcessCoordinator.h
index c7102f1075..24df34419c 100644
--- a/src/apps/haikudepot/server/ProcessCoordinator.h
+++ b/src/apps/haikudepot/server/ProcessCoordinator.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
+ * Copyright 2018-2020, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
  * All rights reserved. Distributed under the terms of the MIT License.
  */
 
@@ -9,9 +9,10 @@
 
 #include "ProcessCoordinator.h"
 
+#include <ObjectList.h>
+
 #include "AbstractProcess.h"
 #include "ProcessNode.h"
-#include "List.h"
 
 
 class ProcessCoordinator;
@@ -111,7 +112,7 @@ private:
 private:
                        BString                         fName;
                        BLocker                         fLock;
-                       List<ProcessNode*, true>
+                       BObjectList<ProcessNode>
                                                                fNodes;
                        ProcessCoordinatorListener*
                                                                fListener;
diff --git a/src/apps/haikudepot/server/ProcessNode.cpp 
b/src/apps/haikudepot/server/ProcessNode.cpp
index 259fd726a5..edabc205fc 100644
--- a/src/apps/haikudepot/server/ProcessNode.cpp
+++ b/src/apps/haikudepot/server/ProcessNode.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
+ * Copyright 2018-2020, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
  * All rights reserved. Distributed under the terms of the MIT License.
  */
 
@@ -142,7 +142,7 @@ ProcessNode::_StartProcess(void* cookie)
 void
 ProcessNode::AddPredecessor(ProcessNode *node)
 {
-       fPredecessorNodes.Add(node);
+       fPredecessorNodes.AddItem(node);
        node->_AddSuccessor(this);
 }
 
@@ -176,7 +176,7 @@ ProcessNode::AllPredecessorsComplete() const
 void
 ProcessNode::_AddSuccessor(ProcessNode* node)
 {
-       fSuccessorNodes.Add(node);
+       fSuccessorNodes.AddItem(node);
 }
 
 
diff --git a/src/apps/haikudepot/server/ProcessNode.h 
b/src/apps/haikudepot/server/ProcessNode.h
index f03c823745..0fd380dcad 100644
--- a/src/apps/haikudepot/server/ProcessNode.h
+++ b/src/apps/haikudepot/server/ProcessNode.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2018, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
+ * Copyright 2018-2020, Andrew Lindesay <apl@xxxxxxxxxxxxxx>.
  * All rights reserved. Distributed under the terms of the MIT License.
  */
 
@@ -7,11 +7,9 @@
 #ifndef PROCESS_NODE_H
 #define PROCESS_NODE_H
 
-
+#include <ObjectList.h>
 #include <OS.h>
 
-#include "List.h"
-
 
 class AbstractProcess;
 
@@ -48,9 +46,9 @@ private:
 
                        thread_id                       fWorker;
                        AbstractProcess*        fProcess;
-                       List<ProcessNode*, true>
+                       BObjectList<ProcessNode>
                                                                
fPredecessorNodes;
-                       List<ProcessNode*, true>
+                       BObjectList<ProcessNode>
                                                                fSuccessorNodes;
 };
 


Other related posts:

  • » [haiku-commits] haiku: hrev54397 - in src/apps/haikudepot: server model - Andrew Lindesay