1
Fork 0

core: marked fns as pure where possible

This commit is contained in:
Stefan Plantikow 2011-12-16 17:38:49 +01:00
parent 1fe4bd0f43
commit bfbaadc694
7 changed files with 14 additions and 14 deletions

View file

@ -26,14 +26,14 @@ Function: eq
Bytewise string equality
*/
fn eq(&&a: str, &&b: str) -> bool { a == b }
pure fn eq(&&a: str, &&b: str) -> bool { a == b }
/*
Function: lteq
Bytewise less than or equal
*/
fn lteq(&&a: str, &&b: str) -> bool { a <= b }
pure fn lteq(&&a: str, &&b: str) -> bool { a <= b }
/*
Function: hash
@ -131,7 +131,7 @@ Function: byte_len
Returns the length in bytes of a string
*/
fn byte_len(s: str) -> uint unsafe {
pure fn byte_len(s: str) -> uint unsafe {
let v: [u8] = unsafe::reinterpret_cast(s);
let vlen = vec::len(v);
unsafe::leak(v);
@ -261,7 +261,7 @@ Function: utf8_char_width
FIXME: What does this function do?
*/
fn utf8_char_width(b: u8) -> uint {
pure fn utf8_char_width(b: u8) -> uint {
let byte: uint = b as uint;
if byte < 128u { ret 1u; }
if byte < 192u {