Ver Fonte

Fix warnings popped out of `-Wextra`.

scossu há 8 horas atrás
pai
commit
380383620d

+ 1 - 1
include/volksdata/store.h

@@ -133,7 +133,7 @@ VOLK_store_size (const VOLK_Store *store);
 
 
 /// Feature flags belonging to the store interface.
-const VOLK_StoreFeature
+VOLK_StoreFeature
 VOLK_store_features (const VOLK_Store *store);
 
 

+ 7 - 7
profile.c

@@ -17,9 +17,9 @@ generate_triples (size_t nt)
         sprintf(pstr, "urn:p:%lu", i % (nt / 1000));
         sprintf(ostr, "urn:o:%lu", i);
         trp[i] = VOLK_triple_new(
-                VOLK_iriref_new (sstr, NULL),
-                VOLK_iriref_new (pstr, NULL),
-                VOLK_iriref_new (ostr, NULL));
+                VOLK_iriref_new (sstr),
+                VOLK_iriref_new (pstr),
+                VOLK_iriref_new (ostr));
     }
     log_info ("Triples generated.");
 
@@ -52,7 +52,7 @@ int main(int argc, char *argv[])
     log_info ("Time elapsed: %lf s", wallclock);
 
     log_info ("Inserting triples.");
-    VOLK_Graph *gr = VOLK_graph_new (NULL, NULL, NULL);
+    VOLK_Graph *gr = VOLK_graph_new (NULL, NULL);
     if (!gr) {
         log_error ("Error creating graph!");
         return -1;
@@ -74,9 +74,9 @@ int main(int argc, char *argv[])
 
     log_info ("Lookup...");
     ct = 0;
-    VOLK_Term *s = VOLK_iriref_new ("urn:s:8", NULL);
-    VOLK_Term *p = VOLK_iriref_new ("urn:p:0", NULL);
-    VOLK_Term *o = VOLK_iriref_new ("urn:o:300", NULL);
+    VOLK_Term *s = VOLK_iriref_new ("urn:s:8");
+    VOLK_Term *p = VOLK_iriref_new ("urn:p:0");
+    VOLK_Term *o = VOLK_iriref_new ("urn:o:300");
     VOLK_GraphIterator *it = VOLK_graph_lookup(gr, s, NULL, NULL, &ct);
     log_info ("Found triples by count: %lu", ct);
     VOLK_Triple *spo = NULL;

+ 1 - 1
src/codec/parser_nt.c

@@ -1,4 +1,4 @@
-/* Generated by re2c 4.1 on Fri Aug  1 19:39:10 2025 */
+/* Generated by re2c 4.1 on Sun Aug 17 18:56:10 2025 */
 #line 1 "lexer_nt.re"
 #include "volksdata/codec/parser_nt.h"
 #include "volksdata/codec/tokens_nt.h"

+ 1 - 1
src/codec/parser_ttl.c

@@ -1,4 +1,4 @@
-/* Generated by re2c 4.1 on Fri Aug  1 19:39:10 2025 */
+/* Generated by re2c 4.1 on Sun Aug 17 18:56:10 2025 */
 #line 1 "lexer_ttl.re"
 #include "volksdata/codec/parser_ttl.h"
 #include "volksdata/codec/tokens_ttl.h"

+ 4 - 0
src/core.c

@@ -92,6 +92,10 @@ unlink_cb(
         const char *fpath, const struct stat *sb, int typeflag,
         struct FTW *ftwbuf)
 {
+    (void) sb;
+    (void) typeflag;
+    (void) ftwbuf;
+
     LOG_DEBUG("Removing %s", fpath);
     int rv = remove(fpath);
 

+ 4 - 0
src/environment.c

@@ -14,6 +14,8 @@ VOLK_Buffer *VOLK_default_ctx_buf = NULL;
  */
 static int nsmap_comp_fn (const void *a, const void *b, void *udata)
 {
+    (void) udata;
+
     const NSEntry *nsa = a;
     const NSEntry *nsb = b;
 
@@ -23,6 +25,8 @@ static int nsmap_comp_fn (const void *a, const void *b, void *udata)
 static uint64_t nsmap_hash_fn (
         const void *item, uint64_t seed0, uint64_t seed1)
 {
+    (void) seed1;
+
     const NSEntry *nse = item;
     return (uint64_t) VOLK_HASH64 (nse->pfx, strlen (nse->pfx), seed0);
 }

+ 1 - 1
src/store.c

@@ -79,7 +79,7 @@ VOLK_store_size (const VOLK_Store *store)
 { return store->sif->size_fn (store->data); }
 
 
-const VOLK_StoreFeature
+VOLK_StoreFeature
 VOLK_store_features (const VOLK_Store *store)
 { return store->sif->features; }
 

+ 32 - 7
src/store_htable.c

@@ -38,7 +38,11 @@ typedef struct ht_iterator_t {
 */
 static bool lookup_none_eq_fn (
         const VOLK_Key spok[], const VOLK_Key luk[])
-{ return true; }
+{
+    (void) spok;
+    (void) luk;
+    return true;
+}
 
 /**
  * Keyset lookup for S key.
@@ -94,11 +98,19 @@ static bool lookup_spok_eq_fn (
 
 uint64_t trp_key_hash_fn (
         const void *item, uint64_t seed0, uint64_t seed1)
-{ return (uint64_t) (VOLK_HASH (item, TRP_KLEN, seed0)); }
+{
+    (void) seed1;
+
+    return (uint64_t) (VOLK_HASH (item, TRP_KLEN, seed0));
+}
 
 
 int trp_key_cmp_fn (const void *a, const void *b, void *udata)
-{ return memcmp (a, b, TRP_KLEN); }
+{
+    (void) udata;
+
+    return memcmp (a, b, TRP_KLEN);
+}
 
 
 /**
@@ -106,14 +118,23 @@ int trp_key_cmp_fn (const void *a, const void *b, void *udata)
  */
 static uint64_t htstore_idx_hash_fn (
         const void *item, uint64_t seed0, uint64_t seed1)
-{ return ((IndexEntry *) item)->key; }
+{
+    (void) seed0;
+    (void) seed1;
+
+    return ((IndexEntry *) item)->key;
+}
 
 
 /**
  * Compare callback function for index hashmap.
  */
 static int htstore_idx_cmp_fn (const void *a, const void *b, void *udata)
-{ return ((const IndexEntry *) a)->key - ((const IndexEntry *) b)->key; }
+{
+    (void) udata;
+
+    return ((const IndexEntry *) a)->key - ((const IndexEntry *) b)->key;
+}
 
 
 /**
@@ -159,6 +180,8 @@ htiter_next_key (HTIterator *it);
 static void *
 htstore_new (const char *id, size_t size)
 {
+    (void) id;
+
     HTStore *ht;
     CALLOC_GUARD (ht, NULL);
 
@@ -285,9 +308,11 @@ static void *
 htstore_lookup (
         void *h,
         const VOLK_Buffer *ss, const VOLK_Buffer *sp, const VOLK_Buffer *so,
-        const VOLK_Buffer *sc, void *_unused, size_t *ct)
+        const VOLK_Buffer *_unused, void *_unused2, size_t *ct)
 {
     (void) _unused;
+    (void) _unused2;
+
     HTStore *store = h;
     HTIterator *it;
     CALLOC_GUARD (it, NULL);
@@ -429,7 +454,7 @@ htiter_next (void *h, VOLK_BufferTriple *sspo, VOLK_Buffer **_unused)
 
 
 const VOLK_StoreInt htstore_int = {
-    .name           = "Hash Table Store",
+    .name           = "Hashtable Store",
     .features       = VOLK_STORE_COW,
 
     .setup_fn       = NULL,

+ 1 - 1
src/store_mdb.c

@@ -1066,7 +1066,7 @@ mdbstore_remove (
     // The lookup operates within the current (bottom) write transaction.
     MDBIterator *it = mdbstore_lookup (store, ss, sp, so, sc, txn, ct);
     if (UNLIKELY (!it)) return VOLK_DB_ERR;
-    if (ct) LOG_DEBUG("Found %lu triples to remove.", *ct);
+    if (ct) {LOG_DEBUG("Found %lu triples to remove.", *ct);}
 
     while (mdbiter_next_key (it) == VOLK_OK) {
         spok_v.mv_data = it->spok;

+ 22 - 8
src/term.c

@@ -87,13 +87,20 @@ term_init (
 
 static uint64_t
 tset_hash_fn (
-        const void *item, uint64_t seed0, uint64_t seed1)
-{ return ((const KeyedTerm *) item)->key; }
+        const void *item, uint64_t _unused, uint64_t _unused2)
+{
+    (void) _unused;
+    (void) _unused2;
+
+    return ((const KeyedTerm *) item)->key;
+}
 
 
 static int
-tset_cmp_fn (const void *a, const void *b, void *udata)
+tset_cmp_fn (const void *a, const void *b, void *_unused)
 {
+    (void) _unused;
+
     return 
             ((const KeyedTerm *) a)->key -
             ((const KeyedTerm *) b)->key;
@@ -111,14 +118,21 @@ tset_free_fn (void *item)
 
 static uint64_t
 link_map_hash_fn (
-        const void *item, uint64_t seed0, uint64_t seed1)
-{ return ((const Link *)item)->term->key; }
+        const void *item, uint64_t _unused, uint64_t _unused2)
+{
+    (void) _unused;
+    (void) _unused2;
+
+    return ((const Link *)item)->term->key;
+}
 
 
 static int
-link_map_cmp_fn (const void *a, const void *b, void *udata)
+link_map_cmp_fn (const void *a, const void *b, void *_unused)
 {
-    return 
+    (void) _unused;
+
+    return
             ((const Link *)a)->term->key -
             ((const Link *)b)->term->key;
 }
@@ -567,7 +581,7 @@ VOLK_term_set_get (VOLK_TermSet *ts, VOLK_Key key)
 {
     const KeyedTerm *entry = hashmap_get (ts, &(KeyedTerm){.key=key});
     if (entry) LOG_TRACE("ID found for key %lx: %s", key, entry->term->data);
-    else LOG_TRACE("No ID found for key %lx.", key);
+    else {LOG_TRACE("No ID found for key %lx.", key);}
 
     return (entry) ? entry->term : NULL;
 }

+ 1 - 1
test.c

@@ -10,7 +10,7 @@
 
 #define TEST_STORE_PATH TMPDIR "/volksdata_test_mdb"
 
-int main(int argc, char **argv) {
+int main() {
 
     // Set env variable to test path.
     putenv ("VOLK_MDB_STORE_PATH=" TEST_STORE_PATH);

+ 1 - 1
test/assets/triples.h

@@ -30,7 +30,7 @@ VOLK_Triple **create_triples()
                     "String 1",
                     VOLK_iriref_new ("urn:mydatatype:string"));
 
-    VOLK_Triple **trp = calloc (sizeof (*trp), NUM_TRP + 1);
+    VOLK_Triple **trp = calloc (NUM_TRP + 1, sizeof (*trp));
     trp[0] = VOLK_triple_new (
             s0,
             VOLK_iriref_new ("urn:p:0"),

+ 3 - 3
test/test_graph.c

@@ -97,7 +97,7 @@ _graph_add (VOLK_StoreType type)
     EXPECT_INT_EQ (ct, 8);
     EXPECT_INT_EQ (VOLK_graph_size (gr), 8);
 
-    for (int i = 0; i < sizeof (trp); i++) {
+    for (unsigned int i = 0; i < sizeof (trp); i++) {
         log_info ("checking triple #%d.", i);
         ASSERT (VOLK_graph_contains (gr, trp[i]), "Triple not in graph!");
     }
@@ -871,7 +871,7 @@ static int test_graph_copy()
     EXPECT_PASS (VOLK_graph_copy_contents (gr1, gr2, NULL, NULL, NULL));
     EXPECT_INT_EQ (VOLK_graph_size (gr1), VOLK_graph_size (gr2));
 
-    for (int i = 0; i < sizeof (trp); i++) {
+    for (unsigned int i = 0; i < sizeof (trp); i++) {
         log_info ("checking triple #%d.", i);
         ASSERT (
                 VOLK_graph_contains (gr2, trp[i]),
@@ -883,7 +883,7 @@ static int test_graph_copy()
     EXPECT_PASS (VOLK_graph_copy_contents (gr1, gr3, NULL, NULL, NULL));
     EXPECT_INT_EQ (VOLK_graph_size (gr1), VOLK_graph_size (gr2));
 
-    for (int i = 0; i < sizeof (trp); i++) {
+    for (unsigned int i = 0; i < sizeof (trp); i++) {
         log_info ("checking triple #%d.", i);
         ASSERT (
                 VOLK_graph_contains (gr3, trp[i]),

+ 1 - 1
test/test_store.c

@@ -305,7 +305,7 @@ static int test_quad_store()
         0, 0,                   // #40
     };
 
-    int ctx_ct[10] = {
+    unsigned int ctx_ct[10] = {
         // BEGIN ctx1 (triples 0÷5)
         1, 1, 1, 1,
         // BEGIN ctx2 (triples 4÷9)