mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
string: bring back the is_lit comment
This commit is contained in:
parent
0f9537ece5
commit
6a64259527
@ -45,6 +45,12 @@ pub struct string {
|
|||||||
pub:
|
pub:
|
||||||
str &byte = 0 // points to a C style 0 terminated string of bytes.
|
str &byte = 0 // points to a C style 0 terminated string of bytes.
|
||||||
len int // the length of the .str field, excluding the ending 0 byte. It is always equal to strlen(.str).
|
len int // the length of the .str field, excluding the ending 0 byte. It is always equal to strlen(.str).
|
||||||
|
// NB string.is_lit is an enumeration of the following:
|
||||||
|
// .is_lit == 0 => a fresh string, should be freed by autofree
|
||||||
|
// .is_lit == 1 => a literal string from .rodata, should NOT be freed
|
||||||
|
// .is_lit == -98761234 => already freed string, protects against double frees.
|
||||||
|
// ---------> ^^^^^^^^^ calling free on these is a bug.
|
||||||
|
// Any other value means that the string has been corrupted.
|
||||||
mut:
|
mut:
|
||||||
is_lit int
|
is_lit int
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user