From 6e3445098abd1d1e4cca69ba2d959fe74fe2cb1b Mon Sep 17 00:00:00 2001 From: John Scipione Date: Wed, 7 Dec 2016 14:12:00 -0800 Subject: [PATCH] BNode: Set fCStatus in SetTo() explicitly instead of setting it in _SetTo() and then again in SetTo() fCStatus could be set even fewer times but this is a good compromise (logically, performance wise it is not an issue). Update copyright, add myself to Authors --- src/kits/storage/Node.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/kits/storage/Node.cpp b/src/kits/storage/Node.cpp index 86b401533e..63f2a5b6c0 100644 --- a/src/kits/storage/Node.cpp +++ b/src/kits/storage/Node.cpp @@ -1,9 +1,10 @@ /* - * Copyright 2002-2011 Haiku, Inc. All rights reserved. + * Copyright 2002-2016 Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Tyler Dauwalder + * John Scipione, jscipione@gmail.com * Ingo Weinhold, bonefish@users.sf.net */ @@ -168,7 +169,9 @@ BNode::InitCheck() const status_t BNode::SetTo(const entry_ref* ref) { - return _SetTo(ref, false); + fCStatus = _SetTo(ref, false); + + return fCStatus; } @@ -177,17 +180,20 @@ BNode::SetTo(const BEntry* entry) { if (entry == NULL) { Unset(); - return (fCStatus = B_BAD_VALUE); - } + fCStatus = B_BAD_VALUE; + } else + fCStatus = _SetTo(entry->fDirFd, entry->fName, false); - return _SetTo(entry->fDirFd, entry->fName, false); + return fCStatus; } status_t BNode::SetTo(const char* path) { - return _SetTo(-1, path, false); + fCStatus = _SetTo(-1, path, false); + + return fCStatus; } @@ -197,10 +203,11 @@ BNode::SetTo(const BDirectory* dir, const char* path) if (dir == NULL || path == NULL || BPrivate::Storage::is_absolute_path(path)) { Unset(); - return (fCStatus = B_BAD_VALUE); - } + fCStatus = B_BAD_VALUE; + } else + fCStatus = _SetTo(dir->fDirFd, path, false); - return _SetTo(dir->fDirFd, path, false); + return fCStatus; }