[Groonga-commit] groonga/grnxx at 7f5db74 [master] Update ArrayCursor for the new Cursor. (#61)

Back to archive index

susumu.yata null+****@clear*****
Thu Sep 18 16:12:14 JST 2014


susumu.yata	2014-09-18 16:12:14 +0900 (Thu, 18 Sep 2014)

  New Revision: 7f5db74c10fb3ad85d9ebac74811acbeacd48c02
  https://github.com/groonga/grnxx/commit/7f5db74c10fb3ad85d9ebac74811acbeacd48c02

  Message:
    Update ArrayCursor for the new Cursor. (#61)

  Modified files:
    lib/grnxx/index.cpp

  Modified: lib/grnxx/index.cpp (+4 -7)
===================================================================
--- lib/grnxx/index.cpp    2014-09-18 16:10:48 +0900 (2685882)
+++ lib/grnxx/index.cpp    2014-09-18 16:12:14 +0900 (4cc69c7)
@@ -380,7 +380,7 @@ class ArrayCursor : public Cursor {
   }
   ~ArrayCursor() {}
 
-  Int read(Error *error, Int max_count, Array<Record> *records);
+  Int read(Error *error, ArrayRef<Record> records);
 
  private:
   Array<Map::iterator> array_;
@@ -393,9 +393,8 @@ class ArrayCursor : public Cursor {
   Int limit_left_;
 };
 
-Int ArrayCursor::read(Error *error,
-                      Int max_count,
-                      Array<Record> *records) {
+Int ArrayCursor::read(Error *, ArrayRef<Record> records) {
+  Int max_count = records.size();
   if (max_count > limit_left_) {
     max_count = limit_left_;
   }
@@ -419,9 +418,7 @@ Int ArrayCursor::read(Error *error,
     if (offset_left_ > 0) {
       --offset_left_;
     } else {
-      if (!records->push_back(error, Record(*it_, 0.0))) {
-        return -1;
-      }
+      records.set(count, Record(*it_, 0.0));
       ++count;
     }
     ++it_;
-------------- next part --------------
HTML����������������������������...
Download 



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