Skip to content

Commit 81a110f

Browse files
author
blake2-ppc
committed
---
yaml --- r: 80414 b: refs/heads/snap-stage3 c: 8fce135 h: refs/heads/master v: v3
1 parent 9685c7f commit 81a110f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 3e1803f3af1adc1b2e5595650f6920f40bbedc2e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 8d488f38ed4fad414f9a693b6f4574dfa92b06fd
4+
refs/heads/snap-stage3: 8fce135326707264d99102cdb514b00d6aa38081
55
refs/heads/try: 71bebebc37fbb229877da88dde13c2f35913bd77
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/vec.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2244,6 +2244,23 @@ pub mod bytes {
22442244
// Bound checks are done at vec::raw::copy_memory.
22452245
unsafe { vec::raw::copy_memory(dst, src, count) }
22462246
}
2247+
2248+
/**
2249+
* Allocate space in `dst` and append the data in `src`.
2250+
*/
2251+
#[inline]
2252+
pub fn push_bytes(dst: &mut ~[u8], src: &[u8]) {
2253+
let old_len = dst.len();
2254+
dst.reserve_additional(src.len());
2255+
unsafe {
2256+
do dst.as_mut_buf |p_dst, len_dst| {
2257+
do src.as_imm_buf |p_src, len_src| {
2258+
ptr::copy_memory(p_dst.offset(len_dst as int), p_src, len_src)
2259+
}
2260+
}
2261+
vec::raw::set_len(dst, old_len + src.len());
2262+
}
2263+
}
22472264
}
22482265

22492266
impl<A: Clone> Clone for ~[A] {

0 commit comments

Comments
 (0)