aboutsummaryrefslogtreecommitdiffstats
path: root/src/string.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-06-24 15:01:11 -0400
committerDavid Robillard <d@drobilla.net>2024-06-25 15:54:43 -0400
commit47f30703ee6935de393303b7a4d6bab8ce7780f4 (patch)
tree3f0a8ed8c40bb2970962c5f3c62e17f654d59263 /src/string.c
parent032abfdff61056a7029a440fc1895bbe41ec964a (diff)
downloadserd-47f30703ee6935de393303b7a4d6bab8ce7780f4.tar.gz
serd-47f30703ee6935de393303b7a4d6bab8ce7780f4.tar.bz2
serd-47f30703ee6935de393303b7a4d6bab8ce7780f4.zip
Replace questionable switch statements with shorter conditionals
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/string.c b/src/string.c
index b2946aac..11c12bee 100644
--- a/src/string.c
+++ b/src/string.c
@@ -49,16 +49,10 @@ serd_strerror(const SerdStatus status)
static void
serd_update_flags(const uint8_t c, SerdNodeFlags* const flags)
{
- switch (c) {
- case '\r':
- case '\n':
+ if (c == '\r' || c == '\n') {
*flags |= SERD_HAS_NEWLINE;
- break;
- case '"':
+ } else if (c == '"') {
*flags |= SERD_HAS_QUOTE;
- break;
- default:
- break;
}
}
@@ -116,16 +110,11 @@ read_sign(const char** const sptr)
{
double sign = 1.0;
- switch (**sptr) {
- case '-':
+ if (**sptr == '-') {
sign = -1.0;
++(*sptr);
- break;
- case '+':
+ } else if (**sptr == '+') {
++(*sptr);
- break;
- default:
- break;
}
return sign;