Skip to content

Commit 17fe6d3

Browse files
author
blake2-ppc
committed
---
yaml --- r: 80578 b: refs/heads/auto c: 8fce135 h: refs/heads/master v: v3
1 parent 3567162 commit 17fe6d3

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
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 8d488f38ed4fad414f9a693b6f4574dfa92b06fd
16+
refs/heads/auto: 8fce135326707264d99102cdb514b00d6aa38081
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

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