Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
90f60f8e
Commit
90f60f8e
authored
Dec 15, 2015
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make expire_sources run in linear time.
It's not like it's run that often, but I've got OCD.
parent
bb2114ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
source.c
source.c
+9
-5
No files found.
source.c
View file @
90f60f8e
...
@@ -201,7 +201,7 @@ update_source(struct source *src,
...
@@ -201,7 +201,7 @@ update_source(struct source *src,
void
void
expire_sources
()
expire_sources
()
{
{
int
i
=
0
;
int
i
=
0
,
j
=
0
;
while
(
i
<
source_slots
)
{
while
(
i
<
source_slots
)
{
struct
source
*
src
=
sources
[
i
];
struct
source
*
src
=
sources
[
i
];
...
@@ -211,14 +211,18 @@ expire_sources()
...
@@ -211,14 +211,18 @@ expire_sources()
if
(
src
->
route_count
==
0
&&
src
->
time
<
now
.
tv_sec
-
SOURCE_GC_TIME
)
{
if
(
src
->
route_count
==
0
&&
src
->
time
<
now
.
tv_sec
-
SOURCE_GC_TIME
)
{
free
(
src
);
free
(
src
);
memmove
(
sources
+
i
,
sources
+
i
+
1
,
sources
[
i
]
=
NULL
;
(
source_slots
-
i
-
1
)
*
sizeof
(
struct
source
*
));
i
++
;
sources
[
source_slots
-
1
]
=
NULL
;
source_slots
--
;
}
else
{
}
else
{
if
(
j
<
i
)
{
sources
[
j
]
=
sources
[
i
];
sources
[
i
]
=
NULL
;
}
i
++
;
i
++
;
j
++
;
}
}
}
}
source_slots
=
j
;
}
}
void
void
...
...
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