diff options
| author | Tyge Løvset <[email protected]> | 2021-06-01 20:46:21 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2021-06-01 20:46:21 +0200 |
| commit | 2a16fea92194890a6b786ca030266f267db029cf (patch) | |
| tree | e0a7daa75f3e45f95e700bfa9e3836037906f0e9 /include | |
| parent | 18de7e809d470c84fec9c420133e3a5a036a4239 (diff) | |
| parent | a476565257b68af526998d4ffd1b7e77bfe4ea96 (diff) | |
| download | STC-modified-2a16fea92194890a6b786ca030266f267db029cf.tar.gz STC-modified-2a16fea92194890a6b786ca030266f267db029cf.zip | |
Merge branch 'master' of https://github.com/tylo-work/C99Containers into master
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/csview.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/stc/csview.h b/include/stc/csview.h index 4a8f704b..4a9d1dff 100644 --- a/include/stc/csview.h +++ b/include/stc/csview.h @@ -29,6 +29,7 @@ typedef struct { const char* str; size_t size; } csview; typedef struct { const char *ref; } csview_iter_t;
typedef char csview_value_t;
#define csview_null c_make(csview){"", 0}
+#define csview_npos cstr_npos
#define csview_ARG(sv) (int)(sv).size, (sv).str
#define c_lit(literal) csview_lit(literal)
@@ -45,9 +46,10 @@ STC_INLINE csview csview_from_s(cstr s) STC_INLINE size_t csview_size(csview sv) { return sv.size; }
STC_INLINE size_t csview_length(csview sv) { return sv.size; }
STC_INLINE bool csview_empty(csview sv) { return sv.size == 0; }
+STC_INLINE char csview_front(csview sv) { return sv.str[0]; }
+STC_INLINE char csview_back(csview sv) { return sv.str[sv.size - 1]; }
+
STC_INLINE void csview_clear(csview* self) { *self = csview_null; }
-STC_INLINE const char* csview_front(const csview* self) { return self->str; }
-STC_INLINE const char* csview_back(const csview* self) { return self->str + self->size - 1; }
#define csview_hash(sv) c_default_hash((sv).str, (sv).size)
STC_INLINE bool csview_equals(csview sv, csview sv2)
|
