From 972aa23a674f743c187e82444c2271aaa3e9cd06 Mon Sep 17 00:00:00 2001 From: tylov Date: Sun, 13 Aug 2023 17:38:10 +0200 Subject: Removed csview_null - use csview_init(). --- include/stc/csview.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/stc/csview.h b/include/stc/csview.h index 85965928..bbf7cd8e 100644 --- a/include/stc/csview.h +++ b/include/stc/csview.h @@ -27,11 +27,9 @@ #ifndef CSVIEW_H_INCLUDED #define CSVIEW_H_INCLUDED -#define csview_null c_sv_1("") -#define csview_init() csview_null +#define csview_init() c_sv_1("") #define csview_drop(p) c_default_drop(p) #define csview_clone(sv) c_default_clone(sv) -#define csview_lit(literal) c_sv_1(literal) #define csview_from_n(str, n) c_sv_2(str, n) STC_API csview_iter csview_advance(csview_iter it, intptr_t pos); @@ -43,7 +41,7 @@ STC_API csview csview_token(csview sv, const char* sep, intptr_t* start); STC_INLINE csview csview_from(const char* str) { return c_LITERAL(csview){str, c_strlen(str)}; } -STC_INLINE void csview_clear(csview* self) { *self = csview_null; } +STC_INLINE void csview_clear(csview* self) { *self = csview_init(); } STC_INLINE intptr_t csview_size(csview sv) { return sv.size; } STC_INLINE bool csview_empty(csview sv) { return sv.size == 0; } @@ -52,7 +50,7 @@ STC_INLINE bool csview_equals(csview sv, const char* str) { intptr_t n = c_strlen(str); return sv.size == n && !c_memcmp(sv.str, str, n); } STC_INLINE intptr_t csview_find(csview sv, const char* str) - { return csview_find_sv(sv, c_sv(str, c_strlen(str))); } + { return csview_find_sv(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; } -- cgit v1.2.3