Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
f5ab112e
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f5ab112e
编写于
5月 09, 2013
作者:
J
James Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace init() with uninit() where appropriate
上级
050c744c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
9 addition
and
14 deletion
+9
-14
src/libcore/cast.rs
src/libcore/cast.rs
+1
-1
src/libcore/vec.rs
src/libcore/vec.rs
+4
-9
src/libstd/priority_queue.rs
src/libstd/priority_queue.rs
+2
-2
src/libstd/rc.rs
src/libstd/rc.rs
+2
-2
未找到文件。
src/libcore/cast.rs
浏览文件 @
f5ab112e
...
...
@@ -25,7 +25,7 @@ pub mod rusti {
/// Casts the value at `src` to U. The two types must have the same length.
pub
unsafe
fn
transmute_copy
<
T
,
U
>
(
src
:
&
T
)
->
U
{
let
mut
dest
:
U
=
unstable
::
intrinsics
::
init
();
let
mut
dest
:
U
=
unstable
::
intrinsics
::
un
init
();
{
let
dest_ptr
:
*
mut
u8
=
rusti
::
transmute
(
&
mut
dest
);
let
src_ptr
:
*
u8
=
rusti
::
transmute
(
src
);
...
...
src/libcore/vec.rs
浏览文件 @
f5ab112e
...
...
@@ -591,8 +591,7 @@ pub fn pop<T>(v: &mut ~[T]) -> T {
}
let
valptr
=
ptr
::
to_mut_unsafe_ptr
(
&
mut
v
[
ln
-
1u
]);
unsafe
{
// FIXME #4204: Should be uninit() - we don't need this zeroed
let
mut
val
=
intrinsics
::
init
();
let
mut
val
=
intrinsics
::
uninit
();
val
<->
*
valptr
;
raw
::
set_len
(
v
,
ln
-
1u
);
val
...
...
@@ -666,8 +665,7 @@ pub fn push_all_move<T>(v: &mut ~[T], mut rhs: ~[T]) {
unsafe
{
do
as_mut_buf
(
rhs
)
|
p
,
len
|
{
for
uint
::
range
(
0
,
len
)
|
i
|
{
// FIXME #4204 Should be uninit() - don't need to zero
let
mut
x
=
intrinsics
::
init
();
let
mut
x
=
intrinsics
::
uninit
();
x
<->
*
ptr
::
mut_offset
(
p
,
i
);
push
(
&
mut
*
v
,
x
);
}
...
...
@@ -683,8 +681,7 @@ pub fn truncate<T>(v: &mut ~[T], newlen: uint) {
unsafe
{
// This loop is optimized out for non-drop types.
for
uint
::
range
(
newlen
,
oldlen
)
|
i
|
{
// FIXME #4204 Should be uninit() - don't need to zero
let
mut
dropped
=
intrinsics
::
init
();
let
mut
dropped
=
intrinsics
::
uninit
();
dropped
<->
*
ptr
::
mut_offset
(
p
,
i
);
}
}
...
...
@@ -709,9 +706,7 @@ pub fn dedup<T:Eq>(v: &mut ~[T]) {
// last_written < next_to_read < ln
if
*
ptr
::
mut_offset
(
p
,
next_to_read
)
==
*
ptr
::
mut_offset
(
p
,
last_written
)
{
// FIXME #4204 Should be uninit() - don't need to
// zero
let
mut
dropped
=
intrinsics
::
init
();
let
mut
dropped
=
intrinsics
::
uninit
();
dropped
<->
*
ptr
::
mut_offset
(
p
,
next_to_read
);
}
else
{
last_written
+=
1
;
...
...
src/libstd/priority_queue.rs
浏览文件 @
f5ab112e
...
...
@@ -139,7 +139,7 @@ fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
while
pos
>
start
{
let
parent
=
(
pos
-
1
)
>>
1
;
if
new
>
self
.data
[
parent
]
{
let
mut
x
=
rusti
::
init
();
let
mut
x
=
rusti
::
un
init
();
x
<->
self
.data
[
parent
];
rusti
::
move_val_init
(
&
mut
self
.data
[
pos
],
x
);
pos
=
parent
;
...
...
@@ -162,7 +162,7 @@ fn from_vec(xs: ~[T]) -> PriorityQueue<T> {
if
right
<
end
&&
!
(
self
.data
[
child
]
>
self
.data
[
right
])
{
child
=
right
;
}
let
mut
x
=
rusti
::
init
();
let
mut
x
=
rusti
::
un
init
();
x
<->
self
.data
[
child
];
rusti
::
move_val_init
(
&
mut
self
.data
[
pos
],
x
);
pos
=
child
;
...
...
src/libstd/rc.rs
浏览文件 @
f5ab112e
...
...
@@ -51,7 +51,7 @@ fn finalize(&self) {
unsafe
{
(
*
self
.ptr
)
.count
-=
1
;
if
(
*
self
.ptr
)
.count
==
0
{
let
mut
x
=
intrinsics
::
init
();
let
mut
x
=
intrinsics
::
un
init
();
x
<->
*
self
.ptr
;
free
(
self
.ptr
as
*
c_void
)
}
...
...
@@ -159,7 +159,7 @@ fn finalize(&self) {
unsafe
{
(
*
self
.ptr
)
.count
-=
1
;
if
(
*
self
.ptr
)
.count
==
0
{
let
mut
x
=
rusti
::
init
();
let
mut
x
=
rusti
::
un
init
();
x
<->
*
self
.ptr
;
free
(
self
.ptr
as
*
c_void
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录