diff options
author | David Robillard <d@drobilla.net> | 2021-05-29 17:12:02 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-05-31 11:37:53 -0400 |
commit | 9aa0c922b503f9b1f7f22add0afe19638bba7e9b (patch) | |
tree | 73e639bee2fd1cb9d06a1bd5770803ecf6ca5e7e /src/string.c | |
parent | 624accde94a105213dc3562606c638d9620e7a72 (diff) | |
download | serd-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/string.c')
-rw-r--r-- | src/string.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/string.c b/src/string.c index baf01042..6e7cecf2 100644 --- a/src/string.c +++ b/src/string.c @@ -23,13 +23,13 @@ #include <stdlib.h> void -serd_free(void* ptr) +serd_free(void* const ptr) { free(ptr); } const uint8_t* -serd_strerror(SerdStatus status) +serd_strerror(const SerdStatus status) { switch (status) { case SERD_SUCCESS: @@ -95,7 +95,9 @@ serd_substrlen(const uint8_t* const str, } size_t -serd_strlen(const uint8_t* str, size_t* n_bytes, SerdNodeFlags* flags) +serd_strlen(const uint8_t* const str, + size_t* const n_bytes, + SerdNodeFlags* const flags) { size_t n_chars = 0; size_t i = 0; @@ -116,7 +118,7 @@ serd_strlen(const uint8_t* str, size_t* n_bytes, SerdNodeFlags* flags) } static double -read_sign(const char** sptr) +read_sign(const char** const sptr) { double sign = 1.0; @@ -136,7 +138,7 @@ read_sign(const char** sptr) } double -serd_strtod(const char* str, char** endptr) +serd_strtod(const char* const str, char** const endptr) { double result = 0.0; |