[Groonga-commit] groonga/grnxx [master] Fix a bug of making a duplicate key in reset() and update().

Back to archive index

susumu.yata null+****@clear*****
Thu Apr 4 18:38:46 JST 2013


susumu.yata	2013-04-04 18:38:46 +0900 (Thu, 04 Apr 2013)

  New Revision: a13e5563e95199201408b1e41b26280c870c6d63
  https://github.com/groonga/grnxx/commit/a13e5563e95199201408b1e41b26280c870c6d63

  Message:
    Fix a bug of making a duplicate key in reset() and update().

  Modified files:
    lib/grnxx/alpha/map/array.cpp

  Modified: lib/grnxx/alpha/map/array.cpp (+6 -0)
===================================================================
--- lib/grnxx/alpha/map/array.cpp    2013-04-04 18:22:17 +0900 (876eef5)
+++ lib/grnxx/alpha/map/array.cpp    2013-04-04 18:38:46 +0900 (92c5782)
@@ -110,6 +110,9 @@ bool Array<T>::reset(int64_t key_id, T dest_key) {
   if (!get_bit(key_id)) {
     return false;
   }
+  if (search(dest_key)) {
+    return false;
+  }
   keys_[key_id] = dest_key;
   return true;
 }
@@ -171,6 +174,9 @@ bool Array<T>::update(T src_key, T dest_key, int64_t *key_id) {
   if (!search(src_key, &src_key_id)) {
     return false;
   }
+  if (search(dest_key)) {
+    return false;
+  }
   keys_[src_key_id] = dest_key;
   if (key_id) {
     *key_id = src_key_id;
-------------- next part --------------
HTML����������������������������...
Download 



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