Skip to content

Commit

Permalink
Ensure all C++ class member raw pointers are default-initialized to n…
Browse files Browse the repository at this point in the history
…ullptr.
  • Loading branch information
jralls committed Aug 10, 2018
1 parent 1e87d06 commit 2f861bc
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion libgnucash/backend/dbi/gnc-dbisqlconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class GncDbiSqlStatement : public GncSqlStatement
void add_where_cond(QofIdTypeConst, const PairVec&) override;

private:
const GncSqlConnection* m_conn;
const GncSqlConnection* m_conn = nullptr;
std::string m_sql;
};

Expand Down
2 changes: 1 addition & 1 deletion libgnucash/backend/dbi/gnc-dbisqlconnection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class GncDbiSqlConnection : public GncSqlConnection
const ColVec& info_vec) const noexcept;
bool drop_indexes() noexcept;
private:
QofBackend* m_qbe;
QofBackend* m_qbe = nullptr;
dbi_conn m_conn;
std::unique_ptr<GncDbiProvider> m_provider;
/** Used by the error handler routines to flag if the connection is ok to
Expand Down
4 changes: 2 additions & 2 deletions libgnucash/backend/dbi/gnc-dbisqlresult.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ class GncDbiSqlResult : public GncSqlResult
return dbi_result_field_is_null(m_inst->m_dbi_result, col);
}
private:
GncDbiSqlResult* m_inst;
GncDbiSqlResult* m_inst = nullptr;
};

private:
const GncDbiSqlConnection* m_conn;
const GncDbiSqlConnection* m_conn = nullptr;
dbi_result m_dbi_result;
IteratorImpl m_iter;
GncSqlRow m_row;
Expand Down
6 changes: 3 additions & 3 deletions libgnucash/backend/sql/gnc-sql-backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,12 @@ class GncSqlBackend : public QofBackend
void finish_progress() const noexcept;

protected:
GncSqlConnection* m_conn; /**< SQL connection */
QofBook* m_book; /**< The primary, main open book */
GncSqlConnection* m_conn = nullptr; /**< SQL connection */
QofBook* m_book = nullptr; /**< The primary, main open book */
bool m_loading; /**< We are performing an initial load */
bool m_in_query; /**< We are processing a query */
bool m_is_pristine_db; /**< Are we saving to a new pristine db? */
const char* m_timespec_format; /**< Server-specific date-time string format */
const char* m_timespec_format = nullptr; /**< Server-specific date-time string format */
VersionVec m_versions; /**< Version number for each table */
private:
bool write_account_tree(Account*);
Expand Down
6 changes: 3 additions & 3 deletions libgnucash/backend/sql/gnc-sql-column-table-entry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,12 @@ class GncSqlColumnTableEntry
*/
void add_objectref_guid_to_table (ColVec& vec) const noexcept;
private:
const char* m_col_name; /**< Column name */
const char* m_col_name = nullptr; /**< Column name */
const GncSqlObjectType m_col_type; /**< Column type */
unsigned int m_size; /**< Column size in bytes, for string columns */
ColumnFlags m_flags; /**< Column flags */
const char* m_gobj_param_name; /**< If non-null, g_object param name */
const char* m_qof_param_name; /**< If non-null, qof parameter name */
const char* m_gobj_param_name = nullptr; /**< If non-null, g_object param name */
const char* m_qof_param_name = nullptr; /**< If non-null, qof parameter name */
QofAccessFunc m_getter; /**< General access function */
QofSetterFunc m_setter; /**< General setter function */
template <typename T> T get_row_value_from_object(QofIdTypeConst obj_name,
Expand Down
6 changes: 3 additions & 3 deletions libgnucash/backend/sql/gnc-sql-object-backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ struct write_objects_t
void commit (QofInstance* inst) {
if (is_ok) is_ok = obe->commit (be, inst);
}
GncSqlBackend* be;
bool is_ok;
GncSqlObjectBackend* obe;
GncSqlBackend* be = nullptr;
bool is_ok = false;
GncSqlObjectBackend* obe = nullptr;
};


Expand Down
4 changes: 2 additions & 2 deletions libgnucash/engine/test/test-kvp-frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class KvpFrameTest : public ::testing::Test
}
protected:
KvpFrameImpl t_root;
KvpValue *t_int_val;
KvpValue *t_str_val;
KvpValue *t_int_val = nullptr;
KvpValue *t_str_val = nullptr;
};

template <typename A, typename B> void
Expand Down

0 comments on commit 2f861bc

Please sign in to comment.