Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Vereign Client Library
Manage
Activity
Members
Labels
Plan
Issues
24
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Code
Vereign Client Library
Compare revisions
master to 18-remove_unused_code
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
code/vcl
Select target project
No results found
18-remove_unused_code
Select Git revision
Swap
Target
code/vcl
Select target project
code/vcl
1 result
master
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (1)
18 remove unused code
· eb87cfa1
Alexander Holodov
authored
6 years ago
eb87cfa1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.go
+1
-123
1 addition, 123 deletions
main.go
with
1 addition
and
123 deletions
main.go
View file @
eb87cfa1
package
main
import
(
"
bytes
"
"
code.vereign.com/code/restful-api/server
"
"fmt"
"io/ioutil"
"os"
...
...
@@ -10,9 +10,6 @@ import (
"sort"
"strings"
"unicode"
"unicode/utf8"
"code.vereign.com/code/restful-api/server"
)
func
main
()
{
...
...
@@ -164,129 +161,11 @@ func buildViamAPI() string {
return
result
}
const
(
caseMask
=
^
byte
(
0x20
)
// Mask to ignore case in ASCII.
kelvin
=
'\u212a'
smallLongEss
=
'\u017f'
)
// equalFoldRight is a specialization of bytes.EqualFold when s is
// known to be all ASCII (including punctuation), but contains an 's',
// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t.
// See comments on foldFunc.
func
equalFoldRight
(
s
,
t
[]
byte
)
bool
{
for
_
,
sb
:=
range
s
{
if
len
(
t
)
==
0
{
return
false
}
tb
:=
t
[
0
]
if
tb
<
utf8
.
RuneSelf
{
if
sb
!=
tb
{
sbUpper
:=
sb
&
caseMask
if
'A'
<=
sbUpper
&&
sbUpper
<=
'Z'
{
if
sbUpper
!=
tb
&
caseMask
{
return
false
}
}
else
{
return
false
}
}
t
=
t
[
1
:
]
continue
}
// sb is ASCII and t is not. t must be either kelvin
// sign or long s; sb must be s, S, k, or K.
tr
,
size
:=
utf8
.
DecodeRune
(
t
)
switch
sb
{
case
's'
,
'S'
:
if
tr
!=
smallLongEss
{
return
false
}
case
'k'
,
'K'
:
if
tr
!=
kelvin
{
return
false
}
default
:
return
false
}
t
=
t
[
size
:
]
}
if
len
(
t
)
>
0
{
return
false
}
return
true
}
// asciiEqualFold is a specialization of bytes.EqualFold for use when
// s is all ASCII (but may contain non-letters) and contains no
// special-folding letters.
// See comments on foldFunc.
func
asciiEqualFold
(
s
,
t
[]
byte
)
bool
{
if
len
(
s
)
!=
len
(
t
)
{
return
false
}
for
i
,
sb
:=
range
s
{
tb
:=
t
[
i
]
if
sb
==
tb
{
continue
}
if
(
'a'
<=
sb
&&
sb
<=
'z'
)
||
(
'A'
<=
sb
&&
sb
<=
'Z'
)
{
if
sb
&
caseMask
!=
tb
&
caseMask
{
return
false
}
}
else
{
return
false
}
}
return
true
}
// simpleLetterEqualFold is a specialization of bytes.EqualFold for
// use when s is all ASCII letters (no underscores, etc) and also
// doesn't contain 'k', 'K', 's', or 'S'.
// See comments on foldFunc.
func
simpleLetterEqualFold
(
s
,
t
[]
byte
)
bool
{
if
len
(
s
)
!=
len
(
t
)
{
return
false
}
for
i
,
b
:=
range
s
{
if
b
&
caseMask
!=
t
[
i
]
&
caseMask
{
return
false
}
}
return
true
}
func
foldFunc
(
s
[]
byte
)
func
(
s
,
t
[]
byte
)
bool
{
nonLetter
:=
false
special
:=
false
// special letter
for
_
,
b
:=
range
s
{
if
b
>=
utf8
.
RuneSelf
{
return
bytes
.
EqualFold
}
upper
:=
b
&
caseMask
if
upper
<
'A'
||
upper
>
'Z'
{
nonLetter
=
true
}
else
if
upper
==
'K'
||
upper
==
'S'
{
// See above for why these letters are special.
special
=
true
}
}
if
special
{
return
equalFoldRight
}
if
nonLetter
{
return
asciiEqualFold
}
return
simpleLetterEqualFold
}
// A field represents a single field found in a struct.
type
field
struct
{
name
string
nameBytes
[]
byte
// []byte(name)
equalFold
func
(
s
,
t
[]
byte
)
bool
// bytes.EqualFold or equivalent
tag
bool
index
[]
int
...
...
@@ -297,7 +176,6 @@ type field struct {
func
fillField
(
f
field
)
field
{
f
.
nameBytes
=
[]
byte
(
f
.
name
)
f
.
equalFold
=
foldFunc
(
f
.
nameBytes
)
return
f
}
...
...
This diff is collapsed.
Click to expand it.