susumu.yata
null+****@clear*****
Thu Nov 6 09:11:27 JST 2014
susumu.yata 2014-11-06 09:11:27 +0900 (Thu, 06 Nov 2014) New Revision: 70690354214719d8c4a95f63d6633a201f1f75f6 https://github.com/groonga/grnxx/commit/70690354214719d8c4a95f63d6633a201f1f75f6 Message: Add error handling for memory allocation failure. Modified files: lib/grnxx/impl/table.cpp Modified: lib/grnxx/impl/table.cpp (+6 -2) =================================================================== --- lib/grnxx/impl/table.cpp 2014-11-06 09:07:20 +0900 (1c08550) +++ lib/grnxx/impl/table.cpp 2014-11-06 09:11:27 +0900 (4241a0b) @@ -89,11 +89,13 @@ size_t TableRegularCursor::read(ArrayRef<Record> records) { std::unique_ptr<Cursor> TableRegularCursor::create( const Table *table, - const CursorOptions &options) { + const CursorOptions &options) try { if (table->is_empty()) { return std::unique_ptr<Cursor>(new EmptyCursor); } return std::unique_ptr<Cursor>(new TableRegularCursor(table, options)); +} catch (const std::bad_alloc &) { + throw "Memory allocation failed"; // TODO } TableRegularCursor::TableRegularCursor(const Table *table, @@ -187,11 +189,13 @@ size_t TableReverseCursor::read(ArrayRef<Record> records) { std::unique_ptr<Cursor> TableReverseCursor::create( const Table *table, - const CursorOptions &options) { + const CursorOptions &options) try { if (table->is_empty()) { return std::unique_ptr<Cursor>(new EmptyCursor); } return std::unique_ptr<Cursor>(new TableReverseCursor(table, options)); +} catch (const std::bad_alloc &) { + throw "Memorya allocation failed"; // TODO } TableReverseCursor::TableReverseCursor(const Table *table, -------------- next part -------------- HTML����������������������������... 下載