Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1862)

Issue 7587045: code review 7587045: bytes: add Capped function to set a byte slice's capacity (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 1 month ago by bradfitz
Modified:
10 years, 12 months ago
Reviewers:
rsc, 0xjnml, golang-dev
Visibility:
Public.

Description

bytes: add Capped function to set a byte slice's capacity Proposal. New function to set a []byte's capacity down to its length. This isn't a general purpose fix to Issue 1642, but it's one of the (most?) common uses. I'd like to be able to use this on App Engine, which doesn't permit untrusted code from using the unsafe package. Update issue 1642

Patch Set 1 #

Patch Set 2 : diff -r 8fa3f49f6ab1 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 8fa3f49f6ab1 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+41 lines, -0 lines) Patch
M src/pkg/bytes/bytes.go View 1 2 chunks +14 lines, -0 lines 0 comments Download
M src/pkg/bytes/bytes_test.go View 1 1 chunk +27 lines, -0 lines 0 comments Download

Messages

Total messages: 4
bradfitz
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
11 years, 1 month ago (2013-03-20 06:39:12 UTC) #1
0xjnml
I don't like the idea, sorry. `cap(slice)` would become either 'capacity of slice' or any ...
11 years, 1 month ago (2013-03-20 09:14:47 UTC) #2
bradfitz
The whole point is to subvert append. On Wed, Mar 20, 2013 at 2:14 AM, ...
11 years, 1 month ago (2013-03-20 14:04:29 UTC) #3
rsc
11 years, 1 month ago (2013-03-20 14:54:30 UTC) #4
Not now please. Too late for new API, especially this fundamental.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b