[Groonga-commit] groonga/groonga at d6b0a4e [master] Add size check

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Aug 21 17:35:45 JST 2014


Kouhei Sutou	2014-08-21 17:35:45 +0900 (Thu, 21 Aug 2014)

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

  Message:
    Add size check
    
    grn_obj_cast() doesn't set record ID for nonexistent key and returns
    GRN_SUCCESS. So a bulk object for record ID may not have any data.
    
    In this change, treat no data record ID object as null.

  Modified files:
    lib/str.c

  Modified: lib/str.c (+4 -0)
===================================================================
--- lib/str.c    2014-08-20 23:37:22 +0900 (111e881)
+++ lib/str.c    2014-08-21 17:35:45 +0900 (69e4e05)
@@ -2769,6 +2769,9 @@ grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj, grn_obj_format *format)
         }
         GRN_TEXT_PUTC(ctx, bulk, ']');
       } else {
+        if (GRN_BULK_VSIZE(obj) == 0) {
+          GRN_TEXT_PUTS(ctx, bulk, "null");
+        } else {
         grn_obj *table = grn_ctx_at(ctx, obj->header.domain);
         grn_id id = GRN_RECORD_VALUE(obj);
         if (table && table->header.type != GRN_TABLE_NO_KEY) {
@@ -2788,6 +2791,7 @@ grn_text_otoj(grn_ctx *ctx, grn_obj *bulk, grn_obj *obj, grn_obj_format *format)
         }
       }
     }
+    }
     break;
   case GRN_UVECTOR :
     if (format) {
-------------- next part --------------
HTML����������������������������...
Download 



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