summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2023-01-04 23:10:21 +0100
committerTyge Lovset <[email protected]>2023-01-04 23:10:21 +0100
commit86c9f85d6c76084009f274977525163a47360885 (patch)
tree80f2246a0b31003215a3ce2c0a86c5ffd2995029
parentf89ba241b30a9335a8354c435c377cfcf9841de2 (diff)
downloadSTC-modified-86c9f85d6c76084009f274977525163a47360885.tar.gz
STC-modified-86c9f85d6c76084009f274977525163a47360885.zip
Renamed (half)-internal c_strlen_lit() to crawstr_len().
-rw-r--r--include/stc/ccommon.h4
-rw-r--r--include/stc/cstr.h4
-rw-r--r--include/stc/priv/lowcase.h2
-rw-r--r--misc/archived/cstr.h2
4 files changed, 6 insertions, 6 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 90abb186..220b0037 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -115,10 +115,10 @@
typedef const char* crawstr;
#define crawstr_cmp(xp, yp) strcmp(*(xp), *(yp))
#define crawstr_hash(p) cstrhash(*(p))
+#define crawstr_len(literal) (sizeof("" literal) - 1U)
-#define c_strlen_lit(literal) (sizeof("" literal) - 1U)
#define c_SV(...) c_MACRO_OVERLOAD(c_SV, __VA_ARGS__)
-#define c_SV1(lit) c_SV2(lit, c_strlen_lit(lit))
+#define c_SV1(lit) c_SV2(lit, crawstr_len(lit))
#define c_SV2(str, n) (c_INIT(csview){str, n})
#define c_ARGSV(sv) (int)(sv).size, (sv).str /* use with "%.*s" */
#define c_PAIR(ref) (ref)->first, (ref)->second
diff --git a/include/stc/cstr.h b/include/stc/cstr.h
index 35da62c9..46ad2fcd 100644
--- a/include/stc/cstr.h
+++ b/include/stc/cstr.h
@@ -70,11 +70,9 @@ STC_API char* _cstr_internal_move(cstr* self, size_t pos1, size_t pos2);
/**************************** PUBLIC API **********************************/
-#define cstr_lit(literal) cstr_from_n(literal, c_strlen_lit(literal))
+#define cstr_lit(literal) cstr_from_n(literal, crawstr_len(literal))
#define cstr_NULL (c_INIT(cstr){{{0}, 0}})
#define cstr_toraw(self) cstr_str(self)
-#define cstr_new(lit) cstr_lit(lit) /* [deprecated] */
-#define cstr_null cstr_NULL /* [deprecated] */
STC_API char* cstr_reserve(cstr* self, size_t cap);
STC_API void cstr_shrink_to_fit(cstr* self);
diff --git a/include/stc/priv/lowcase.h b/include/stc/priv/lowcase.h
index 8b37fa23..8fdadd75 100644
--- a/include/stc/priv/lowcase.h
+++ b/include/stc/priv/lowcase.h
@@ -54,3 +54,5 @@
#define c_flt_skip c_FLT_SKIP
#define c_flt_skipwhile c_FLT_SKIPWHILE
#define c_flt_takewhile c_FLT_TAKEWHILE
+#define cstr_new(lit) cstr_lit(lit)
+#define cstr_null cstr_NULL
diff --git a/misc/archived/cstr.h b/misc/archived/cstr.h
index 9c94966b..e074b6e4 100644
--- a/misc/archived/cstr.h
+++ b/misc/archived/cstr.h
@@ -69,7 +69,7 @@ STC_INLINE const char* cstr_str(const cstr* self) { return self->str; }
STC_INLINE csview cstr_sv(const cstr* self)
{ return c_INIT(csview){self->str, _cstr_p(self)->size}; }
#define cstr_lit(literal) \
- cstr_from_n(literal, c_strlen_lit(literal))
+ cstr_from_n(literal, crawstr_len(literal))
STC_INLINE cstr cstr_from(const char* str)
{ return cstr_from_n(str, strlen(str)); }
STC_INLINE char* cstr_data(cstr* self) { return self->str; }