From 1f7898f6869fc0db486b453d644908b42e92d50b Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 25 Sep 2024 11:09:09 +1000 Subject: [PATCH] mroonga: remove -Wunused-but-set-variable warnings There where unused variable. They were not conditional on defines, so removed them. Added an error handing in proc_object if there was no db as subsequent operations would have failed. --- storage/mroonga/vendor/groonga/lib/proc/proc_object.c | 6 ++++-- .../mroonga/vendor/groonga/plugins/functions/index_column.c | 3 +-- .../mroonga/vendor/groonga/plugins/query_expanders/tsv.c | 3 +-- storage/mroonga/vendor/groonga/plugins/suggest/suggest.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/storage/mroonga/vendor/groonga/lib/proc/proc_object.c b/storage/mroonga/vendor/groonga/lib/proc/proc_object.c index 380e65531a1..40eb2b51bb5 100644 --- a/storage/mroonga/vendor/groonga/lib/proc/proc_object.c +++ b/storage/mroonga/vendor/groonga/lib/proc/proc_object.c @@ -69,13 +69,15 @@ command_object_remove(grn_ctx *ctx, grn_obj **args, grn_user_data *user_data) { - grn_obj *db; grn_obj *name; grn_bool force; grn_obj *target; grn_bool failed_to_open; - db = grn_ctx_db(ctx); + if (!grn_ctx_db(ctx)) { + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, "invalid db assigned"); + return NULL; + } name = grn_plugin_proc_get_var(ctx, user_data, "name", -1); force = grn_plugin_proc_get_var_bool(ctx, user_data, "force", -1, GRN_FALSE); diff --git a/storage/mroonga/vendor/groonga/plugins/functions/index_column.c b/storage/mroonga/vendor/groonga/plugins/functions/index_column.c index 0501007471f..58764944d4f 100644 --- a/storage/mroonga/vendor/groonga/plugins/functions/index_column.c +++ b/storage/mroonga/vendor/groonga/plugins/functions/index_column.c @@ -91,8 +91,7 @@ selector_index_column_df_ratio_between(grn_ctx *ctx, df_ratio = (double)n_match_documents / (double)n_documents; { void *key; - int key_size; - key_size = grn_table_cursor_get_key(ctx, cursor, &key); + grn_table_cursor_get_key(ctx, cursor, &key); } if (min <= df_ratio && df_ratio <= max) { posting.rid = term_id; diff --git a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c index 5d5deec69c1..09d3803eddb 100644 --- a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c +++ b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c @@ -196,7 +196,6 @@ load_synonyms(grn_ctx *ctx) const char *path; grn_file_reader *file_reader; int number_of_lines; - grn_encoding encoding; grn_obj line, key, value; grn_getenv("GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE", @@ -234,7 +233,7 @@ load_synonyms(grn_ctx *ctx) } number_of_lines++; if (number_of_lines == 1) { - encoding = guess_encoding(ctx, &line_value, &line_length); + guess_encoding(ctx, &line_value, &line_length); } GRN_BULK_REWIND(&key); GRN_BULK_REWIND(&value); diff --git a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c index 7f64f3c17d9..411000f7dbf 100644 --- a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c +++ b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c @@ -653,7 +653,7 @@ learner_init(grn_ctx *ctx, grn_suggest_learner *learner, static void learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner) { - grn_id events_id, event_types_id; + grn_id events_id; grn_obj *seqs, *events, *post_item, *items, *pairs; learner->seqs = seqs = grn_ctx_at(ctx, GRN_OBJ_GET_DOMAIN(learner->seq)); @@ -665,7 +665,7 @@ learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner) learner->events_type = grn_obj_column(ctx, events, CONST_STR_LEN("type")); learner->events_time = grn_obj_column(ctx, events, CONST_STR_LEN("time")); - event_types_id = grn_obj_get_range(ctx, learner->events_type); + grn_obj_get_range(ctx, learner->events_type); learner->event_types = grn_obj_column(ctx, events, CONST_STR_LEN("time")); post_item = learner->post_item;