aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/text/language/go1_1.go
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2018-05-10 14:26:55 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-05-11 16:26:35 +0000
commitc8208a845e734a3527f5f589d7d318087ca92b07 (patch)
tree887f9b7f4ef5202fd521fd6b7d65ac25e331db9b /vendor/golang.org/x/text/language/go1_1.go
parent89430ffe65636b45cab834c94f176c1dc1d8a167 (diff)
downloadpodman-c8208a845e734a3527f5f589d7d318087ca92b07.tar.gz
podman-c8208a845e734a3527f5f589d7d318087ca92b07.tar.bz2
podman-c8208a845e734a3527f5f589d7d318087ca92b07.zip
vendor/golang.org/x/text: Vendor collate and language
Following the vndr docs [1]: $ go get -u github.com/LK4D4/vndr $ vndr golang.org/x/text $ git add -A vendor/golang.org/x/text The targeted 'git add' was because we seem to have versioned some test files (e.g. vendor/github.com/varlink/go/varlink/varlink_test.go in 8493dba2 (Initial varlink implementation, 2018-03-26, #627). I don't know why, possibly an old vndr version? But either way, I'm punting that particular issue to a separate branch. [1]: https://github.com/LK4D4/vndr/blob/1fc68ee0c852556a9ed53cbde16247033f104111/README.md Signed-off-by: W. Trevor King <wking@tremily.us> Closes: #686 Approved by: mheon
Diffstat (limited to 'vendor/golang.org/x/text/language/go1_1.go')
-rw-r--r--vendor/golang.org/x/text/language/go1_1.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/golang.org/x/text/language/go1_1.go b/vendor/golang.org/x/text/language/go1_1.go
new file mode 100644
index 000000000..380f4c09f
--- /dev/null
+++ b/vendor/golang.org/x/text/language/go1_1.go
@@ -0,0 +1,38 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build !go1.2
+
+package language
+
+import "sort"
+
+func sortStable(s sort.Interface) {
+ ss := stableSort{
+ s: s,
+ pos: make([]int, s.Len()),
+ }
+ for i := range ss.pos {
+ ss.pos[i] = i
+ }
+ sort.Sort(&ss)
+}
+
+type stableSort struct {
+ s sort.Interface
+ pos []int
+}
+
+func (s *stableSort) Len() int {
+ return len(s.pos)
+}
+
+func (s *stableSort) Less(i, j int) bool {
+ return s.s.Less(i, j) || !s.s.Less(j, i) && s.pos[i] < s.pos[j]
+}
+
+func (s *stableSort) Swap(i, j int) {
+ s.s.Swap(i, j)
+ s.pos[i], s.pos[j] = s.pos[j], s.pos[i]
+}