diff options
author | Sergei Golubchik <serg@mariadb.org> | 2023-01-16 12:05:15 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2023-01-17 15:28:56 +0100 |
commit | 3b932255ccdf13b8abbb3a33882a410ac7e4b5b2 (patch) | |
tree | 846ee1590c0ac3acf3b924de00362d2ea665b3cd | |
parent | cce76fef381a92bf76f39d4da13981472ebb4cb7 (diff) | |
download | mariadb-git-3b932255ccdf13b8abbb3a33882a410ac7e4b5b2.tar.gz |
cleanup: const_Item->real_item()
allow real_item() to be called for const Item*,
remove casts in the code
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/item.h | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sql/item.cc b/sql/item.cc index 1a55317754e..ac5082dbdb2 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -3444,7 +3444,7 @@ bool Item_field::is_null_result() bool Item_field::eq(const Item *item, bool binary_cmp) const { - Item *real_item2= ((Item *) item)->real_item(); + const Item *real_item2= item->real_item(); if (real_item2->type() != FIELD_ITEM) return 0; diff --git a/sql/item.h b/sql/item.h index 1273de44edb..01898709131 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1891,6 +1891,7 @@ public: virtual Item *copy_or_same(THD *thd) { return this; } virtual Item *copy_andor_structure(THD *thd) { return this; } virtual Item *real_item() { return this; } + const Item *real_item() const { return const_cast<Item*>(this)->real_item(); } virtual Item *get_tmp_table_item(THD *thd) { return copy_or_same(thd); } virtual Item *make_odbc_literal(THD *thd, const LEX_CSTRING *typestr) { @@ -5404,7 +5405,7 @@ public: { return ref ? (*ref)->type() : REF_ITEM; } bool eq(const Item *item, bool binary_cmp) const override { - Item *it= ((Item *) item)->real_item(); + const Item *it= item->real_item(); return ref && (*ref)->eq(it, binary_cmp); } void save_val(Field *to) override; @@ -5762,7 +5763,7 @@ public: { orig_item->make_send_field(thd, field); } bool eq(const Item *item, bool binary_cmp) const override { - Item *it= const_cast<Item*>(item)->real_item(); + const Item *it= item->real_item(); return orig_item->eq(it, binary_cmp); } void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge) @@ -7638,7 +7639,7 @@ public: { m_item->make_send_field(thd, field); } bool eq(const Item *item, bool binary_cmp) const { - Item *it= ((Item *) item)->real_item(); + const Item *it= item->real_item(); return m_item->eq(it, binary_cmp); } void fix_after_pullout(st_select_lex *new_parent, Item **refptr, bool merge) |