[Groonga-commit] ranguba/rroonga at 0a1e3ef [master] Use buffer on stack

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Fri May 30 17:40:56 JST 2014


Kouhei Sutou	2014-05-30 17:40:56 +0900 (Fri, 30 May 2014)

  New Revision: 0a1e3ef8047e7ecc657947ca35e80e4fe7067aea
  https://github.com/ranguba/rroonga/commit/0a1e3ef8047e7ecc657947ca35e80e4fe7067aea

  Message:
    Use buffer on stack

  Modified files:
    ext/groonga/rb-grn-object.c

  Modified: ext/groonga/rb-grn-object.c (+3 -9)
===================================================================
--- ext/groonga/rb-grn-object.c    2014-05-30 17:39:23 +0900 (7733abd)
+++ ext/groonga/rb-grn-object.c    2014-05-30 17:40:56 +0900 (a85ef8f)
@@ -666,22 +666,16 @@ VALUE
 rb_grn_object_inspect_object_content_name (VALUE inspected,
                                            grn_ctx *context, grn_obj *object)
 {
+    char name[GRN_TABLE_MAX_KEY_SIZE];
     int name_size;
 
-    name_size = grn_obj_name(context, object, NULL, 0);
+    name_size = grn_obj_name(context, object, name, GRN_TABLE_MAX_KEY_SIZE);
     if (name_size == 0) {
         rb_str_cat2(inspected, "(anonymous)");
     } else {
-        grn_obj name;
-
-        GRN_OBJ_INIT(&name, GRN_BULK, 0, GRN_ID_NIL);
-        grn_bulk_space(context, &name, name_size);
-        grn_obj_name(context, object, GRN_BULK_HEAD(&name), name_size);
-        GRN_TEXT_PUTC(context, &name, '\0');
         rb_str_cat2(inspected, "<");
-        rb_str_cat2(inspected, GRN_BULK_HEAD(&name));
+        rb_str_cat(inspected, name, name_size);
         rb_str_cat2(inspected, ">");
-        grn_obj_unlink(context, &name);
     }
 
     return inspected;
-------------- next part --------------
HTML����������������������������...
ダウンロード 



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