[Groonga-commit] groonga/groonga at 8b2223f [master] load: return NULL for empty error message

Back to archive index

Kouhei Sutou null+****@clear*****
Fri Feb 3 17:21:14 JST 2017


Kouhei Sutou	2017-02-03 17:21:14 +0900 (Fri, 03 Feb 2017)

  New Revision: 8b2223fb872cc4af06da9881f63e45c6f9fbc9b7
  https://github.com/groonga/groonga/commit/8b2223fb872cc4af06da9881f63e45c6f9fbc9b7

  Message:
    load: return NULL for empty error message

  Modified files:
    lib/proc.c
    test/command/suite/load/command_version/3/output_errors/array.expected
    test/command/suite/load/command_version/3/output_errors/object.expected

  Modified: lib/proc.c (+5 -1)
===================================================================
--- lib/proc.c    2017-02-03 17:11:17 +0900 (ed68742)
+++ lib/proc.c    2017-02-03 17:21:14 +0900 (e5cb0f3)
@@ -226,7 +226,11 @@ proc_load(grn_ctx *ctx, int nargs, grn_obj **args, grn_user_data *user_data)
           GRN_OUTPUT_CSTR("return_code");
           GRN_OUTPUT_INT64(GRN_INT32_VALUE_AT(return_codes, i));
           GRN_OUTPUT_CSTR("message");
-          GRN_OUTPUT_STR(message, message_size);
+          if (message_size == 0) {
+            GRN_OUTPUT_NULL();
+          } else {
+            GRN_OUTPUT_STR(message, message_size);
+          }
           GRN_OUTPUT_MAP_CLOSE();
         }
         GRN_OUTPUT_ARRAY_CLOSE();

  Modified: test/command/suite/load/command_version/3/output_errors/array.expected (+2 -2)
===================================================================
--- test/command/suite/load/command_version/3/output_errors/array.expected    2017-02-03 17:11:17 +0900 (a8607a9)
+++ test/command/suite/load/command_version/3/output_errors/array.expected    2017-02-03 17:21:14 +0900 (bb03260)
@@ -29,7 +29,7 @@ load --table Numbers --command_version 3 --output_ids yes --output_errors yes
     "errors": [
       {
         "return_code": 0,
-        "message": ""
+        "message": null
       },
       {
         "return_code": -22,
@@ -37,7 +37,7 @@ load --table Numbers --command_version 3 --output_ids yes --output_errors yes
       },
       {
         "return_code": 0,
-        "message": ""
+        "message": null
       }
     ]
   }

  Modified: test/command/suite/load/command_version/3/output_errors/object.expected (+2 -2)
===================================================================
--- test/command/suite/load/command_version/3/output_errors/object.expected    2017-02-03 17:11:17 +0900 (a0e1298)
+++ test/command/suite/load/command_version/3/output_errors/object.expected    2017-02-03 17:21:14 +0900 (d02a71f)
@@ -28,7 +28,7 @@ load --table Numbers --command_version 3 --output_ids yes --output_errors yes
     "errors": [
       {
         "return_code": 0,
-        "message": ""
+        "message": null
       },
       {
         "return_code": -22,
@@ -36,7 +36,7 @@ load --table Numbers --command_version 3 --output_ids yes --output_errors yes
       },
       {
         "return_code": 0,
-        "message": ""
+        "message": null
       }
     ]
   }
-------------- next part --------------
HTML����������������������������...
Download 



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