diff options
author | David Robillard <d@drobilla.net> | 2024-11-13 11:58:23 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-13 11:59:48 -0500 |
commit | 7f760acfdfa228f090332230f119072fb95c1aa4 (patch) | |
tree | 84f9e52440543478b54a51f4c47b5badcb94d47f | |
parent | 35e76431e5bdf24b67dc0b9a3f78367adb36b15c (diff) | |
download | sord-7f760acfdfa228f090332230f119072fb95c1aa4.tar.gz sord-7f760acfdfa228f090332230f119072fb95c1aa4.tar.bz2 sord-7f760acfdfa228f090332230f119072fb95c1aa4.zip |
Initialize all variables
-rw-r--r-- | .clang-tidy | 1 | ||||
-rw-r--r-- | src/sord.c | 6 | ||||
-rw-r--r-- | test/test_sord.c | 10 |
3 files changed, 8 insertions, 9 deletions
diff --git a/.clang-tidy b/.clang-tidy index b281245..a5f38ad 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -35,7 +35,6 @@ Checks: > -clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling, -clang-analyzer-valist.Uninitialized, -cppcoreguidelines-avoid-non-const-global-variables, - -cppcoreguidelines-init-variables, -cppcoreguidelines-macro-usage, -cppcoreguidelines-narrowing-conversions, -cppcoreguidelines-owning-memory, @@ -526,7 +526,7 @@ sord_iter_scan_next(SordIter* iter) return true; } - const SordNode** key; + const SordNode** key = NULL; if (!iter->end) { switch (iter->mode) { case ALL: @@ -867,8 +867,8 @@ sord_find(SordModel* model, const SordQuad pat) return sord_begin(model); } - SearchMode mode; - int n_prefix; + SearchMode mode = ALL; + int n_prefix = 0; const SordOrder index_order = sord_best_index(model, pat, &mode, &n_prefix); SORD_FIND_LOG("Find " TUP_FMT " index=%s mode=%u n_prefix=%d\n", diff --git a/test/test_sord.c b/test/test_sord.c index e9e634d..9c4b3c7 100644 --- a/test/test_sord.c +++ b/test/test_sord.c @@ -528,9 +528,9 @@ main(void) SordNode* chello = sord_new_literal(world, NULL, ni_hao, "cmn"); // Test literal length - size_t n_bytes; - size_t n_chars; - const uint8_t* str = sord_node_get_string_counted(lit_id2, &n_bytes); + size_t n_bytes = 0U; + size_t n_chars = 0U; + const uint8_t* str = sord_node_get_string_counted(lit_id2, &n_bytes); if (strcmp((const char*)str, "hello")) { return test_fail("Literal node corrupt\n"); } else if (n_bytes != strlen("hello")) { @@ -676,8 +676,8 @@ main(void) generate(world, sord, 1, graph43); // Remove one graph via iterator - SerdStatus st; - iter = sord_search(sord, NULL, NULL, NULL, graph43); + SerdStatus st = SERD_SUCCESS; + iter = sord_search(sord, NULL, NULL, NULL, graph43); while (!sord_iter_end(iter)) { if ((st = sord_erase(sord, iter))) { fprintf(stderr, "Remove by iterator failed (%s)\n", serd_strerror(st)); |