summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <0x7fffff@guattari.ru>2022-08-15 00:01:06 +0400
committerMitya Selivanov <0x7fffff@guattari.ru>2022-08-15 00:01:06 +0400
commit692f78ed03069a573cd893e191cbbf933289ddc7 (patch)
treefc0ab0ecda9d91a179981677bf53eff2f550d4f2
parent400ea79a6b5aab8ff200bf65fddba88065623903 (diff)
downloadkit-692f78ed03069a573cd893e191cbbf933289ddc7.zip
SZ fix
-rw-r--r--source/kit/string_ref.h2
-rw-r--r--source/test/unittests/string_ref.test.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/source/kit/string_ref.h b/source/kit/string_ref.h
index 8505564..dd82f44 100644
--- a/source/kit/string_ref.h
+++ b/source/kit/string_ref.h
@@ -14,7 +14,7 @@ typedef kit_string_mut_t kit_out_str_t;
typedef kit_string_ref_t kit_str_t;
#define KIT_SZ(name_, static_str_) \
- KIT_AR(name_, char) = { \
+ kit_str_t name_ = { \
.size = (sizeof(static_str_) / sizeof((static_str_)[0])) - 1, \
.values = (static_str_) \
}
diff --git a/source/test/unittests/string_ref.test.c b/source/test/unittests/string_ref.test.c
index b89459e..7c49996 100644
--- a/source/test/unittests/string_ref.test.c
+++ b/source/test/unittests/string_ref.test.c
@@ -15,3 +15,8 @@ TEST("static string wrap") {
REQUIRE(ref.values[5] == 'a');
REQUIRE(ref.values[6] == 'r');
}
+
+TEST("string literal") {
+ SZ(foo, "foo");
+ str_t bar = foo;
+}