aboutsummaryrefslogtreecommitdiff
path: root/src/strview.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/strview.c')
-rw-r--r--src/strview.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/strview.c b/src/strview.c
index f9b80e4..70e78f0 100644
--- a/src/strview.c
+++ b/src/strview.c
@@ -1,13 +1,14 @@
#include <string.h>
+#include "common.h"
#include "strview.h"
#include "types.h"
uint64_t
-strview_hash(struct strview sv)
+strview_hash(strview_t sv)
{
uint64_t h = 0x100;
- for (size_t i = 0; i < sv.len; i++) {
+ for (size_t i = 0; likely(i < sv.len); i++) {
h ^= sv.p[i];
h *= 1111111111111111111u;
}
@@ -15,9 +16,8 @@ strview_hash(struct strview sv)
}
uchar *
-svtocstr(uchar *dst, struct strview src)
+svtocstr(uchar *dst, strview_t src)
{
- memcpy(dst, src.p, src.len);
- dst[src.len] = 0;
+ ((uchar *)memcpy(dst, src.p, src.len))[src.len] = 0;
return dst;
}