Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bio-rd
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
bio-rd
Commits
a988c35b
Commit
a988c35b
authored
7 years ago
by
Oliver Herms
Browse files
Options
Downloads
Patches
Plain Diff
Changing return of RemovePath from bool to int
parent
54d9bad5
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
route/route.go
+14
-3
14 additions, 3 deletions
route/route.go
with
14 additions
and
3 deletions
route/route.go
+
14
−
3
View file @
a988c35b
...
@@ -57,6 +57,17 @@ func (r *Route) Pfxlen() uint8 {
...
@@ -57,6 +57,17 @@ func (r *Route) Pfxlen() uint8 {
return
r
.
pfx
.
Pfxlen
()
return
r
.
pfx
.
Pfxlen
()
}
}
// Paths returns a copy of the list of paths associated with route r
func
(
r
*
Route
)
Paths
()
[]
*
Path
{
if
r
.
paths
==
nil
{
return
nil
}
ret
:=
make
([]
*
Path
,
len
(
r
.
paths
))
copy
(
ret
,
r
.
paths
)
return
ret
}
// AddPath adds path p to route r
// AddPath adds path p to route r
func
(
r
*
Route
)
AddPath
(
p
*
Path
)
{
func
(
r
*
Route
)
AddPath
(
p
*
Path
)
{
if
p
==
nil
{
if
p
==
nil
{
...
@@ -70,16 +81,16 @@ func (r *Route) AddPath(p *Path) {
...
@@ -70,16 +81,16 @@ func (r *Route) AddPath(p *Path) {
}
}
// RemovePath removes path `rm` from route `r`. Returns true if removed path was last one. False otherwise.
// RemovePath removes path `rm` from route `r`. Returns true if removed path was last one. False otherwise.
func
(
r
*
Route
)
RemovePath
(
p
*
Path
)
(
final
bool
)
{
func
(
r
*
Route
)
RemovePath
(
p
*
Path
)
int
{
if
p
==
nil
{
if
p
==
nil
{
return
false
return
len
(
r
.
paths
)
}
}
r
.
mu
.
Lock
()
r
.
mu
.
Lock
()
defer
r
.
mu
.
Unlock
()
defer
r
.
mu
.
Unlock
()
r
.
paths
=
removePath
(
r
.
paths
,
p
)
r
.
paths
=
removePath
(
r
.
paths
,
p
)
return
len
(
r
.
paths
)
==
0
return
len
(
r
.
paths
)
}
}
func
removePath
(
paths
[]
*
Path
,
remove
*
Path
)
[]
*
Path
{
func
removePath
(
paths
[]
*
Path
,
remove
*
Path
)
[]
*
Path
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment