[tracker/sam/uninitialized-var-warnings] core/docs: Fix various "variable may be uninitialized" warnings




commit 7f4dc68644d1b05ffdcfe7ac1f4c2c7697c3ca0a
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Mon Oct 3 13:01:36 2022 +0200

    core/docs: Fix various "variable may be uninitialized" warnings
    
    None of the situations here look like potential bugs, just cases where
    the compiler can't verify that the variable will be initialized before
    it's used.

 docs/tools/tracker-ontology-model.c               | 2 +-
 src/libtracker-common/tracker-parser-libicu.c     | 2 +-
 src/libtracker-sparql/core/tracker-data-manager.c | 2 +-
 src/libtracker-sparql/core/tracker-sparql.c       | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/docs/tools/tracker-ontology-model.c b/docs/tools/tracker-ontology-model.c
index 51236608a..2fbec9f84 100644
--- a/docs/tools/tracker-ontology-model.c
+++ b/docs/tools/tracker-ontology-model.c
@@ -231,7 +231,7 @@ tracker_ontology_model_init_classes (TrackerOntologyModel *model)
 TrackerOntologyProperty *
 tracker_ontology_model_init_properties (TrackerOntologyModel *model)
 {
-       TrackerOntologyProperty *prop;
+       TrackerOntologyProperty *prop = NULL;
        TrackerSparqlCursor *cursor;
        GError *error = NULL;
 
diff --git a/src/libtracker-common/tracker-parser-libicu.c b/src/libtracker-common/tracker-parser-libicu.c
index 09a5e3082..8c4803206 100644
--- a/src/libtracker-common/tracker-parser-libicu.c
+++ b/src/libtracker-common/tracker-parser-libicu.c
@@ -439,7 +439,7 @@ parser_next (TrackerParser *parser,
        gsize word_length_uchar = 0;
        gsize word_length_utf8 = 0;
        gchar *processed_word = NULL;
-       gsize current_word_offset_utf8;
+       gsize current_word_offset_utf8 = 0;
 
        *byte_offset_start = 0;
        *byte_offset_end = 0;
diff --git a/src/libtracker-sparql/core/tracker-data-manager.c 
b/src/libtracker-sparql/core/tracker-data-manager.c
index 9ca4372fb..f46be5273 100644
--- a/src/libtracker-sparql/core/tracker-data-manager.c
+++ b/src/libtracker-sparql/core/tracker-data-manager.c
@@ -1736,7 +1736,7 @@ check_for_deleted_super_properties (TrackerDataManager  *manager,
                        const gchar *object = tracker_property_get_uri (prop_to_remove);
                        const gchar *subject = tracker_property_get_uri (property);
                        GValue value = G_VALUE_INIT;
-                       TrackerRowid subject_id;
+                       TrackerRowid subject_id = 0;
 
                        property = tracker_ontologies_get_property_by_uri (ontologies,
                                                                           TRACKER_PREFIX_RDFS 
"subPropertyOf");
diff --git a/src/libtracker-sparql/core/tracker-sparql.c b/src/libtracker-sparql/core/tracker-sparql.c
index 4bfa4b935..71da4c89e 100644
--- a/src/libtracker-sparql/core/tracker-sparql.c
+++ b/src/libtracker-sparql/core/tracker-sparql.c
@@ -3731,7 +3731,7 @@ translate_GroupClause (TrackerSparql  *sparql,
 {
        GList *conditions = NULL, *expressions = NULL, *l;
        gboolean variables_projected = FALSE;
-       TrackerStringBuilder *select, *old;
+       TrackerStringBuilder *select = NULL, *old = NULL;
        gchar *str;
 
        /* GroupClause ::= 'GROUP' 'BY' GroupCondition+
@@ -6942,7 +6942,7 @@ static TrackerPathElement *
 intersect_path_elements (TrackerSparql *sparql,
                          GPtrArray     *path_elems)
 {
-       TrackerPathElement *elem;
+       TrackerPathElement *elem = NULL;
 
        if (path_elems->len == 0)
                return NULL;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]