mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
make function arguments immutable
This commit is contained in:
@@ -642,14 +642,14 @@ pub fn (s string) ustring_tmp() ustring {
|
||||
}
|
||||
|
||||
fn (u ustring) substr(start, end int) string {
|
||||
start = u.runes[start]
|
||||
if end >= u.runes.len {
|
||||
end = u.s.len
|
||||
_start := u.runes[start]
|
||||
_end := if end >= u.runes.len {
|
||||
u.s.len
|
||||
}
|
||||
else {
|
||||
end = u.runes[end]
|
||||
u.runes[end]
|
||||
}
|
||||
return u.s.substr(start, end)
|
||||
return u.s.substr(_start, _end)
|
||||
}
|
||||
|
||||
fn (u ustring) left(pos int) string {
|
||||
|
@@ -262,8 +262,8 @@ fn popen(path string) *FILE {
|
||||
}
|
||||
|
||||
// exec starts the specified command, waits for it to complete, and returns its output.
|
||||
pub fn exec(cmd string) string {
|
||||
cmd = '$cmd 2>&1'
|
||||
pub fn exec(_cmd string) string {
|
||||
cmd := '$_cmd 2>&1'
|
||||
f := popen(cmd)
|
||||
if isnil(f) {
|
||||
// TODO optional or error code
|
||||
@@ -331,8 +331,8 @@ pub fn dir_exists(path string) bool {
|
||||
// mkdir creates a new directory with the specified path.
|
||||
pub fn mkdir(path string) {
|
||||
$if windows {
|
||||
path = path.replace('/', '\\')
|
||||
C.CreateDirectory(path.cstr(), 0)
|
||||
_path := path.replace('/', '\\')
|
||||
C.CreateDirectory(_path.cstr(), 0)
|
||||
}
|
||||
$else {
|
||||
C.mkdir(path.cstr(), 511)// S_IRWXU | S_IRWXG | S_IRWXO
|
||||
|
@@ -33,7 +33,7 @@ pub fn (b Builder) str() string {
|
||||
return tos(b.buf.data, b.len)
|
||||
}
|
||||
|
||||
pub fn (b Builder) cut(n int) {
|
||||
pub fn (b mut Builder) cut(n int) {
|
||||
b.len -= n
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user