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

checker: warn if C.m* or C.s* functions are called outside unsafe blocks (#5869)

This commit is contained in:
Nick Treleaven
2020-07-20 18:06:41 +01:00
committed by GitHub
parent 1a5236e53d
commit a74cbf55c7
23 changed files with 175 additions and 88 deletions

View File

@@ -27,7 +27,9 @@ pub const (
pub fn vhash() string {
mut buf := [50]byte
buf[0] = 0
C.snprintf(charptr(buf), 50, '%s', C.V_COMMIT_HASH)
unsafe {
C.snprintf(charptr(buf), 50, '%s', C.V_COMMIT_HASH)
}
return tos_clone(buf)
}
@@ -97,7 +99,9 @@ pub fn githash(should_get_from_filesystem bool) string {
}
mut buf := [50]byte
buf[0] = 0
C.snprintf(charptr(buf), 50, '%s', C.V_CURRENT_COMMIT_HASH)
unsafe {
C.snprintf(charptr(buf), 50, '%s', C.V_CURRENT_COMMIT_HASH)
}
return tos_clone(buf)
}