[Groonga-commit] groonga/groonga [master] don't use grn_obj in LOGTRACE.

Back to archive index

null+****@clear***** null+****@clear*****
2012年 1月 19日 (木) 15:42:45 JST


Kouhei Sutou	2012-01-19 15:42:45 +0900 (Thu, 19 Jan 2012)

  New Revision: 93209193fe067da356e204a5cec50e1299d8bc01

  Log:
    don't use grn_obj in LOGTRACE.

  Modified files:
    lib/ctx.h
    test/unit/core/dat/test-dat-pat.cpp
    test/unit/lib/grn-assertions.h
    test/unit/util/test-string.c

  Modified: lib/ctx.h (+1 -7)
===================================================================
--- lib/ctx.h    2012-01-19 12:27:13 +0900 (b091ab3)
+++ lib/ctx.h    2012-01-19 15:42:45 +0900 (a78d6d6)
@@ -103,18 +103,12 @@ GRN_API void grn_ctx_impl_err(grn_ctx *ctx);
 #define LOGTRACE(ctx,lvl) {\
   int i;\
   char **p;\
-  grn_obj buf;\
   BACKTRACE(ctx);\
   p = backtrace_symbols((ctx)->trace, (ctx)->ntrace);\
-  GRN_TEXT_INIT(&buf, 0);\
   for (i = 0; i < (ctx)->ntrace; i++) {\
-    if (i) GRN_TEXT_PUTS((ctx), &buf, " <= ");\
-    GRN_TEXT_PUTS((ctx), &buf, p[i]);\
+    GRN_LOG((ctx), lvl, "%s", p[i]);\
   }\
-  GRN_TEXT_PUTC((ctx), &buf, '\0');\
   free(p);\
-  GRN_LOG((ctx), lvl, "%s", GRN_BULK_HEAD(&buf));\
-  grn_obj_close((ctx), &buf);\
 }
 #else  /* HAVE_BACKTRACE */
 #define LOGTRACE(ctx,msg)

  Modified: test/unit/core/dat/test-dat-pat.cpp (+7 -4)
===================================================================
--- test/unit/core/dat/test-dat-pat.cpp    2012-01-19 12:27:13 +0900 (51d2f38)
+++ test/unit/core/dat/test-dat-pat.cpp    2012-01-19 15:42:45 +0900 (b663d02)
@@ -178,14 +178,17 @@ namespace test_dat_pat
     generate_pat_path(filename, pat_path);
     generate_dat_path(filename, dat_path);
 
-    cppcut_assert_equal(GRN_SUCCESS, grn_pat_remove(&ctx, pat_path));
-    cppcut_assert_equal(GRN_SUCCESS, grn_dat_remove(&ctx, dat_path));
+    grn_test_assert(grn_pat_remove(&ctx, pat_path));
+    grn_test_assert(grn_dat_remove(&ctx, dat_path));
 
     cut_assert_not_exist_path(pat_path);
     cut_assert_not_exist_path(dat_path);
 
-    cppcut_assert_equal(GRN_SUCCESS, grn_pat_remove(&ctx, pat_path));
-    cppcut_assert_equal(GRN_SUCCESS, grn_dat_remove(&ctx, dat_path));
+    grn_test_assert_equal_rc(GRN_NO_SUCH_FILE_OR_DIRECTORY,
+                             grn_pat_remove(&ctx, pat_path));
+    grn_test_assert_equal_rc(GRN_NO_SUCH_FILE_OR_DIRECTORY,
+                             grn_dat_remove(&ctx, dat_path));
+
   }
 
   void test_get(void)

  Modified: test/unit/lib/grn-assertions.h (+4 -0)
===================================================================
--- test/unit/lib/grn-assertions.h    2012-01-19 12:27:13 +0900 (8a49da4)
+++ test/unit/lib/grn-assertions.h    2012-01-19 15:42:45 +0900 (d1d1c51)
@@ -168,6 +168,8 @@
                                        expected_message,                \
                                        command))
 
+G_BEGIN_DECLS
+
 void     grn_test_assert_helper         (grn_rc       rc,
                                          const gchar *expression);
 void     grn_test_assert_equal_rc_helper(grn_rc       expected,
@@ -247,4 +249,6 @@ void     grn_test_assert_send_command_error_helper
                                          const gchar *expected_message_expression,
                                          const gchar *command_expression);
 
+G_END_DECLS
+
 #endif

  Modified: test/unit/util/test-string.c (+1 -2)
===================================================================
--- test/unit/util/test-string.c    2012-01-19 12:27:13 +0900 (3c14e70)
+++ test/unit/util/test-string.c    2012-01-19 15:42:45 +0900 (8404f97)
@@ -520,8 +520,7 @@ test_url_path_normalize_invalid(gconstpointer data)
 
   grn_str_url_path_normalize(&context, input, strlen(input),
                              buffer, BUFFER_SIZE);
-  /* NOTE: not in GRN_API_ENTER, rc is not set. */
-  grn_test_assert_error(GRN_SUCCESS, error_message, &context);
+  grn_test_assert_error(GRN_INVALID_ARGUMENT, error_message, &context);
 #undef BUFFER_SIZE
 }
 




Groonga-commit メーリングリストの案内
Back to archive index