diff options
| author | tylov <[email protected]> | 2023-08-14 09:42:35 +0200 |
|---|---|---|
| committer | tylov <[email protected]> | 2023-08-14 09:42:35 +0200 |
| commit | fb5863de1d6ea8a5be8371e57bcd58bf31798a0a (patch) | |
| tree | e2bc5d08051fd275e697472f6e5a70dd6ab6cb64 /include/stc/csview.h | |
| parent | 25dc58db206714dc02c1ae0548f6ba7dd3519d29 (diff) | |
| download | STC-modified-fb5863de1d6ea8a5be8371e57bcd58bf31798a0a.tar.gz STC-modified-fb5863de1d6ea8a5be8371e57bcd58bf31798a0a.zip | |
Finished last commit (cleanup, fixes).
Diffstat (limited to 'include/stc/csview.h')
| -rw-r--r-- | include/stc/csview.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/include/stc/csview.h b/include/stc/csview.h index 0d1ca36c..367258e4 100644 --- a/include/stc/csview.h +++ b/include/stc/csview.h @@ -26,13 +26,12 @@ #ifndef CSVIEW_H_INCLUDED #define CSVIEW_H_INCLUDED -#define csview_init() c_sv_1("") +#define csview_init() c_sv("") #define csview_drop(p) c_default_drop(p) #define csview_clone(sv) c_default_clone(sv) -#define csview_from_n(str, n) c_sv_2(str, n) STC_INLINE csview csview_from(const char* str) - { return csview_from_n(str, c_strlen(str)); } + { return c_sv_2(str, c_strlen(str)); } STC_INLINE void csview_clear(csview* self) { *self = csview_init(); } STC_INLINE csubstr csview_ss(csview sv) { return c_ss_2(sv.str, sv.size); } @@ -44,14 +43,11 @@ STC_INLINE bool csview_equals(csview sv, const char* str) { return sv.size == n && !c_memcmp(sv.str, str, n); } -STC_INLINE intptr_t csview_find_v(csview sv, csview search) { - char* res = cstrnstrn(sv.str, search.str, sv.size, search.size); +STC_INLINE intptr_t csview_find(csview sv, const char* search) { + char* res = cstrnstrn(sv.str, search, sv.size, c_strlen(search)); return res ? (res - sv.str) : c_NPOS; } -STC_INLINE intptr_t csview_find(csview sv, const char* str) - { return csview_find_v(sv, c_sv_2(str, c_strlen(str))); } - STC_INLINE bool csview_contains(csview sv, const char* str) { return csview_find(sv, str) != c_NPOS; } |
