Skip to content

Commit 4095412

Browse files
author
blake2-ppc
committed
---
yaml --- r: 145166 b: refs/heads/try2 c: 8fce135 h: refs/heads/master v: v3
1 parent c6015c6 commit 4095412

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
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 8d488f38ed4fad414f9a693b6f4574dfa92b06fd
8+
refs/heads/try2: 8fce135326707264d99102cdb514b00d6aa38081
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/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)