[Groonga-commit] groonga/groonga at fdf5022 [master] Stop to ignore internal (sub) cast error

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Fri Jan 8 11:19:04 JST 2016


Kouhei Sutou	2016-01-08 11:19:04 +0900 (Fri, 08 Jan 2016)

  New Revision: fdf50224f742e6868c9b90212eba52872d35588c
  https://github.com/groonga/groonga/commit/fdf50224f742e6868c9b90212eba52872d35588c

  Message:
    Stop to ignore internal (sub) cast error

  Modified files:
    lib/db.c

  Modified: lib/db.c (+22 -18)
===================================================================
--- lib/db.c    2016-01-08 10:01:40 +0900 (5d0c6f1)
+++ lib/db.c    2016-01-08 11:19:04 +0900 (ba9ea73)
@@ -5655,33 +5655,37 @@ grn_obj_is_persistent(grn_ctx *ctx, grn_obj *obj)
       grn_obj key;\
       GRN_OBJ_INIT(&key, GRN_BULK, 0, table->header.domain);\
       if (src->header.domain != table->header.domain) {\
-        grn_obj_cast(ctx, src, &key, GRN_TRUE);\
+        rc = grn_obj_cast(ctx, src, &key, GRN_TRUE);\
         p_key = &key;\
       }\
-      if (GRN_BULK_VSIZE(p_key)) {\
-        if (add_record_if_not_exist) {\
-          id = grn_table_add_by_key(ctx, table, p_key, NULL);\
+      if (!rc) {\
+        if (GRN_BULK_VSIZE(p_key)) {\
+          if (add_record_if_not_exist) {\
+            id = grn_table_add_by_key(ctx, table, p_key, NULL);\
+          } else {\
+            id = grn_table_get_by_key(ctx, table, p_key);\
+          }\
+          if (id) {\
+            GRN_RECORD_SET(ctx, dest, id);\
+          } else {\
+            rc = GRN_INVALID_ARGUMENT;\
+          }\
         } else {\
-          id = grn_table_get_by_key(ctx, table, p_key);\
+          GRN_RECORD_SET(ctx, dest, GRN_ID_NIL);\
         }\
-        if (id) {\
-          GRN_RECORD_SET(ctx, dest, id);\
-        } else {\
-          rc = GRN_INVALID_ARGUMENT;\
-        }\
-      } else {\
-        GRN_RECORD_SET(ctx, dest, GRN_ID_NIL);\
       }\
       GRN_OBJ_FIN(ctx, &key);\
     } else {\
       grn_obj record_id;\
       GRN_UINT32_INIT(&record_id, 0);\
-      grn_obj_cast(ctx, src, &record_id, GRN_TRUE);\
-      id = GRN_UINT32_VALUE(&record_id);\
-      if (id) {\
-        GRN_RECORD_SET(ctx, dest, id);\
-      } else {\
-        rc = GRN_INVALID_ARGUMENT;\
+      rc = grn_obj_cast(ctx, src, &record_id, GRN_TRUE);\
+      if (!rc) {\
+        id = GRN_UINT32_VALUE(&record_id);\
+        if (id) {\
+          GRN_RECORD_SET(ctx, dest, id);\
+        } else {\
+          rc = GRN_INVALID_ARGUMENT;\
+        }\
       }\
     }\
   } else {\
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る