From f69adc59ad2a960f236bf7177ee9d493890ca623 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 20 Sep 2019 20:01:56 +0300 Subject: [PATCH] io: drop getVarStringSize() completely After unexport this doesn't make much sense at all as it has just one user. --- pkg/io/size.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkg/io/size.go b/pkg/io/size.go index 7b062f6a4..14bda390c 100644 --- a/pkg/io/size.go +++ b/pkg/io/size.go @@ -46,13 +46,6 @@ func getVarIntSize(value int) int { return int(size) } -// getVarStringSize returns the size of a variable string -// (reference: GetVarSize(this string value), https://github.com/neo-project/neo/blob/master/neo/IO/Helper.cs) -func getVarStringSize(value string) int { - valueSize := len([]byte(value)) - return getVarIntSize(valueSize) + valueSize -} - // GetVarSize returns the number of bytes in a serialized variable. It supports ints/uints (estimating // them using variable-length encoding that is used in NEO), strings, pointers to Serializable structures, // slices and arrays of ints/uints or Serializable structures. It's similar to GetVarSize(this T[] value) @@ -61,7 +54,8 @@ func GetVarSize(value interface{}) int { v := reflect.ValueOf(value) switch v.Kind() { case reflect.String: - return getVarStringSize(v.String()) + valueSize := len([]byte(v.String())) + return getVarIntSize(valueSize) + valueSize case reflect.Int, reflect.Int8, reflect.Int16,