aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_source.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-05-29 17:12:02 -0400
committerDavid Robillard <d@drobilla.net>2021-05-31 11:37:53 -0400
commit9aa0c922b503f9b1f7f22add0afe19638bba7e9b (patch)
tree73e639bee2fd1cb9d06a1bd5770803ecf6ca5e7e /src/byte_source.c
parent624accde94a105213dc3562606c638d9620e7a72 (diff)
downloadserd-9aa0c922b503f9b1f7f22add0afe19638bba7e9b.tar.gz
serd-9aa0c922b503f9b1f7f22add0afe19638bba7e9b.tar.bz2
serd-9aa0c922b503f9b1f7f22add0afe19638bba7e9b.zip
Make most function parameters const
More const never hurts in general, but in particular this allows the compiler to make better nullability deductions, which reduces the amount of manual nullability casting required.
Diffstat (limited to 'src/byte_source.c')
-rw-r--r--src/byte_source.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/byte_source.c b/src/byte_source.c
index 9f7e4e59..4790a4b2 100644
--- a/src/byte_source.c
+++ b/src/byte_source.c
@@ -25,7 +25,7 @@
#include <string.h>
SerdStatus
-serd_byte_source_page(SerdByteSource* source)
+serd_byte_source_page(SerdByteSource* const source)
{
source->read_head = 0;
const size_t n_read =
@@ -47,12 +47,12 @@ serd_byte_source_page(SerdByteSource* source)
}
SerdStatus
-serd_byte_source_open_source(SerdByteSource* source,
- SerdSource read_func,
- SerdStreamErrorFunc error_func,
- void* stream,
- const uint8_t* name,
- size_t page_size)
+serd_byte_source_open_source(SerdByteSource* const source,
+ const SerdSource read_func,
+ const SerdStreamErrorFunc error_func,
+ void* const stream,
+ const uint8_t* const name,
+ const size_t page_size)
{
const Cursor cur = {name, 1, 1};
@@ -77,7 +77,7 @@ serd_byte_source_open_source(SerdByteSource* source,
}
SerdStatus
-serd_byte_source_prepare(SerdByteSource* source)
+serd_byte_source_prepare(SerdByteSource* const source)
{
source->prepared = true;
@@ -90,7 +90,8 @@ serd_byte_source_prepare(SerdByteSource* source)
}
SerdStatus
-serd_byte_source_open_string(SerdByteSource* source, const uint8_t* utf8)
+serd_byte_source_open_string(SerdByteSource* const source,
+ const uint8_t* const utf8)
{
const Cursor cur = {(const uint8_t*)"(string)", 1, 1};
@@ -101,7 +102,7 @@ serd_byte_source_open_string(SerdByteSource* source, const uint8_t* utf8)
}
SerdStatus
-serd_byte_source_close(SerdByteSource* source)
+serd_byte_source_close(SerdByteSource* const source)
{
if (source->page_size > 1) {
serd_free_aligned(source->file_buf);