Kouhei Sutou
null+****@clear*****
Mon Jun 16 15:22:02 JST 2014
Kouhei Sutou 2014-06-16 15:22:02 +0900 (Mon, 16 Jun 2014) New Revision: 25628f12e24058ddedfdbf9526a219688b5185fc https://github.com/groonga/groonga/commit/25628f12e24058ddedfdbf9526a219688b5185fc Message: Mark GRN_CTX_USE_QL and GRN_CTX_BATCH_MODE are deprecated Because Groonga removed the internal Scheme interpreter long time ago. Modified files: include/groonga.h lib/ctx.c lib/ctx_impl.h src/groonga.c test/unit/core/test-context.c test/unit/core/test-inverted-index.c test/unit/core/test-patricia-trie.c test/unit/core/test-patricia-trie.h test/unit/core/test-performance.c test/unit/core/test-public-context.c test/unit/core/test-stress.c test/unit/core/test-tokenizer.c test/unit/fixtures/performance/test-read-write.c Modified: include/groonga.h (+2 -2) =================================================================== --- include/groonga.h 2014-06-11 22:58:13 +0900 (9dd4972) +++ include/groonga.h 2014-06-16 15:22:02 +0900 (0eb974f) @@ -215,8 +215,8 @@ struct _grn_ctx { #define GRN_CTX_USER_DATA(ctx) (&((ctx)->user_data)) -#define GRN_CTX_USE_QL (0x03) -#define GRN_CTX_BATCH_MODE (0x04) +#define GRN_CTX_USE_QL (0x03) /* Deprecated. Don't use it. */ +#define GRN_CTX_BATCH_MODE (0x04) /* Deprecated. Don't use it. */ #define GRN_CTX_PER_DB (0x08) GRN_API grn_rc grn_ctx_init(grn_ctx *ctx, int flags); Modified: lib/ctx.c (+0 -6) =================================================================== --- lib/ctx.c 2014-06-11 22:58:13 +0900 (b01bca5) +++ lib/ctx.c 2014-06-16 15:22:02 +0900 (b3c2cf4) @@ -497,7 +497,6 @@ grn_ctx_impl_init(grn_ctx *ctx) ctx->impl->n_entries = 0; ctx->impl->cur = NULL; ctx->impl->str_end = NULL; - ctx->impl->batchmode = 0; ctx->impl->inbuf = NULL; ctx->impl->com = NULL; ctx->impl->outbuf = grn_obj_open(ctx, GRN_BULK, 0, 0); @@ -590,11 +589,6 @@ grn_ctx_init(grn_ctx *ctx, int flags) ctx->seqno2 = 0; ctx->subno = 0; ctx->impl = NULL; - if (flags & GRN_CTX_USE_QL) { - grn_ctx_impl_init(ctx); - if (ERRP(ctx, GRN_ERROR)) { return ctx->rc; } - if (flags & GRN_CTX_BATCH_MODE) { ctx->impl->batchmode = 1; } - } ctx->user_data.ptr = NULL; CRITICAL_SECTION_ENTER(grn_glock); ctx->next = grn_gctx.next; Modified: lib/ctx_impl.h (+1 -2) =================================================================== --- lib/ctx_impl.h 2014-06-11 22:58:13 +0900 (1d0c457) +++ lib/ctx_impl.h 2014-06-16 15:22:02 +0900 (076d92b) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2009-2013 Brazil + Copyright(C) 2009-2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -155,7 +155,6 @@ struct _grn_ctx_impl { grn_proc_func *finalizer; /* ql portion */ - uint8_t batchmode; uint8_t op; int tok; char *cur; Modified: src/groonga.c (+18 -22) =================================================================== --- src/groonga.c 2014-06-11 22:58:13 +0900 (2ea52b3) +++ src/groonga.c 2014-06-16 15:22:02 +0900 (b62c462) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2009-2013 Brazil + Copyright(C) 2009-2014 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -83,7 +83,6 @@ static int port = DEFAULT_GQTP_PORT; static int batchmode; static int number_of_lines = 0; static int newdb; -static int useql; static grn_bool is_daemon_mode = GRN_FALSE; static int (*do_client)(int argc, char **argv); static int (*do_server)(char *path); @@ -304,7 +303,7 @@ do_alone(int argc, char **argv) char *path = NULL; grn_obj *db; grn_ctx ctx_, *ctx = &ctx_; - grn_ctx_init(ctx, (useql ? GRN_CTX_USE_QL : 0)|(batchmode ? GRN_CTX_BATCH_MODE : 0)); + grn_ctx_init(ctx, 0); if (argc > 0 && argv) { path = *argv++; argc--; } db = (newdb || !path) ? grn_db_create(ctx, path, NULL) : grn_db_open(ctx, path); if (db) { @@ -381,7 +380,7 @@ g_client(int argc, char **argv) grn_ctx ctx_, *ctx = &ctx_; const char *hostname = DEFAULT_DEST; if (argc > 0 && argv) { hostname = *argv++; argc--; } - grn_ctx_init(ctx, (batchmode ? GRN_CTX_BATCH_MODE : 0)); + grn_ctx_init(ctx, 0); if (!grn_ctx_connect(ctx, hostname, port, 0)) { if (!argc) { grn_obj text; @@ -1853,7 +1852,7 @@ g_handler(grn_ctx *ctx, grn_obj *msg) int added; edge = grn_edges_add(ctx, &((grn_msg *)msg)->edge_id, &added); if (added) { - grn_ctx_init(&edge->ctx, (useql ? GRN_CTX_USE_QL : 0)); + grn_ctx_init(&edge->ctx, 0); GRN_COM_QUEUE_INIT(&edge->recv_new); GRN_COM_QUEUE_INIT(&edge->send_old); grn_ctx_use(&edge->ctx, (grn_obj *)com->ev->opaque); @@ -1903,7 +1902,6 @@ enum { }; #define MODE_MASK 0x007f -#define MODE_USE_QL 0x0080 #define MODE_NEW_DB 0x0100 static uint32_t @@ -2411,7 +2409,6 @@ main(int argc, char **argv) {'s', NULL, NULL, mode_server, GETOPT_OP_UPDATE}, {'l', "log-level", NULL, 0, GETOPT_OP_NONE}, {'i', "server-id", NULL, 0, GETOPT_OP_NONE}, - {'q', NULL, NULL, MODE_USE_QL, GETOPT_OP_ON}, {'n', NULL, NULL, MODE_NEW_DB, GETOPT_OP_ON}, {'\0', "protocol", NULL, 0, GETOPT_OP_NONE}, {'\0', "version", NULL, mode_version, GETOPT_OP_UPDATE}, @@ -2436,20 +2433,20 @@ main(int argc, char **argv) opts[2].arg = &max_num_threads_arg; opts[7].arg = &log_level_arg; opts[8].arg = &hostname_arg; - opts[11].arg = &protocol_arg; - opts[13].arg = &log_path_arg; - opts[14].arg = &query_log_path_arg; - opts[15].arg = &pid_file_path; - opts[16].arg = &config_path; - opts[18].arg = &cache_limit_arg; - opts[19].arg = &input_path; - opts[20].arg = &document_root_arg; - opts[21].arg = &default_command_version_arg; - opts[22].arg = &default_match_escalation_threshold_arg; - opts[23].arg = &bind_address_arg; - opts[24].arg = &input_fd_arg; - opts[25].arg = &output_fd_arg; - opts[26].arg = &working_directory_arg; + opts[10].arg = &protocol_arg; + opts[12].arg = &log_path_arg; + opts[13].arg = &query_log_path_arg; + opts[14].arg = &pid_file_path; + opts[15].arg = &config_path; + opts[17].arg = &cache_limit_arg; + opts[18].arg = &input_path; + opts[19].arg = &document_root_arg; + opts[20].arg = &default_command_version_arg; + opts[21].arg = &default_match_escalation_threshold_arg; + opts[22].arg = &bind_address_arg; + opts[23].arg = &input_fd_arg; + opts[24].arg = &output_fd_arg; + opts[25].arg = &working_directory_arg; reset_ready_notify_pipe(); @@ -2791,7 +2788,6 @@ main(int argc, char **argv) } newdb = (mode & MODE_NEW_DB); - useql = (mode & MODE_USE_QL); switch (mode & MODE_MASK) { case mode_alone : exit_code = do_alone(argc - i, argv + i); Modified: test/unit/core/test-context.c (+2 -2) =================================================================== --- test/unit/core/test-context.c 2014-06-11 22:58:13 +0900 (12a2e08) +++ test/unit/core/test-context.c 2014-06-16 15:22:02 +0900 (cc3be10) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2008-2010 Kouhei Sutou <kou �� clear-code.com> + Copyright (C) 2008-2014 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -40,7 +40,7 @@ cut_setup(void) { context = NULL; database = NULL; - default_flags = GRN_CTX_USE_QL; + default_flags = 0; memory = NULL; } Modified: test/unit/core/test-inverted-index.c (+2 -2) =================================================================== --- test/unit/core/test-inverted-index.c 2014-06-11 22:58:13 +0900 (2d10c6a) +++ test/unit/core/test-inverted-index.c 2014-06-16 15:22:02 +0900 (64aed17) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2008-2012 Kouhei Sutou <kou �� clear-code.com> + Copyright (C) 2008-2014 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -96,7 +96,7 @@ cut_setup(void) path = g_build_filename(tmp_directory, "inverted-index", NULL); context = g_new0(grn_ctx, 1); - grn_test_assert(grn_ctx_init(context, GRN_CTX_USE_QL)); + grn_test_assert(grn_ctx_init(context, 0)); GRN_CTX_SET_ENCODING(context, GRN_ENC_UTF8); db = grn_db_create(context, NULL, NULL); Modified: test/unit/core/test-patricia-trie.c (+1 -4) =================================================================== --- test/unit/core/test-patricia-trie.c 2014-06-11 22:58:13 +0900 (2db5d18) +++ test/unit/core/test-patricia-trie.c 2014-06-16 15:22:02 +0900 (cc521bc) @@ -49,7 +49,6 @@ void test_at(gconstpointer data); static GArray *ids; static GList *expected_keys, *actual_keys; -static grn_obj *database; void cut_setup(void) @@ -59,7 +58,6 @@ cut_setup(void) ids = NULL; expected_keys = NULL; actual_keys = NULL; - database = NULL; } static void @@ -78,8 +76,6 @@ cut_teardown(void) gcut_list_string_free(expected_keys); if (actual_keys) gcut_list_string_free(actual_keys); - if (database) - grn_obj_close(context, database); teardown_trie_common(); } @@ -827,6 +823,7 @@ test_at(gconstpointer data) cut_assert_open_context(); + grn_obj_close(context, database); database = grn_db_create(context, cut_build_path(grn_test_get_tmp_dir(), "patricia-trie.db", Modified: test/unit/core/test-patricia-trie.h (+21 -7) =================================================================== --- test/unit/core/test-patricia-trie.h 2014-06-11 22:58:13 +0900 (b8a3803) +++ test/unit/core/test-patricia-trie.h 2014-06-16 15:22:02 +0900 (0a69c04) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2008-2009 Kouhei Sutou <kou �� cozmixng.org> + Copyright (C) 2008-2014 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -30,6 +30,7 @@ static grn_logger_info *logger; static GList *expected_messages; static grn_ctx *context; +static grn_obj *database; static grn_pat *trie; static grn_pat_cursor *cursor; static grn_id id; @@ -65,6 +66,7 @@ setup_trie_common(const gchar *default_path_component) expected_messages = NULL; context = NULL; + database = NULL; trie = NULL; cursor = NULL; id = GRN_ID_NIL; @@ -88,7 +90,7 @@ setup_trie_common(const gchar *default_path_component) default_cursor_limit = -1; default_cursor_flags = 0; - default_context_flags = GRN_CTX_USE_QL; + default_context_flags = 0; cut_remove_path(base_dir, NULL); g_mkdir_with_parents(base_dir, 0755); @@ -122,11 +124,21 @@ trie_free(void) } static void +database_free(void) +{ + if (context && database) { + grn_obj_close(context, database); + database = NULL; + } +} + +static void context_free(void) { if (context) { cursor_free(); trie_free(); + database_free(); grn_ctx_fin(context); context = NULL; } @@ -167,11 +179,13 @@ teardown_trie_common(void) GRN_CTX_SET_ENCODING(context, default_encoding); \ } while (0) -#define cut_assert_open_context() do \ -{ \ - context_free(); \ - open_context(); \ - cut_assert(context); \ +#define cut_assert_open_context() do \ +{ \ + context_free(); \ + open_context(); \ + cut_assert(context); \ + database = grn_db_create(context, NULL, NULL); \ + cut_assert(database); \ } while (0) #define create_trie() do \ Modified: test/unit/core/test-performance.c (+2 -2) =================================================================== --- test/unit/core/test-performance.c 2014-06-11 22:58:13 +0900 (736c1d8) +++ test/unit/core/test-performance.c 2014-06-16 15:22:02 +0900 (7a963d8) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2008-2009 Kouhei Sutou <kou �� cozmixng.org> + Copyright (C) 2008-2014 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -184,7 +184,7 @@ run_test(const gchar **test_case_names, const grn_test_data *data) const gchar *type_name, *table_name; gchar *path; - grn_test_assert(grn_ctx_init(context, GRN_CTX_USE_QL)); + grn_test_assert(grn_ctx_init(context, 0)); GRN_CTX_SET_ENCODING(context, GRN_ENC_UTF8); Modified: test/unit/core/test-public-context.c (+2 -2) =================================================================== --- test/unit/core/test-public-context.c 2014-06-11 22:58:13 +0900 (2adc480) +++ test/unit/core/test-public-context.c 2014-06-16 15:22:02 +0900 (e34e57f) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2008-2009 Kouhei Sutou <kou �� cozmixng.org> + Copyright (C) 2008-2014 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -42,7 +42,7 @@ cut_setup(void) base_dir = grn_test_get_tmp_dir(); default_path = g_build_filename(base_dir, "db", NULL); default_encoding = GRN_ENC_DEFAULT; - default_context_flags = GRN_CTX_USE_QL; + default_context_flags = 0; cut_remove_path(base_dir, NULL); g_mkdir_with_parents(base_dir, 0755); Modified: test/unit/core/test-stress.c (+3 -3) =================================================================== --- test/unit/core/test-stress.c 2014-06-11 22:58:13 +0900 (2c728e8) +++ test/unit/core/test-stress.c 2014-06-16 15:22:02 +0900 (e459073) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2008-2009 Kouhei Sutou <kou �� cozmixng.org> + Copyright (C) 2008-2014 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -182,7 +182,7 @@ test_hash(gconstpointer test_data) gchar *path; const gchar *test_case_names[] = {"test_stress_hash", NULL}; - grn_test_assert(grn_ctx_init(context, GRN_CTX_USE_QL)); + grn_test_assert(grn_ctx_init(context, 0)); path = g_build_filename(base_dir, "hash", NULL); g_setenv(GRN_TEST_ENV_HASH_PATH, path, TRUE); @@ -214,7 +214,7 @@ test_patricia_trie(gconstpointer test_data) gchar *path; const gchar *test_case_names[] = {"test_stress_patricia_trie", NULL}; - grn_test_assert(grn_ctx_init(context, GRN_CTX_USE_QL)); + grn_test_assert(grn_ctx_init(context, 0)); path = g_build_filename(base_dir, "patricia-trie", NULL); g_setenv(GRN_TEST_ENV_PATRICIA_TRIE_PATH, path, TRUE); Modified: test/unit/core/test-tokenizer.c (+2 -2) =================================================================== --- test/unit/core/test-tokenizer.c 2014-06-11 22:58:13 +0900 (f2218a8) +++ test/unit/core/test-tokenizer.c 2014-06-16 15:22:02 +0900 (ab888e1) @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2; coding: utf-8 -*- */ /* - Copyright (C) 2012 Kouhei Sutou <kou �� clear-code.com> + Copyright (C) 2012-2014 Kouhei Sutou <kou �� clear-code.com> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -34,7 +34,7 @@ static grn_obj *db; void setup (void) { - grn_ctx_init(&context, GRN_CTX_USE_QL); + grn_ctx_init(&context, 0); db = grn_db_create(&context, NULL, NULL); } Modified: test/unit/fixtures/performance/test-read-write.c (+1 -1) =================================================================== --- test/unit/fixtures/performance/test-read-write.c 2014-06-11 22:58:13 +0900 (1561620) +++ test/unit/fixtures/performance/test-read-write.c 2014-06-16 15:22:02 +0900 (0f4ded1) @@ -123,7 +123,7 @@ test_read_write(gconstpointer *data) if (process_number_string) process_number = atoi(process_number_string); - rc = grn_ctx_init(&contexts[i], GRN_CTX_USE_QL); + rc = grn_ctx_init(&contexts[i], 0); grn_test_assert(rc, cut_set_message("context: %d (%d)", i, process_number)); context = &contexts[i]; -------------- next part -------------- HTML����������������������������... Télécharger