Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
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
Libraries
nghttp2
Commits
d9a2ff27
Commit
d9a2ff27
authored
Mar 27, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Use len instead of n for clarity
parent
8a539420
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
src/template.h
src/template.h
+9
-9
No files found.
src/template.h
View file @
d9a2ff27
...
@@ -99,14 +99,14 @@ template <typename T, typename F> bool test_flags(T t, F flags) {
...
@@ -99,14 +99,14 @@ template <typename T, typename F> bool test_flags(T t, F flags) {
// T *dlnext, which point to previous element and next element in the
// T *dlnext, which point to previous element and next element in the
// list respectively.
// list respectively.
template
<
typename
T
>
struct
DList
{
template
<
typename
T
>
struct
DList
{
DList
()
:
head
(
nullptr
),
tail
(
nullptr
),
n
(
0
)
{}
DList
()
:
head
(
nullptr
),
tail
(
nullptr
),
le
n
(
0
)
{}
DList
(
const
DList
&
)
=
delete
;
DList
(
const
DList
&
)
=
delete
;
DList
&
operator
=
(
const
DList
&
)
=
delete
;
DList
&
operator
=
(
const
DList
&
)
=
delete
;
DList
(
DList
&&
other
)
:
head
(
other
.
head
),
tail
(
other
.
tail
),
n
(
other
.
n
)
{
DList
(
DList
&&
other
)
:
head
(
other
.
head
),
tail
(
other
.
tail
),
len
(
other
.
le
n
)
{
other
.
head
=
other
.
tail
=
nullptr
;
other
.
head
=
other
.
tail
=
nullptr
;
other
.
n
=
0
;
other
.
le
n
=
0
;
}
}
DList
&
operator
=
(
DList
&&
other
)
{
DList
&
operator
=
(
DList
&&
other
)
{
...
@@ -115,16 +115,16 @@ template <typename T> struct DList {
...
@@ -115,16 +115,16 @@ template <typename T> struct DList {
}
}
head
=
other
.
head
;
head
=
other
.
head
;
tail
=
other
.
tail
;
tail
=
other
.
tail
;
n
=
other
.
n
;
len
=
other
.
le
n
;
other
.
head
=
other
.
tail
=
nullptr
;
other
.
head
=
other
.
tail
=
nullptr
;
other
.
n
=
0
;
other
.
le
n
=
0
;
return
*
this
;
return
*
this
;
}
}
void
append
(
T
*
t
)
{
void
append
(
T
*
t
)
{
++
n
;
++
le
n
;
if
(
tail
)
{
if
(
tail
)
{
tail
->
dlnext
=
t
;
tail
->
dlnext
=
t
;
t
->
dlprev
=
tail
;
t
->
dlprev
=
tail
;
...
@@ -135,7 +135,7 @@ template <typename T> struct DList {
...
@@ -135,7 +135,7 @@ template <typename T> struct DList {
}
}
void
remove
(
T
*
t
)
{
void
remove
(
T
*
t
)
{
--
n
;
--
le
n
;
auto
p
=
t
->
dlprev
;
auto
p
=
t
->
dlprev
;
auto
n
=
t
->
dlnext
;
auto
n
=
t
->
dlnext
;
if
(
p
)
{
if
(
p
)
{
...
@@ -155,10 +155,10 @@ template <typename T> struct DList {
...
@@ -155,10 +155,10 @@ template <typename T> struct DList {
bool
empty
()
const
{
return
head
==
nullptr
;
}
bool
empty
()
const
{
return
head
==
nullptr
;
}
size_t
size
()
const
{
return
n
;
}
size_t
size
()
const
{
return
le
n
;
}
T
*
head
,
*
tail
;
T
*
head
,
*
tail
;
size_t
n
;
size_t
le
n
;
};
};
template
<
typename
T
>
void
dlist_delete_all
(
DList
<
T
>
&
dl
)
{
template
<
typename
T
>
void
dlist_delete_all
(
DList
<
T
>
&
dl
)
{
...
...
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