Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
dfe6e624
Commit
dfe6e624
authored
Aug 09, 2019
by
Nikita Malyavin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-20297 sql_list: add begin() and end() for List<T>
parent
e81db2ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
15 deletions
+60
-15
sql/sql_list.h
sql/sql_list.h
+59
-14
sql/table.cc
sql/table.cc
+1
-1
No files found.
sql/sql_list.h
View file @
dfe6e624
...
...
@@ -374,6 +374,13 @@ class base_list :public Sql_alloc
}
#endif // LIST_EXTRA_DEBUG
void
sublist
(
list_node
*
start
,
base_list
*
l
,
uint
elems
)
{
first
=
start
;
last
=
l
->
last
;
elements
=
elems
;
}
protected:
void
after
(
void
*
info
,
list_node
*
node
)
{
...
...
@@ -534,6 +541,7 @@ template <class T> class List_iterator :public base_list_iterator
List_iterator
()
:
base_list_iterator
()
{}
inline
void
init
(
List
<
T
>
&
a
)
{
base_list_iterator
::
init
(
a
);
}
inline
T
*
operator
++
(
int
)
{
return
(
T
*
)
base_list_iterator
::
next
();
}
inline
void
operator
++
()
{
base_list_iterator
::
next
();
}
inline
T
*
peek
()
{
return
(
T
*
)
base_list_iterator
::
peek
();
}
inline
T
*
replace
(
T
*
a
)
{
return
(
T
*
)
base_list_iterator
::
replace
(
a
);
}
inline
T
*
replace
(
List
<
T
>
&
a
)
{
return
(
T
*
)
base_list_iterator
::
replace
(
a
);
}
...
...
@@ -544,24 +552,49 @@ template <class T> class List_iterator :public base_list_iterator
};
template
<
class
T
>
class
List_iterator_fast
:
public
base_list_iterator
template
<
class
T
>
class
List_iterator_fast
{
protected:
inline
T
*
replace
(
T
*
)
{
return
(
T
*
)
0
;
}
inline
T
*
replace
(
List
<
T
>
&
)
{
return
(
T
*
)
0
;
}
inline
void
remove
(
void
)
{}
inline
void
after
(
T
*
)
{}
inline
T
**
ref
(
void
)
{
return
(
T
**
)
0
;
}
List
<
T
>
*
list
;
list_node
*
elem
;
friend
void
sublist
(
List_iterator_fast
<
T
>
&
it
,
List
<
T
>
&
list
,
uint
elements
)
{
list
.
first
=
*
it
.
elem
;
list
.
last
=
it
.
list
->
last
;
list
.
elements
=
elements
;
}
public:
inline
List_iterator_fast
(
List
<
T
>
&
a
)
:
base_list_iterator
(
a
)
{}
inline
List_iterator_fast
()
:
base_list_iterator
()
{}
inline
void
init
(
List
<
T
>
&
a
)
{
base_list_iterator
::
init
(
a
);
}
inline
T
*
operator
++
(
int
)
{
return
(
T
*
)
base_list_iterator
::
next_fast
();
}
inline
void
rewind
(
void
)
{
base_list_iterator
::
rewind
();
}
void
sublist
(
List
<
T
>
&
list_arg
,
uint
el_arg
)
inline
List_iterator_fast
()
:
list
(
NULL
),
elem
(
NULL
)
{}
explicit
inline
List_iterator_fast
(
List
<
T
>
&
a
)
:
list
(
&
a
),
elem
(
a
.
first_node
())
{}
inline
void
init
(
List
<
T
>
&
a
)
{
*
this
=
List_iterator_fast
(
a
);
}
inline
T
*
operator
++
(
int
)
{
elem
=
elem
->
next
;
return
static_cast
<
T
*>
(
elem
->
info
);
}
inline
void
operator
++
()
{
elem
=
elem
->
next
;
}
inline
T
**
ref
()
{
return
reinterpret_cast
<
T
**>
(
&
elem
->
info
);
}
inline
void
rewind
()
{
elem
=
list
->
first_node
();
}
void
sublist
(
List
<
T
>
&
list_arg
,
uint
elements
)
{
base_list_iterator
::
sublist
(
list_arg
,
el_arg
);
list_arg
.
sublist
(
elem
,
list
,
elements
);
}
inline
bool
operator
!=
(
const
List_iterator_fast
<
T
>
&
it
)
{
return
elem
!=
it
.
elem
;
}
inline
T
&
operator
*
()
{
return
*
static_cast
<
T
*>
(
elem
->
info
);}
static
inline
List_iterator_fast
<
T
>
end
(
List
<
T
>
&
l
)
{
List_iterator_fast
<
T
>
it
(
l
);
it
.
elem
=
&
end_of_list
;
return
it
;
}
};
...
...
@@ -811,4 +844,16 @@ list_copy_and_replace_each_value(List<T> &list, MEM_ROOT *mem_root)
void
free_list
(
I_List
<
i_string_pair
>
*
list
);
void
free_list
(
I_List
<
i_string
>
*
list
);
template
<
class
T
>
List_iterator_fast
<
T
>
begin
(
List
<
T
>
&
l
)
{
List_iterator_fast
<
T
>
it
(
l
);
return
it
;
}
template
<
class
T
>
List_iterator_fast
<
T
>
end
(
List
<
T
>
&
l
)
{
return
List_iterator_fast
<
T
>::
end
(
l
);
}
#endif // INCLUDES_MYSQL_SQL_LIST_H
sql/table.cc
View file @
dfe6e624
...
...
@@ -6294,7 +6294,7 @@ TABLE *TABLE_LIST::get_real_join_table()
if
(
!
tbl
->
nested_join
)
break
;
/* go deeper if we've found nested join */
ti
=
tbl
->
nested_join
->
join_list
;
ti
.
init
(
tbl
->
nested_join
->
join_list
)
;
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment