Skip to content

Commit 404c8a8

Browse files
authored
Chore (#1365)
* chore-1 * chore2
1 parent 79ccfff commit 404c8a8

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

bytesconv.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,7 @@ var (
252252
)
253253

254254
func readHexInt(r *bufio.Reader) (int, error) {
255-
n := 0
256-
i := 0
257-
var k int
255+
var k, i, n int
258256
for {
259257
c, err := r.ReadByte()
260258
if err != nil {

peripconn.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ type perIPConn struct {
4848
func acquirePerIPConn(conn net.Conn, ip uint32, counter *perIPConnCounter) *perIPConn {
4949
v := counter.pool.Get()
5050
if v == nil {
51-
v = &perIPConn{
51+
return &perIPConn{
5252
perIPConnCounter: counter,
53+
Conn: conn,
54+
ip: ip,
5355
}
5456
}
5557
c := v.(*perIPConn)

uri.go

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -538,15 +538,9 @@ func shouldEscape(c byte, mode encoding) bool {
538538
}
539539

540540
func ishex(c byte) bool {
541-
switch {
542-
case '0' <= c && c <= '9':
543-
return true
544-
case 'a' <= c && c <= 'f':
545-
return true
546-
case 'A' <= c && c <= 'F':
547-
return true
548-
}
549-
return false
541+
return ('0' <= c && c <= '9') ||
542+
('a' <= c && c <= 'f') ||
543+
('A' <= c && c <= 'F')
550544
}
551545

552546
func unhex(c byte) byte {

0 commit comments

Comments
 (0)