Propagating unsafe::slice 2
This commit is contained in:
parent
47c57a17dc
commit
6156bc56cb
@ -562,7 +562,7 @@ fn mangle_internal_name_by_seq(ccx: @crate_ctxt, flav: str) -> str {
|
||||
fn link_binary(sess: session,
|
||||
obj_filename: str,
|
||||
out_filename: str,
|
||||
lm: link_meta) {
|
||||
lm: link_meta) unsafe {
|
||||
// Converts a library file name into a gcc -l argument
|
||||
fn unlib(config: @session::config, filename: str) -> str {
|
||||
let rmlib = fn@(filename: str) -> str {
|
||||
@ -570,7 +570,7 @@ fn link_binary(sess: session,
|
||||
(config.os == session::os_linux ||
|
||||
config.os == session::os_freebsd) &&
|
||||
str::find(filename, "lib") == 0 {
|
||||
ret str::slice(filename, 3u,
|
||||
ret str::unsafe::slice(filename, 3u,
|
||||
str::byte_len(filename));
|
||||
} else { ret filename; }
|
||||
};
|
||||
|
@ -157,7 +157,7 @@ fn cached_metadata<T: copy>(cache: metadata_cache, mdtag: int,
|
||||
}
|
||||
|
||||
fn create_compile_unit(cx: @crate_ctxt, full_path: str)
|
||||
-> @metadata<compile_unit_md> {
|
||||
-> @metadata<compile_unit_md> unsafe {
|
||||
let cache = get_cache(cx);
|
||||
let tg = CompileUnitTag;
|
||||
alt cached_metadata::<@metadata<compile_unit_md>>(cache, tg,
|
||||
@ -168,7 +168,7 @@ fn create_compile_unit(cx: @crate_ctxt, full_path: str)
|
||||
|
||||
let work_dir = cx.sess.working_dir;
|
||||
let file_path = if str::starts_with(full_path, work_dir) {
|
||||
str::slice(full_path, str::byte_len(work_dir),
|
||||
str::unsafe::slice(full_path, str::byte_len(work_dir),
|
||||
str::byte_len(full_path))
|
||||
} else {
|
||||
full_path
|
||||
|
@ -24,10 +24,10 @@ type reader = @{
|
||||
|
||||
impl reader for reader {
|
||||
fn is_eof() -> bool { self.curr == -1 as char }
|
||||
fn get_str_from(start: uint) -> str {
|
||||
fn get_str_from(start: uint) -> str unsafe {
|
||||
// I'm pretty skeptical about this subtraction. What if there's a
|
||||
// multi-byte character before the mark?
|
||||
ret str::slice(*self.src, start - 1u, self.pos - 1u);
|
||||
ret str::unsafe::slice(*self.src, start - 1u, self.pos - 1u);
|
||||
}
|
||||
fn next() -> char {
|
||||
if self.pos < self.len {
|
||||
@ -579,11 +579,11 @@ fn all_whitespace(s: str, begin: uint, end: uint) -> bool {
|
||||
ret true;
|
||||
}
|
||||
|
||||
fn trim_whitespace_prefix_and_push_line(&lines: [str], s: str, col: uint) {
|
||||
fn trim_whitespace_prefix_and_push_line(&lines: [str], s: str, col: uint) unsafe {
|
||||
let s1;
|
||||
if all_whitespace(s, 0u, col) {
|
||||
if col < str::byte_len(s) {
|
||||
s1 = str::slice(s, col, str::byte_len(s));
|
||||
s1 = str::unsafe::slice(s, col, str::byte_len(s));
|
||||
} else { s1 = ""; }
|
||||
} else { s1 = s; }
|
||||
log(debug, "pushing line: " + s1);
|
||||
|
@ -63,7 +63,7 @@ path separators in the path then the returned path is identical to
|
||||
the provided path. If an empty path is provided or the path ends
|
||||
with a path separator then an empty path is returned.
|
||||
*/
|
||||
fn basename(p: path) -> path {
|
||||
fn basename(p: path) -> path unsafe {
|
||||
let i: int = str::rindex(p, os_fs::path_sep as u8);
|
||||
if i == -1 {
|
||||
i = str::rindex(p, os_fs::alt_path_sep as u8);
|
||||
@ -71,7 +71,7 @@ fn basename(p: path) -> path {
|
||||
}
|
||||
let len = str::byte_len(p);
|
||||
if i + 1 as uint >= len { ret p; }
|
||||
ret str::slice(p, i + 1 as uint, len);
|
||||
ret str::unsafe::slice(p, i + 1 as uint, len);
|
||||
}
|
||||
|
||||
|
||||
|
@ -209,7 +209,7 @@ ok(match) - On success. Use functions such as <opt_present>
|
||||
<opt_str>, etc. to interrogate results.
|
||||
err(fail_) - On failure. Use <fail_str> to get an error message.
|
||||
*/
|
||||
fn getopts(args: [str], opts: [opt]) -> result {
|
||||
fn getopts(args: [str], opts: [opt]) -> result unsafe {
|
||||
let n_opts = vec::len::<opt>(opts);
|
||||
fn f(_x: uint) -> [optval] { ret []; }
|
||||
let vals = vec::init_fn_mut::<[optval]>(n_opts, f);
|
||||
@ -229,14 +229,14 @@ fn getopts(args: [str], opts: [opt]) -> result {
|
||||
let names;
|
||||
let i_arg = option::none::<str>;
|
||||
if cur[1] == '-' as u8 {
|
||||
let tail = str::slice(cur, 2u, curlen);
|
||||
let tail = str::unsafe::slice(cur, 2u, curlen);
|
||||
let eq = str::index(tail, '=' as u8);
|
||||
if eq == -1 {
|
||||
names = [long(tail)];
|
||||
} else {
|
||||
names = [long(str::slice(tail, 0u, eq as uint))];
|
||||
names = [long(str::unsafe::slice(tail, 0u, eq as uint))];
|
||||
i_arg =
|
||||
option::some::<str>(str::slice(tail,
|
||||
option::some::<str>(str::unsafe::slice(tail,
|
||||
(eq as uint) + 1u,
|
||||
curlen - 2u));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user