[haiku-commits] r38234 - in haiku/trunk: headers/private/storage src/kits/storage

  • From: superstippi@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 18 Aug 2010 15:50:50 +0200 (CEST)

Author: stippi
Date: 2010-08-18 15:50:50 +0200 (Wed, 18 Aug 2010)
New Revision: 38234
Changeset: http://dev.haiku-os.org/changeset/38234

Modified:
   haiku/trunk/headers/private/storage/AddOnMonitor.h
   haiku/trunk/src/kits/storage/AddOnMonitor.cpp
Log:
Cleanup: No need to check the BMessenger status twice. No need to
keep the BMessageRunner message around.


Modified: haiku/trunk/headers/private/storage/AddOnMonitor.h
===================================================================
--- haiku/trunk/headers/private/storage/AddOnMonitor.h  2010-08-18 13:04:50 UTC 
(rev 38233)
+++ haiku/trunk/headers/private/storage/AddOnMonitor.h  2010-08-18 13:50:50 UTC 
(rev 38234)
@@ -1,35 +1,46 @@
+/*
+ * Copyright 2004-2010, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ */
 #ifndef _ADD_ON_MONITOR_H
 #define _ADD_ON_MONITOR_H
 
+
+#include <list>
+#include <stdio.h>
 #include <string>
-#include <list>
+
 #include <Looper.h>
 #include <MessageRunner.h>
-#include <stdio.h>
 
+
 namespace BPrivate {
 namespace Storage {
 
+
 class AddOnMonitorHandler;
 
+
 class AddOnMonitor : public BLooper {
 private:
-       typedef BLooper inherited;
+                       typedef BLooper inherited;
 public:
-                       AddOnMonitor(AddOnMonitorHandler * handler);
-       virtual ~AddOnMonitor();
+                                                               
AddOnMonitor(AddOnMonitorHandler* handler);
+       virtual                                         ~AddOnMonitor();
 
-       virtual status_t        InitCheck();
+       virtual status_t                        InitCheck();
 
 private:
-       status_t        fInitCheck;
-       BMessage *      fPulseMessage;
-       BMessageRunner * fPulseRunner;
+                       status_t                        fInitCheck;
+                       BMessageRunner*         fPulseRunner;
 };
 
+
 }; // namespace Storage
 }; // namespace BPrivate
 
+
 using namespace BPrivate::Storage;
 
+
 #endif // _ADD_ON_MONITOR_H

Modified: haiku/trunk/src/kits/storage/AddOnMonitor.cpp
===================================================================
--- haiku/trunk/src/kits/storage/AddOnMonitor.cpp       2010-08-18 13:04:50 UTC 
(rev 38233)
+++ haiku/trunk/src/kits/storage/AddOnMonitor.cpp       2010-08-18 13:50:50 UTC 
(rev 38234)
@@ -1,3 +1,12 @@
+/*
+ * Copyright 2004-2010, Haiku, Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *             Andrew Bachmann
+ */
+
+
 #include "AddOnMonitor.h"
 #include "AddOnMonitorHandler.h"
 #include <Message.h>
@@ -5,50 +14,50 @@
 #include <Messenger.h>
 #include <stdio.h>
 
-AddOnMonitor::AddOnMonitor(AddOnMonitorHandler * handler)
-       : BLooper("AddOnMonitor")
+
+AddOnMonitor::AddOnMonitor(AddOnMonitorHandler* handler)
+       :
+       BLooper("AddOnMonitor"),
+       fInitCheck(B_NO_INIT)
 {
-       fInitCheck = B_NO_INIT;
        AddHandler(handler);
        SetPreferredHandler(handler);
+
        status_t status;
        BMessenger messenger(handler, this, &status);
        if (status != B_OK) {
                fInitCheck = status;
                return;
        }
-       if (!messenger.IsValid()) {
-               fInitCheck = B_ERROR;
-               return;
-       }
-       fPulseMessage = new BMessage(B_PULSE);
-       fPulseRunner = new BMessageRunner(messenger, fPulseMessage, 1000000);
+
+       BMessage pulseMessage(B_PULSE);
+       fPulseRunner = new BMessageRunner(messenger, &pulseMessage, 1000000);
        status = fPulseRunner->InitCheck();
        if (status != B_OK) {
                fInitCheck = status;
-               fprintf(stderr, "AddOnMonitor() : bad status returned by 
fPulseRunner->InitCheck()\n");
+               fprintf(stderr, "AddOnMonitor() : bad status returned by "
+                       "fPulseRunner->InitCheck()\n");
                return;
        }
+
        thread_id id = Run();
        if (id < 0) {
                fInitCheck = (status_t)id;
                fprintf(stderr, "AddOnMonitor() : bad id returned by Run()\n");
                return;
        }
+
        fInitCheck = B_OK;
-       return;
 }
 
 
-/* virtual */
 AddOnMonitor::~AddOnMonitor()
 {
-       delete fPulseMessage;
        delete fPulseRunner;
 }
 
 
-/* virtual */ status_t
+status_t
 AddOnMonitor::InitCheck()
 {
        return fInitCheck;


Other related posts:

  • » [haiku-commits] r38234 - in haiku/trunk: headers/private/storage src/kits/storage - superstippi