LGTM On Wed, Feb 8, 2012 at 4:22 PM, <r@golang.org> wrote: > Reviewers: golang-dev_googlegroups.com, > ...
13 years, 2 months ago
(2012-02-09 00:23:58 UTC)
#2
LGTM
On Wed, Feb 8, 2012 at 4:22 PM, <r@golang.org> wrote:
> Reviewers: golang-dev_googlegroups.com,
>
> Message:
> Hello golang-dev@googlegroups.com,
>
> I'd like you to review this change to
> https://go.googlecode.com/hg/
>
>
> Description:
> encoding/binary: add Size, to replace the functionality of the old
> TotalSize
>
> Please review this at
http://codereview.appspot.com/**5644063/<http://codereview.appspot.com/5644063/>
>
> Affected files:
> M doc/go1.html
> M doc/go1.tmpl
> M src/pkg/encoding/binary/**binary.go
>
>
> Index: doc/go1.html
> ==============================**==============================**=======
> --- a/doc/go1.html
> +++ b/doc/go1.html
> @@ -931,7 +931,8 @@
> <h3 id="encoding_binary">The encoding/binary package</h3>
>
> <p>
> -In Go 1, the <code>binary.TotalSize</code><**/a> function is no longer
> exported.
> +In Go 1, the <code>binary.TotalSize</code> function is renamed
> +<a href="/pkg/encoding/binary/#**Size"><code>Size</code></a>.
> </p>
>
> <p>
> Index: doc/go1.tmpl
> ==============================**==============================**=======
> --- a/doc/go1.tmpl
> +++ b/doc/go1.tmpl
> @@ -835,7 +835,10 @@
> <h3 id="encoding_binary">The encoding/binary package</h3>
>
> <p>
> -In Go 1, the <code>binary.TotalSize</code><**/a> function is no longer
> exported.
> +In Go 1, the <code>binary.TotalSize</code> function has been replaced by
> +<a href="/pkg/encoding/binary/#**Size"><code>Size</code></a>,
> +which takes an <code>interface{}</code> argument rather than
> +a <code>reflect.Value</code>.
> </p>
>
> <p>
> Index: src/pkg/encoding/binary/**binary.go
> ==============================**==============================**=======
> --- a/src/pkg/encoding/binary/**binary.go
> +++ b/src/pkg/encoding/binary/**binary.go
> @@ -253,6 +253,12 @@
> return err
> }
>
> +// Size returns how many bytes Write would generate to encode the value
> v, assuming
> +// the Write would succeed.
> +func Size(v interface{}) int {
> + return dataSize(reflect.ValueOf(v))
> +}
> +
> // dataSize returns the number of bytes the actual data represented by v
> occupies in memory.
> // For compound structures, it sums the sizes of the elements. Thus, for
> instance, for a slice
> // it returns the length of the slice times the element size and does not
> count the memory
>
>
>
Issue 5644063: code review 5644063: encoding/binary: add Size, to replace the functionality...
(Closed)
Created 13 years, 2 months ago by r
Modified 13 years, 2 months ago
Reviewers:
Base URL:
Comments: 0