From bfc19665ce998e0b7d6ab4914d2f12a7e951f48e Mon Sep 17 00:00:00 2001 From: Martin Fouilleul Date: Wed, 8 Mar 2023 11:40:40 +0100 Subject: [PATCH] [util] - shorten str8_lit macro to STR8 - use strlen() in STR8 and remove str8_from_cstring(). Usage with string literal seem to always be optimized by compile-time constant, so there's little need for a confusing macro that only works with literals and breaks with pointers. - replaced str8_unbox() with str8_lp/str8_ip --- examples/perf_text/main.c | 4 ++-- examples/test_app/main.c | 6 +++--- examples/ui_style_test/main.c | 10 +++++----- src/osx_app.m | 2 +- src/ui.c | 4 ++-- src/ui.h | 16 ++++++++-------- src/util/strings.c | 14 +------------- src/util/strings.h | 7 ++++--- src/win32_app.c | 6 +++--- 9 files changed, 29 insertions(+), 40 deletions(-) diff --git a/examples/perf_text/main.c b/examples/perf_text/main.c index 6fb7634..9fb886c 100644 --- a/examples/perf_text/main.c +++ b/examples/perf_text/main.c @@ -116,9 +116,9 @@ int main() f32 lineHeight = fontScale*(extents.ascent + extents.descent + extents.leading); - int codePointCount = utf8_codepoint_count_for_string(str8_from_cstring((char*)TEST_STRING)); + int codePointCount = utf8_codepoint_count_for_string(STR8((char*)TEST_STRING)); u32* codePoints = malloc_array(utf32, codePointCount); - utf8_to_codepoints(codePointCount, codePoints, str8_from_cstring((char*)TEST_STRING)); + utf8_to_codepoints(codePointCount, codePoints, STR8((char*)TEST_STRING)); u32 glyphCount = 0; for(int i=0; i