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
This commit is contained in:
John Scipione
2016-12-09 15:13:23 -08:00
parent 89c0b71c9a
commit 6e3445098a
+16 -9
View File
@@ -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. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Tyler Dauwalder * Tyler Dauwalder
* John Scipione, [email protected]
* Ingo Weinhold, [email protected] * Ingo Weinhold, [email protected]
*/ */
@@ -168,7 +169,9 @@ BNode::InitCheck() const
status_t status_t
BNode::SetTo(const entry_ref* ref) 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) { if (entry == NULL) {
Unset(); 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 status_t
BNode::SetTo(const char* path) 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 if (dir == NULL || path == NULL
|| BPrivate::Storage::is_absolute_path(path)) { || BPrivate::Storage::is_absolute_path(path)) {
Unset(); 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;
} }