mirror of
https://github.com/golang/go
synced 2024-11-21 13:54:43 -07:00
container/vector: removed some uses of container/vector in other pkgs
R=gri CC=golang-dev https://golang.org/cl/4823054
This commit is contained in:
parent
22f71cde6a
commit
2f4632febc
@ -9,7 +9,6 @@ import (
|
||||
"asn1"
|
||||
"big"
|
||||
"bytes"
|
||||
"container/vector"
|
||||
"crypto"
|
||||
"crypto/dsa"
|
||||
"crypto/rsa"
|
||||
@ -794,7 +793,7 @@ func ParseCertificate(asn1Data []byte) (*Certificate, os.Error) {
|
||||
// ParseCertificates parses one or more certificates from the given ASN.1 DER
|
||||
// data. The certificates must be concatenated with no intermediate padding.
|
||||
func ParseCertificates(asn1Data []byte) ([]*Certificate, os.Error) {
|
||||
v := new(vector.Vector)
|
||||
var v []interface{}
|
||||
|
||||
for len(asn1Data) > 0 {
|
||||
cert := new(certificate)
|
||||
@ -803,12 +802,12 @@ func ParseCertificates(asn1Data []byte) ([]*Certificate, os.Error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
v.Push(cert)
|
||||
v = append(v, cert)
|
||||
}
|
||||
|
||||
ret := make([]*Certificate, v.Len())
|
||||
for i := 0; i < v.Len(); i++ {
|
||||
cert, err := parseCertificate(v.At(i).(*certificate))
|
||||
ret := make([]*Certificate, len(v))
|
||||
for i := 0; i < len(v); i++ {
|
||||
cert, err := parseCertificate(v[i].(*certificate))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"container/vector"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
@ -674,9 +673,7 @@ func parseQuery(m Values, query string) (err os.Error) {
|
||||
err = e
|
||||
continue
|
||||
}
|
||||
vec := vector.StringVector(m[key])
|
||||
vec.Push(value)
|
||||
m[key] = vec
|
||||
m[key] = append(m[key], value)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
package json
|
||||
|
||||
import (
|
||||
"container/vector"
|
||||
"encoding/base64"
|
||||
"os"
|
||||
"reflect"
|
||||
@ -669,7 +668,7 @@ func (d *decodeState) valueInterface() interface{} {
|
||||
|
||||
// arrayInterface is like array but returns []interface{}.
|
||||
func (d *decodeState) arrayInterface() []interface{} {
|
||||
var v vector.Vector
|
||||
var v []interface{}
|
||||
for {
|
||||
// Look ahead for ] - can only happen on first iteration.
|
||||
op := d.scanWhile(scanSkipSpace)
|
||||
@ -681,7 +680,7 @@ func (d *decodeState) arrayInterface() []interface{} {
|
||||
d.off--
|
||||
d.scan.undo(op)
|
||||
|
||||
v.Push(d.valueInterface())
|
||||
v = append(v, d.valueInterface())
|
||||
|
||||
// Next token must be , or ].
|
||||
op = d.scanWhile(scanSkipSpace)
|
||||
|
@ -7,7 +7,6 @@
|
||||
package dict
|
||||
|
||||
import (
|
||||
"container/vector"
|
||||
"net/textproto"
|
||||
"os"
|
||||
"strconv"
|
||||
@ -144,7 +143,7 @@ func (c *Client) Define(dict, word string) ([]*Defn, os.Error) {
|
||||
// Fields are space separated unquoted words
|
||||
// or quoted with single or double quote.
|
||||
func fields(s string) ([]string, os.Error) {
|
||||
var v vector.StringVector
|
||||
var v []string
|
||||
i := 0
|
||||
for {
|
||||
for i < len(s) && (s[i] == ' ' || s[i] == '\t') {
|
||||
@ -170,7 +169,7 @@ func fields(s string) ([]string, os.Error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
v.Push(unquote(s[i+1 : j-1]))
|
||||
v = append(v, unquote(s[i+1:j-1]))
|
||||
i = j
|
||||
} else {
|
||||
// atom
|
||||
@ -180,7 +179,7 @@ func fields(s string) ([]string, os.Error) {
|
||||
break
|
||||
}
|
||||
}
|
||||
v.Push(s[i:j])
|
||||
v = append(v, s[i:j])
|
||||
i = j
|
||||
}
|
||||
if i < len(s) {
|
||||
|
@ -7,7 +7,6 @@ package textproto
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"container/vector"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
@ -400,7 +399,7 @@ func (r *Reader) ReadDotLines() ([]string, os.Error) {
|
||||
// We could use ReadDotBytes and then Split it,
|
||||
// but reading a line at a time avoids needing a
|
||||
// large contiguous block of memory and is simpler.
|
||||
var v vector.StringVector
|
||||
var v []string
|
||||
var err os.Error
|
||||
for {
|
||||
var line string
|
||||
@ -419,7 +418,7 @@ func (r *Reader) ReadDotLines() ([]string, os.Error) {
|
||||
}
|
||||
line = line[1:]
|
||||
}
|
||||
v.Push(line)
|
||||
v = append(v, line)
|
||||
}
|
||||
return v, err
|
||||
}
|
||||
@ -466,9 +465,7 @@ func (r *Reader) ReadMIMEHeader() (MIMEHeader, os.Error) {
|
||||
}
|
||||
value := string(kv[i:])
|
||||
|
||||
v := vector.StringVector(m[key])
|
||||
v.Push(value)
|
||||
m[key] = v
|
||||
m[key] = append(m[key], value)
|
||||
|
||||
if err != nil {
|
||||
return m, err
|
||||
|
@ -7,7 +7,6 @@ package websocket
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"container/vector"
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"http"
|
||||
@ -201,21 +200,21 @@ func handshake(resourceName, host, origin, location, protocol string, br *bufio.
|
||||
bw.WriteString("GET " + resourceName + " HTTP/1.1\r\n")
|
||||
|
||||
// Step 6-14. push request headers in fields.
|
||||
var fields vector.StringVector
|
||||
fields.Push("Upgrade: WebSocket\r\n")
|
||||
fields.Push("Connection: Upgrade\r\n")
|
||||
fields.Push("Host: " + host + "\r\n")
|
||||
fields.Push("Origin: " + origin + "\r\n")
|
||||
var fields []string
|
||||
fields = append(fields, "Upgrade: WebSocket\r\n")
|
||||
fields = append(fields, "Connection: Upgrade\r\n")
|
||||
fields = append(fields, "Host: "+host+"\r\n")
|
||||
fields = append(fields, "Origin: "+origin+"\r\n")
|
||||
if protocol != "" {
|
||||
fields.Push("Sec-WebSocket-Protocol: " + protocol + "\r\n")
|
||||
fields = append(fields, "Sec-WebSocket-Protocol: "+protocol+"\r\n")
|
||||
}
|
||||
// TODO(ukai): Step 15. send cookie if any.
|
||||
|
||||
// Step 16-23. generate keys and push Sec-WebSocket-Key<n> in fields.
|
||||
key1, number1 := generateKeyNumber()
|
||||
key2, number2 := generateKeyNumber()
|
||||
fields.Push("Sec-WebSocket-Key1: " + key1 + "\r\n")
|
||||
fields.Push("Sec-WebSocket-Key2: " + key2 + "\r\n")
|
||||
fields = append(fields, "Sec-WebSocket-Key1: "+key1+"\r\n")
|
||||
fields = append(fields, "Sec-WebSocket-Key2: "+key2+"\r\n")
|
||||
|
||||
// Step 24. shuffle fields and send them out.
|
||||
for i := 1; i < len(fields); i++ {
|
||||
|
Loading…
Reference in New Issue
Block a user