mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: x.vstring() instead of string(x) (#6102)
This commit is contained in:
@ -2,7 +2,7 @@ module mysql
|
||||
|
||||
// get_error_msg returns error message from MySQL instance.
|
||||
fn get_error_msg(conn &C.MYSQL) string {
|
||||
return string(C.mysql_error(conn))
|
||||
return unsafe { C.mysql_error(conn).vstring() }
|
||||
}
|
||||
|
||||
// get_errno returns error number from MySQL instance.
|
||||
@ -13,5 +13,12 @@ fn get_errno(conn &C.MYSQL) int {
|
||||
// resolve_nil_str returns empty string if passed value is a nil pointer.
|
||||
fn resolve_nil_str(ptr byteptr) string {
|
||||
if isnil(ptr) { return '' }
|
||||
return string(ptr)
|
||||
return unsafe { ptr.vstring() }
|
||||
}
|
||||
|
||||
[inline]
|
||||
fn mystring(b byteptr) string {
|
||||
unsafe {
|
||||
return b.vstring()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user