aboutsummaryrefslogtreecommitdiff
path: root/src/strview.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/strview.h')
-rw-r--r--src/strview.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/strview.h b/src/strview.h
index 1153dcb..d6629ee 100644
--- a/src/strview.h
+++ b/src/strview.h
@@ -8,29 +8,29 @@
#include "types.h"
-struct strview {
+typedef struct {
const uchar *p;
size_t len;
-};
+} strview_t;
/* Expand SV into arguments suitable for a call to printf() */
#define SV_PRI_ARGS(sv) ((int)(sv).len), ((sv).p)
/* Convert the string-literal S into a string-view */
-#define SV(s) ((struct strview){s, sizeof(s) - 1})
+#define SV(s) ((strview_t){s, sizeof(s) - 1})
/* Return the hash of SV */
-uint64_t strview_hash(struct strview sv);
+uint64_t strview_hash(strview_t sv);
/* Copy the contents of SV to DST including a null terminator, and return DST */
-uchar *svtocstr(uchar *dst, struct strview sv)
+uchar *svtocstr(uchar *dst, strview_t sv)
__attribute__((returns_nonnull, nonnull));
/* Return whether or not X and Y are equal */
__attribute__((always_inline))
static inline bool
-strview_eq(struct strview x, struct strview y)
+strview_eq(strview_t x, strview_t y)
{
return x.len == y.len && memcmp(x.p, y.p, x.len) == 0;
}