diff options
| author | Johnny Richard <johnny@johnnyrichard.com> | 2025-04-11 01:15:01 +0200 |
|---|---|---|
| committer | Johnny Richard <johnny@johnnyrichard.com> | 2025-04-14 23:11:22 +0200 |
| commit | e7f69c8fbbbcbddde84933b2becd91e787d1ac63 (patch) | |
| tree | 16cd17da17133494dd06aab614724e76b059d4ad /src/string_view.h | |
Intial commit
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'src/string_view.h')
| -rw-r--r-- | src/string_view.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/string_view.h b/src/string_view.h new file mode 100644 index 0000000..6757689 --- /dev/null +++ b/src/string_view.h @@ -0,0 +1,20 @@ +#ifndef STRING_VIEW_H +#define STRING_VIEW_H +#include <stddef.h> +#include <stdbool.h> + +#define PRIsv "%.*s" +#define PRIsvARG(sv) (int) (sv).size, (sv).chars + +typedef struct string_view { + size_t size; + char *chars; +} string_view_t; + +string_view_t +string_view_from_cstr(char *cstr); + +bool +string_view_eq(string_view_t s1, string_view_t s2); + +#endif /* STRING_VIEW_H */ |
