summaryrefslogtreecommitdiff
path: root/include/lib/sv.h
blob: f5169d099448b87a6e37647a5d708d01585a3471 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#ifndef SV_H
#define SV_H

#include <stddef.h>

struct string_view {
   char *buf;
   size_t len;
};

struct string_view sv_create(char *buf, size_t len);
struct string_view sv_copy(struct string_view *sv);
int sv_equal(struct string_view *a, struct string_view *b);

#define SV(x) (struct string_view){(x), sizeof(x) - 1}

#endif