[Groonga-commit] groonga/grnxx at 1428ae3 [master] Set failure flags before throwing exceptions.

Back to archive index

susumu.yata null+****@clear*****
Mon Jul 1 18:19:50 JST 2013


susumu.yata	2013-07-01 18:19:50 +0900 (Mon, 01 Jul 2013)

  New Revision: 1428ae375e103bc3908a57865f8564cc2763d4d6
  https://github.com/groonga/grnxx/commit/1428ae375e103bc3908a57865f8564cc2763d4d6

  Message:
    Set failure flags before throwing exceptions.

  Modified files:
    lib/grnxx/string_builder.cpp

  Modified: lib/grnxx/string_builder.cpp (+2 -2)
===================================================================
--- lib/grnxx/string_builder.cpp    2013-07-01 18:19:34 +0900 (704391e)
+++ lib/grnxx/string_builder.cpp    2013-07-01 18:19:50 +0900 (0343164)
@@ -52,11 +52,11 @@ StringBuilder::StringBuilder(size_t size, StringBuilderFlags flags)
   if (size != 0) {
     buf_.reset(new (std::nothrow) char[size]);
     if (!buf_) {
+      failed_ = true;
       if (~flags_ & STRING_BUILDER_NOEXCEPT) {
         GRNXX_ERROR() << "new char[" << size << "] failed";
         throw MemoryError();
       }
-      failed_ = true;
     } else {
       begin_ = buf_.get();
       end_ = begin_ + size - 1;
@@ -166,11 +166,11 @@ bool StringBuilder::resize_buf(size_t size) {
   }
   std::unique_ptr<char[]> new_buf(new (std::nothrow) char[size]);
   if (!new_buf) {
+    failed_ = true;
     if (~flags_ & STRING_BUILDER_NOEXCEPT) {
       GRNXX_ERROR() << "new char [" << size << "] failed";
       throw MemoryError();
     }
-    failed_ = true;
     return false;
   }
   const size_t length = ptr_ - begin_;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index