goprotobuf: Drop unused argument to enc_struct/size_struct.
LGTM=djd
R=djd
CC=golang-codereviews
https://codereview.appspot.com/177110043
diff --git a/proto/encode.go b/proto/encode.go
index 35e5ad5..6fd29b2 100644
--- a/proto/encode.go
+++ b/proto/encode.go
@@ -247,7 +247,7 @@
return ErrNil
}
if err == nil {
- err = p.enc_struct(t.Elem(), GetProperties(t.Elem()), base)
+ err = p.enc_struct(GetProperties(t.Elem()), base)
}
if collectStats {
@@ -271,7 +271,7 @@
return 0
}
if err == nil {
- n = size_struct(t.Elem(), GetProperties(t.Elem()), base)
+ n = size_struct(GetProperties(t.Elem()), base)
}
if collectStats {
@@ -429,7 +429,7 @@
}
o.buf = append(o.buf, p.tagcode...)
- return o.enc_len_struct(p.stype, p.sprop, structp, &state)
+ return o.enc_len_struct(p.sprop, structp, &state)
}
func size_struct_message(p *Properties, base structPointer) int {
@@ -448,7 +448,7 @@
}
n0 := len(p.tagcode)
- n1 := size_struct(p.stype, p.sprop, structp)
+ n1 := size_struct(p.sprop, structp)
n2 := sizeVarint(uint64(n1)) // size of encoded length
return n0 + n1 + n2
}
@@ -462,7 +462,7 @@
}
o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))
- err := o.enc_struct(p.stype, p.sprop, b)
+ err := o.enc_struct(p.sprop, b)
if err != nil && !state.shouldContinue(err, nil) {
return err
}
@@ -477,7 +477,7 @@
}
n += sizeVarint(uint64((p.Tag << 3) | WireStartGroup))
- n += size_struct(p.stype, p.sprop, b)
+ n += size_struct(p.sprop, b)
n += sizeVarint(uint64((p.Tag << 3) | WireEndGroup))
return
}
@@ -831,7 +831,7 @@
}
o.buf = append(o.buf, p.tagcode...)
- err := o.enc_len_struct(p.stype, p.sprop, structp, &state)
+ err := o.enc_len_struct(p.sprop, structp, &state)
if err != nil && !state.shouldContinue(err, nil) {
if err == ErrNil {
return ErrRepeatedHasNil
@@ -861,7 +861,7 @@
continue
}
- n0 := size_struct(p.stype, p.sprop, structp)
+ n0 := size_struct(p.sprop, structp)
n1 := sizeVarint(uint64(n0)) // size of encoded length
n += n0 + n1
}
@@ -882,7 +882,7 @@
o.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))
- err := o.enc_struct(p.stype, p.sprop, b)
+ err := o.enc_struct(p.sprop, b)
if err != nil && !state.shouldContinue(err, nil) {
if err == ErrNil {
@@ -908,7 +908,7 @@
return // return size up to this point
}
- n += size_struct(p.stype, p.sprop, b)
+ n += size_struct(p.sprop, b)
}
return
}
@@ -946,7 +946,7 @@
}
// Encode a struct.
-func (o *Buffer) enc_struct(t reflect.Type, prop *StructProperties, base structPointer) error {
+func (o *Buffer) enc_struct(prop *StructProperties, base structPointer) error {
var state errorState
// Encode fields in tag order so that decoders may use optimizations
// that depend on the ordering.
@@ -978,7 +978,7 @@
return state.err
}
-func size_struct(t reflect.Type, prop *StructProperties, base structPointer) (n int) {
+func size_struct(prop *StructProperties, base structPointer) (n int) {
for _, i := range prop.order {
p := prop.Prop[i]
if p.size != nil {
@@ -998,11 +998,11 @@
var zeroes [20]byte // longer than any conceivable sizeVarint
// Encode a struct, preceded by its encoded length (as a varint).
-func (o *Buffer) enc_len_struct(t reflect.Type, prop *StructProperties, base structPointer, state *errorState) error {
+func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error {
iLen := len(o.buf)
o.buf = append(o.buf, 0, 0, 0, 0) // reserve four bytes for length
iMsg := len(o.buf)
- err := o.enc_struct(t, prop, base)
+ err := o.enc_struct(prop, base)
if err != nil && !state.shouldContinue(err, nil) {
return err
}