aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-01-09 21:09:56 -0500
committerDavid Robillard <d@drobilla.net>2024-01-09 21:09:56 -0500
commit117ae267046ed564684793270b82767c585c724b (patch)
tree59e2a5cb98ad4a86fd7f364597c33bbcbd0e48cd /src/uri.c
parentdf88c11fcaa3e478873ab31ebe0e5e9b13a57208 (diff)
downloadserd-117ae267046ed564684793270b82767c585c724b.tar.gz
serd-117ae267046ed564684793270b82767c585c724b.tar.bz2
serd-117ae267046ed564684793270b82767c585c724b.zip
Avoid regressions in clang nullability checks
Clang 15 (and still as of 16) lost the ability to understand null checks in conditionals, which is supposed to suppress these warnings. For now, work around some, and suppress others. The suppression boilerplate here is noisy and ugly, and hopefully temporary. It should be removed once the issue is fixed in clang. See https://github.com/llvm/llvm-project/issues/63018
Diffstat (limited to 'src/uri.c')
-rw-r--r--src/uri.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/uri.c b/src/uri.c
index b45f7e16..897d0462 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -3,6 +3,7 @@
#include "string_utils.h"
#include "uri_utils.h"
+#include "warnings.h"
#include "serd/serd.h"
@@ -336,6 +337,8 @@ write_path_tail(SerdSink sink,
const SerdURI* const uri,
const size_t i)
{
+ SERD_DISABLE_NULL_WARNINGS
+
size_t len = 0;
if (i < uri->path_base.len) {
len += sink(uri->path_base.buf + i, uri->path_base.len - i, stream);
@@ -351,6 +354,8 @@ write_path_tail(SerdSink sink,
}
return len;
+
+ SERD_RESTORE_WARNINGS
}
/** Write the path of `uri` relative to the path of `base`. */
@@ -419,6 +424,8 @@ serd_uri_serialise_relative(const SerdURI* const uri,
len = write_rel_path(sink, stream, uri, base);
}
+ SERD_DISABLE_NULL_WARNINGS
+
if (!relative || (!len && base->query.buf)) {
if (uri->scheme.buf) {
len += sink(uri->scheme.buf, uri->scheme.len, stream);
@@ -452,6 +459,8 @@ serd_uri_serialise_relative(const SerdURI* const uri,
len += sink(uri->fragment.buf, uri->fragment.len, stream);
}
+ SERD_RESTORE_WARNINGS
+
return len;
}