summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-10-14 11:00:34 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2022-10-14 11:00:34 +0300
commit3d9b350a9cab7faaf718313c197ff868c4af3c6a (patch)
tree24abd699c01a77f2d0e63ff1b3606a997e2324be
parent89e3815b395e29a0e2c282a08ed6326a3330a2aa (diff)
downloadmariadb-git-3d9b350a9cab7faaf718313c197ff868c4af3c6a.tar.gz
Fix clang -Wunused-but-set-variable
-rw-r--r--storage/innobase/data/data0data.cc8
-rw-r--r--storage/innobase/gis/gis0rtree.cc6
-rw-r--r--storage/innobase/include/ut0lst.h31
3 files changed, 19 insertions, 26 deletions
diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc
index 3e23cd6f662..885f79d1239 100644
--- a/storage/innobase/data/data0data.cc
+++ b/storage/innobase/data/data0data.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2020, MariaDB Corporation.
+Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -575,7 +575,6 @@ dtuple_convert_big_rec(
dfield_t* dfield;
dict_field_t* ifield;
ulint size;
- ulint n_fields;
ulint local_prefix_len;
if (!dict_index_is_clust(index)) {
@@ -604,7 +603,7 @@ dtuple_convert_big_rec(
a variable-length field that yields the biggest savings when
stored externally */
- n_fields = 0;
+ ut_d(ulint n_fields = 0);
while (page_zip_rec_needs_ext(rec_get_converted_size(index, entry,
*n_ext),
@@ -700,9 +699,8 @@ skip_field:
dfield_set_data(dfield, data, local_len);
dfield_set_ext(dfield);
- n_fields++;
(*n_ext)++;
- ut_ad(n_fields < dtuple_get_n_fields(entry));
+ ut_ad(++n_fields < dtuple_get_n_fields(entry));
if (upd && !upd->is_modified(longest_i)) {
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index bbcf36b74fe..350d1689977 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -998,7 +998,7 @@ rtr_page_split_and_insert(
lock_prdt_t new_prdt;
rec_t* first_rec = NULL;
int first_rec_group = 1;
- ulint n_iterations = 0;
+ IF_DBUG(bool iterated = false,);
if (!*heap) {
*heap = mem_heap_create(1024);
@@ -1207,7 +1207,7 @@ func_start:
the page, and it'll need the second round split in this case.
We test this scenario here*/
DBUG_EXECUTE_IF("rtr_page_need_second_split",
- if (n_iterations == 0) {
+ if (!iterated) {
rec = NULL;
goto after_insert; }
);
@@ -1272,7 +1272,7 @@ after_insert:
parent. */
rtr_clean_rtr_info(cursor->rtr_info, true);
cursor->rtr_info = NULL;
- n_iterations++;
+ IF_DBUG(iterated=true,);
rec_t* i_rec = page_rec_get_next(page_get_infimum_rec(
buf_block_get_frame(block)));
diff --git a/storage/innobase/include/ut0lst.h b/storage/innobase/include/ut0lst.h
index 9a5f3059826..fb15d6276f8 100644
--- a/storage/innobase/include/ut0lst.h
+++ b/storage/innobase/include/ut0lst.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2019, MariaDB Corporation.
+Copyright (c) 2019, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -25,8 +25,7 @@ Created 9/10/1995 Heikki Tuuri
Rewritten by Sunny Bains Dec 2011.
***********************************************************************/
-#ifndef ut0lst_h
-#define ut0lst_h
+#pragma once
/* Do not include univ.i because univ.i includes this. */
@@ -474,17 +473,17 @@ template <typename List, class Functor>
void ut_list_validate(const List& list, Functor& functor)
{
ut_list_map(list, functor);
-
+#ifdef UNIV_DEBUG
/* Validate the list backwards. */
- ulint count = 0;
+ auto count = list.count;
for (typename List::elem_type* elem = list.end;
elem != 0;
elem = (elem->*list.node).prev) {
- ++count;
+ --count;
}
-
- ut_a(count == list.count);
+ ut_ad(!count);
+#endif
}
/** Check the consistency of a doubly linked list.
@@ -494,23 +493,24 @@ template <typename List, class Functor>
inline void ut_list_validate(const List& list, const Functor& functor)
{
ut_list_map(list, functor);
-
+#ifdef UNIV_DEBUG
/* Validate the list backwards. */
- ulint count = 0;
+ auto count = list.count;
for (typename List::elem_type* elem = list.end;
elem != 0;
elem = (elem->*list.node).prev) {
- ++count;
+ --count;
}
- ut_a(count == list.count);
+ ut_ad(!count);
+#endif
}
template <typename List>
inline void ut_list_validate(const List& list)
{
- ut_list_validate(list, NullValidate());
+ ut_d(ut_list_validate(list, NullValidate()));
}
#ifdef UNIV_DEBUG
@@ -561,8 +561,3 @@ ut_list_move_to_front(
ut_list_prepend(list, elem);
}
}
-
-#ifdef UNIV_DEBUG
-#endif
-
-#endif /* ut0lst.h */