diff options
| author | Tyge Løvset <[email protected]> | 2022-06-27 22:58:17 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-06-27 22:58:17 +0200 |
| commit | 6e91820d7cf632ff30b936c554a0bdf83c9e64b2 (patch) | |
| tree | ba647d0c920a3e0ab7cd21058e6824f6b1cc6393 /include | |
| parent | 161622453ad44a29dc52f496c2d721d41255e45f (diff) | |
| download | STC-modified-6e91820d7cf632ff30b936c554a0bdf83c9e64b2.tar.gz STC-modified-6e91820d7cf632ff30b936c554a0bdf83c9e64b2.zip | |
Fixed bug in csmap.h: begin() on empty map not inited correctly. Moved cstr_from_sv() from csview.h to cstr.h
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/csmap.h | 1 | ||||
| -rw-r--r-- | include/stc/cstr.h | 3 | ||||
| -rw-r--r-- | include/stc/csview.h | 3 |
3 files changed, 4 insertions, 3 deletions
diff --git a/include/stc/csmap.h b/include/stc/csmap.h index a463d381..5af28830 100644 --- a/include/stc/csmap.h +++ b/include/stc/csmap.h @@ -200,6 +200,7 @@ _cx_memb(_shrink_to_fit)(_cx_self *self) { STC_INLINE _cx_iter _cx_memb(_begin)(const _cx_self* self) { _cx_iter it; + it.ref = NULL; it._d = self->nodes, it._top = 0; it._tn = (i_size) _csmap_rep(self)->root; if (it._tn) diff --git a/include/stc/cstr.h b/include/stc/cstr.h index 00912576..ed533064 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -111,6 +111,9 @@ STC_INLINE cstr cstr_from_n(const char* str, const size_t len) { STC_INLINE cstr cstr_from(const char* str) { return cstr_from_n(str, strlen(str)); } +STC_INLINE cstr cstr_from_sv(csview sv) + { return cstr_from_n(sv.str, sv.size); } + STC_INLINE cstr cstr_with_size(const size_t size, const char value) { cstr s; memset(_cstr_init(&s, size, size), value, size); diff --git a/include/stc/csview.h b/include/stc/csview.h index 31a3ccba..e74ce844 100644 --- a/include/stc/csview.h +++ b/include/stc/csview.h @@ -108,9 +108,6 @@ STC_INLINE bool csview_valid_utf8(csview sv) // depends on src/utf8code.c STC_INLINE csview csview_from_s(const cstr* self) { return c_make(csview){cstr_str(self), cstr_size(*self)}; } -STC_INLINE cstr cstr_from_sv(csview sv) - { return cstr_from_n(sv.str, sv.size); } - STC_INLINE csview cstr_substr(const cstr* self, size_t pos, size_t n) { return csview_substr(csview_from_s(self), pos, n); } |
