From 287e07ebaa5fbcf9be0ce0cb1981798fc04bc9f1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 27 Sep 2024 13:06:20 -0400 Subject: Make function parameters const wherever possible The early history of this code didn't tend to make parameters const, but the "const density" is high enough now that I often find myself wondering if something is mutable for some reason, or just old and sloppier. So, eliminate this confusion by making (hopefully) all function parameters const if possible. --- src/uri.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/uri.c') diff --git a/src/uri.c b/src/uri.c index 9856ce45..189ee2b7 100644 --- a/src/uri.c +++ b/src/uri.c @@ -15,7 +15,7 @@ #include const uint8_t* -serd_uri_to_path(const uint8_t* uri) +serd_uri_to_path(const uint8_t* const uri) { assert(uri); @@ -344,7 +344,7 @@ serd_uri_resolve(const SerdURI* const r, /** Write the path of `uri` starting at index `i` */ static size_t -write_path_tail(SerdSink sink, +write_path_tail(const SerdSink sink, void* const stream, const SerdURI* const uri, const size_t i) @@ -372,7 +372,7 @@ write_path_tail(SerdSink sink, /** Write the path of `uri` relative to the path of `base`. */ static size_t -write_rel_path(SerdSink sink, +write_rel_path(const SerdSink sink, void* const stream, const SerdURI* const uri, const SerdURI* const base) @@ -413,7 +413,7 @@ write_rel_path(SerdSink sink, } static uint8_t -serd_uri_path_starts_without_slash(const SerdURI* uri) +serd_uri_path_starts_without_slash(const SerdURI* const uri) { return ((uri->path_base.len || uri->path.len) && ((!uri->path_base.len || uri->path_base.buf[0] != '/') && @@ -425,7 +425,7 @@ size_t serd_uri_serialise_relative(const SerdURI* const uri, const SerdURI* const base, const SerdURI* const root, - SerdSink sink, + const SerdSink sink, void* const stream) { assert(uri); @@ -481,7 +481,9 @@ serd_uri_serialise_relative(const SerdURI* const uri, /// See http://tools.ietf.org/html/rfc3986#section-5.3 size_t -serd_uri_serialise(const SerdURI* const uri, SerdSink sink, void* const stream) +serd_uri_serialise(const SerdURI* const uri, + const SerdSink sink, + void* const stream) { assert(uri); assert(sink); -- cgit v1.2.1