From 3064fff95b89b296abd8a91c228722fd7361c565 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 15 Dec 2020 09:11:17 +0200 Subject: [PATCH] vlib: prepare modules `hash` and `term` for -Wimpure-v --- vlib/hash/wyhash.c.v | 11 +++++++++++ vlib/hash/wyhash.v | 10 ---------- vlib/term/term.v | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) create mode 100644 vlib/hash/wyhash.c.v diff --git a/vlib/hash/wyhash.c.v b/vlib/hash/wyhash.c.v new file mode 100644 index 0000000000..63525688fb --- /dev/null +++ b/vlib/hash/wyhash.c.v @@ -0,0 +1,11 @@ +module hash + +//#flag -I @VROOT/thirdparty/wyhash +//#include "wyhash.h" +fn C.wyhash(byteptr, u64, u64) u64 + +[inline] +pub fn wyhash_c(key byteptr, len u64, seed u64) u64 { + return C.wyhash(key, len, seed) +} + diff --git a/vlib/hash/wyhash.v b/vlib/hash/wyhash.v index f61ff4f522..df13a70cc6 100644 --- a/vlib/hash/wyhash.v +++ b/vlib/hash/wyhash.v @@ -15,11 +15,6 @@ // try running with and without the `-prod` flag module hash -//#flag -I @VROOT/thirdparty/wyhash -//#include "wyhash.h" -fn C.wyhash(byteptr, u64, u64) u64 - - const ( wyp0 = u64(0xa0761d6478bd642f) wyp1 = u64(0xe7037ed1a0b428db) @@ -28,11 +23,6 @@ const ( wyp4 = u64(0x1d8e4e27c47d124f) ) -[inline] -pub fn wyhash_c(key byteptr, len u64, seed u64) u64 { - return C.wyhash(key, len, seed) -} - [inline] pub fn sum64_string(key string, seed u64) u64 { return wyhash64(key.str, u64(key.len), seed) diff --git a/vlib/term/term.v b/vlib/term/term.v index 86b5195aef..173bb44b48 100644 --- a/vlib/term/term.v +++ b/vlib/term/term.v @@ -117,7 +117,7 @@ fn supports_escape_sequences(fd int) bool { // clear clears current terminal screen. pub fn clear() { $if !windows { - C.printf('\x1b[2J') - C.printf('\x1b[H') + print('\x1b[2J') + print('\x1b[H') } }