From c96a2a64fc2f0d27a14e80c1cca4bb3fa0a2aaa0 Mon Sep 17 00:00:00 2001 From: rvalue Date: Wed, 2 Aug 2023 16:38:00 +0200 Subject: [PATCH] libcaption: Optimize branch conditons The optimization silences the warning about type limits on platforms with `char` type as `unsigned char`. The original condition is semantically identical to the optimized one because the signed-to-unsigned cast is well-defined in C standard. --- deps/libcaption/src/utf8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deps/libcaption/src/utf8.c b/deps/libcaption/src/utf8.c index 41c6de49b..fa3191fb6 100644 --- a/deps/libcaption/src/utf8.c +++ b/deps/libcaption/src/utf8.c @@ -51,7 +51,7 @@ size_t utf8_char_length(const utf8_char_t* c) int utf8_char_whitespace(const utf8_char_t* c) { // 0x7F is DEL - if (!c || (c[0] >= 0 && c[0] <= ' ') || c[0] == 0x7F) { + if (!c || (unsigned char)c[0] <= ' ' || c[0] == 0x7F) { return 1; }