hrev45634 adds 1 changeset to branch 'master' old head: c0f529c38b1a11e44766dcf8691a8ca1face85ee new head: a1566b06b7b53d14fa53c169b0989925c54fd69d overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=a1566b0+%5Ec0f529c ---------------------------------------------------------------------------- a1566b0: bfs: removed kernel_cpp.h's new operator. * This fixes bug #9715 from the POV of BFS, ie. the new operator seems to call the constructor on a NULL object on failure. [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ] ---------------------------------------------------------------------------- Revision: hrev45634 Commit: a1566b06b7b53d14fa53c169b0989925c54fd69d URL: http://cgit.haiku-os.org/haiku/commit/?id=a1566b0 Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> Date: Mon May 6 19:45:00 2013 UTC Ticket: https://dev.haiku-os.org/ticket/9715 ---------------------------------------------------------------------------- 4 files changed, 20 insertions(+), 19 deletions(-) src/add-ons/kernel/file_systems/bfs/Inode.cpp | 14 ++++++++------ src/add-ons/kernel/file_systems/bfs/Journal.cpp | 4 ++-- src/add-ons/kernel/file_systems/bfs/Query.cpp | 20 ++++++++++---------- .../file_systems/bfs/system_dependencies.h | 1 - ---------------------------------------------------------------------------- diff --git a/src/add-ons/kernel/file_systems/bfs/Inode.cpp b/src/add-ons/kernel/file_systems/bfs/Inode.cpp index c5e92c2..d33970a 100644 --- a/src/add-ons/kernel/file_systems/bfs/Inode.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Inode.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2012, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx. + * Copyright 2001-2013, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx. * This file may be used under the terms of the MIT License. */ @@ -206,7 +206,8 @@ InodeAllocator::New(block_run* parentRun, mode_t mode, block_run& run, } run = fRun; - fInode = new Inode(volume, *fTransaction, volume->ToVnode(run), mode, run); + fInode = new(std::nothrow) Inode(volume, *fTransaction, + volume->ToVnode(run), mode, run); if (fInode == NULL) RETURN_ERROR(B_NO_MEMORY); @@ -235,7 +236,8 @@ InodeAllocator::CreateTree() if ((fInode->Mode() & S_INDEX_TYPES) == 0) fInode->Node().mode |= HOST_ENDIAN_TO_BFS_INT32(S_STR_INDEX); - BPlusTree* tree = fInode->fTree = new BPlusTree(*fTransaction, fInode); + BPlusTree* tree = fInode->fTree + = new(std::nothrow) BPlusTree(*fTransaction, fInode); if (tree == NULL || tree->InitCheck() < B_OK) return B_ERROR; @@ -347,7 +349,7 @@ Inode::Inode(Volume* volume, ino_t id) fOldLastModified = LastModified(); if (IsContainer()) - fTree = new BPlusTree(this); + fTree = new(std::nothrow) BPlusTree(this); if (NeedsFileCache()) { SetFileCache(file_cache_create(fVolume->ID(), ID(), Size())); SetMap(file_map_create(volume->ID(), ID(), Size())); @@ -2881,7 +2883,7 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type, BPlusTree* tree = fAttributes->Tree(); if (tree == NULL - || (fIterator = new TreeIterator(tree)) == NULL) { + || (fIterator = new(std::nothrow) TreeIterator(tree)) == NULL) { FATAL(("could not get tree in AttributeIterator::GetNext(ino_t" " = %" B_PRIdINO ",name = \"%s\")\n", fInode->ID(), name)); return B_ENTRY_NOT_FOUND; @@ -2892,7 +2894,7 @@ AttributeIterator::GetNext(char* name, size_t* _length, uint32* _type, ino_t id; status_t status = fIterator->GetNextEntry(name, &length, B_FILE_NAME_LENGTH, &id); - if (status < B_OK) + if (status != B_OK) return status; Vnode vnode(volume, id); diff --git a/src/add-ons/kernel/file_systems/bfs/Journal.cpp b/src/add-ons/kernel/file_systems/bfs/Journal.cpp index fa62b52..bac5a43 100644 --- a/src/add-ons/kernel/file_systems/bfs/Journal.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Journal.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx. + * Copyright 2001-2013, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx. * This file may be used under the terms of the MIT License. */ @@ -853,7 +853,7 @@ Journal::_WriteTransactionToLog() free(vecs); - LogEntry* logEntry = new LogEntry(this, fVolume->LogEnd(), + LogEntry* logEntry = new(std::nothrow) LogEntry(this, fVolume->LogEnd(), runArrays.LogEntryLength()); if (logEntry == NULL) { FATAL(("no memory to allocate log entries!")); diff --git a/src/add-ons/kernel/file_systems/bfs/Query.cpp b/src/add-ons/kernel/file_systems/bfs/Query.cpp index d6f213c..a5e593a 100644 --- a/src/add-ons/kernel/file_systems/bfs/Query.cpp +++ b/src/add-ons/kernel/file_systems/bfs/Query.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx. + * Copyright 2001-2013, Axel Dörfler, axeld@xxxxxxxxxxxxxxxx. * Copyright 2010, Clemens Zeidler <haiku@xxxxxxxxxxxxxxxxxx> * This file may be used under the terms of the MIT License. */ @@ -971,7 +971,7 @@ Equation::PrepareQuery(Volume* /*volume*/, Index& index, if (tree == NULL) return B_ERROR; - *iterator = new TreeIterator(tree); + *iterator = new(std::nothrow) TreeIterator(tree); if (*iterator == NULL) return B_NO_MEMORY; @@ -1249,11 +1249,11 @@ Term* Operator::Copy() const { if (fEquation != NULL) { - Equation* equation = new Equation(*fEquation); + Equation* equation = new(std::nothrow) Equation(*fEquation); if (equation == NULL) return NULL; - Term* term = new Term(equation); + Term* term = new(std::nothrow) Term(equation); if (term == NULL) delete equation; @@ -1270,7 +1270,7 @@ Operator::Copy() const return NULL; } - Term* term = new Term(left, fOp, right); + Term* term = new(std::nothrow) Term(left, fOp, right); if (term == NULL) { delete left; delete right; @@ -1393,7 +1393,7 @@ Expression::ParseEquation(char** expr) return term; } - Equation* equation = new Equation(expr); + Equation* equation = new(std::nothrow) Equation(expr); if (equation == NULL || equation->InitCheck() < B_OK) { delete equation; return NULL; @@ -1413,8 +1413,8 @@ Expression::ParseAnd(char** expr) Term* right = ParseAnd(expr); Term* newParent = NULL; - if (right == NULL - || (newParent = new Operator(left, OP_AND, right)) == NULL) { + if (right == NULL || (newParent = new(std::nothrow) Operator(left, + OP_AND, right)) == NULL) { delete left; delete right; @@ -1438,8 +1438,8 @@ Expression::ParseOr(char** expr) Term* right = ParseAnd(expr); Term* newParent = NULL; - if (right == NULL - || (newParent = new Operator(left, OP_OR, right)) == NULL) { + if (right == NULL || (newParent = new(std::nothrow) Operator(left, + OP_OR, right)) == NULL) { delete left; delete right; diff --git a/src/add-ons/kernel/file_systems/bfs/system_dependencies.h b/src/add-ons/kernel/file_systems/bfs/system_dependencies.h index 6e89896..aa0773d 100644 --- a/src/add-ons/kernel/file_systems/bfs/system_dependencies.h +++ b/src/add-ons/kernel/file_systems/bfs/system_dependencies.h @@ -18,7 +18,6 @@ #include <AutoDeleter.h> #include <util/AutoLock.h> #include <util/DoublyLinkedList.h> -#include <util/kernel_cpp.h> #include <util/SinglyLinkedList.h> #include <util/Stack.h>