Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
beda3fd9
Commit
beda3fd9
authored
Dec 09, 2015
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to index rather than copy indexing.
This was 17% of all allocations on a recent profile.
parent
29e8b612
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
selector.go
pkg/labels/selector.go
+6
-6
No files found.
pkg/labels/selector.go
View file @
beda3fd9
...
...
@@ -234,8 +234,8 @@ func (r *Requirement) String() string {
// Add adds requirements to the selector. It copies the current selector returning a new one
func
(
lsel
internalSelector
)
Add
(
reqs
...
Requirement
)
Selector
{
var
sel
internalSelector
for
_
,
item
:=
range
lsel
{
sel
=
append
(
sel
,
item
)
for
ix
:=
range
lsel
{
sel
=
append
(
sel
,
lsel
[
ix
]
)
}
for
_
,
r
:=
range
reqs
{
sel
=
append
(
sel
,
r
)
...
...
@@ -248,8 +248,8 @@ func (lsel internalSelector) Add(reqs ...Requirement) Selector {
// its Requirements match the input Labels. If any
// Requirement does not match, false is returned.
func
(
lsel
internalSelector
)
Matches
(
l
Labels
)
bool
{
for
_
,
req
:=
range
lsel
{
if
matches
:=
req
.
Matches
(
l
);
!
matches
{
for
ix
:=
range
lsel
{
if
matches
:=
lsel
[
ix
]
.
Matches
(
l
);
!
matches
{
return
false
}
}
...
...
@@ -260,8 +260,8 @@ func (lsel internalSelector) Matches(l Labels) bool {
// the internalSelector Requirements' human-readable strings.
func
(
lsel
internalSelector
)
String
()
string
{
var
reqs
[]
string
for
_
,
req
:=
range
lsel
{
reqs
=
append
(
reqs
,
req
.
String
())
for
ix
:=
range
lsel
{
reqs
=
append
(
reqs
,
lsel
[
ix
]
.
String
())
}
return
strings
.
Join
(
reqs
,
","
)
}
...
...
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