aboutsummaryrefslogtreecommitdiffstats
path: root/src/uri.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-10-02 14:47:14 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:07 -0500
commitaa6b5ec5b9344bce0ea38d294aef0782c3745548 (patch)
tree0481c7a3b690a35728b0649d281e0ba3e321a428 /src/uri.c
parent6076b31090176be685c30aa198edd3cebfd4fd7a (diff)
downloadserd-aa6b5ec5b9344bce0ea38d294aef0782c3745548.tar.gz
serd-aa6b5ec5b9344bce0ea38d294aef0782c3745548.tar.bz2
serd-aa6b5ec5b9344bce0ea38d294aef0782c3745548.zip
Add assertions for all non-null pointers in the public API
Diffstat (limited to 'src/uri.c')
-rw-r--r--src/uri.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/uri.c b/src/uri.c
index aed669c8..bc9d9fad 100644
--- a/src/uri.c
+++ b/src/uri.c
@@ -9,6 +9,7 @@
#include "serd/string_view.h"
#include "serd/uri.h"
+#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
@@ -18,6 +19,8 @@
char*
serd_parse_file_uri(const char* const uri, char** const hostname)
{
+ assert(uri);
+
const char* path = uri;
if (hostname) {
*hostname = NULL;
@@ -71,6 +74,8 @@ serd_parse_file_uri(const char* const uri, char** const hostname)
bool
serd_uri_string_has_scheme(const char* const string)
{
+ assert(string);
+
if (is_alpha(string[0])) {
for (size_t i = 1; string[i]; ++i) {
if (!is_uri_scheme_char(string[i])) {
@@ -89,6 +94,8 @@ serd_uri_string_has_scheme(const char* const string)
SerdURIView
serd_parse_uri(const char* const string)
{
+ assert(string);
+
SerdURIView result = SERD_URI_NULL;
const char* ptr = string;
@@ -440,6 +447,9 @@ serd_write_uri(const SerdURIView uri,
const SerdWriteFunc sink,
void* const stream)
{
+ assert(sink);
+ assert(stream);
+
size_t len = 0;
if (uri.scheme.data) {