diff options
author | David Robillard <d@drobilla.net> | 2022-10-02 14:47:14 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 18:49:07 -0500 |
commit | aa6b5ec5b9344bce0ea38d294aef0782c3745548 (patch) | |
tree | 0481c7a3b690a35728b0649d281e0ba3e321a428 /src/syntax.c | |
parent | 6076b31090176be685c30aa198edd3cebfd4fd7a (diff) | |
download | serd-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/syntax.c')
-rw-r--r-- | src/syntax.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/syntax.c b/src/syntax.c index d75865b1..6b95446d 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -5,6 +5,7 @@ #include "serd/syntax.h" +#include <assert.h> #include <stdbool.h> #include <string.h> @@ -25,6 +26,8 @@ static const Syntax syntaxes[] = { SerdSyntax serd_syntax_by_name(const char* const name) { + assert(name); + const size_t len = strlen(name); if (len) { for (const Syntax* s = syntaxes; s->name; ++s) { @@ -33,12 +36,15 @@ serd_syntax_by_name(const char* const name) } } } + return SERD_SYNTAX_EMPTY; } SerdSyntax serd_guess_syntax(const char* const filename) { + assert(filename); + const char* ext = strrchr(filename, '.'); if (ext && ext[1]) { const size_t ext_len = strlen(ext); |