1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

replace *Foo with &Foo everywhere

This commit is contained in:
Alexander Medvednikov
2019-09-01 22:51:16 +03:00
parent aaab24dcf8
commit 0e2c41e0f9
12 changed files with 52 additions and 50 deletions

View File

@@ -260,7 +260,7 @@ pub fn copy(dst, src []byte) int {
return 0
}
fn compare_ints(a, b *int) int {
fn compare_ints(a, b &int) int {
if a < b {
return -1
}

View File

@@ -8,14 +8,14 @@ import strings
struct map {
element_size int
root *mapnode
root &mapnode
pub:
size int
}
struct mapnode {
left *mapnode
right *mapnode
left &mapnode
right &mapnode
is_empty bool
key string
val voidptr
@@ -30,7 +30,7 @@ fn new_map(cap, elm_size int) map {
}
// `m := { 'one': 1, 'two': 2 }`
fn new_map_init(cap, elm_size int, keys *string, vals voidptr) map {
fn new_map_init(cap, elm_size int, keys &string, vals voidptr) map {
mut res := map {
element_size: elm_size
root: 0
@@ -41,7 +41,7 @@ fn new_map_init(cap, elm_size int, keys *string, vals voidptr) map {
return res
}
fn new_node(key string, val voidptr, element_size int) *mapnode {
fn new_node(key string, val voidptr, element_size int) &mapnode {
new_e := &mapnode {
key: key
val: malloc(element_size)

View File

@@ -639,7 +639,7 @@ pub fn (s string) trim_right(cutset string) string {
// fn print_cur_thread() {
// //C.printf("tid = %08x \n", pthread_self());
// }
fn compare_strings(a, b *string) int {
fn compare_strings(a, b &string) int {
if a.lt(b) {
return -1
}
@@ -649,7 +649,7 @@ fn compare_strings(a, b *string) int {
return 0
}
fn compare_strings_by_len(a, b *string) int {
fn compare_strings_by_len(a, b &string) int {
if a.len < b.len {
return -1
}
@@ -659,7 +659,7 @@ fn compare_strings_by_len(a, b *string) int {
return 0
}
fn compare_lower_strings(a, b *string) int {
fn compare_lower_strings(a, b &string) int {
aa := a.to_lower()
bb := b.to_lower()
return compare_strings(aa, bb)