mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-10-24 23:27:39 -05:00
Use g_return_val_if_fail / g_return_if_fail for NULL guards
Replace verbose if-block NULL checks with idiomatic GLib precondition macros, per review feedback.
This commit is contained in:
1 parent
606fc45582
commit
587cc4b91e
1 file changed
+3
-17
@@ -105,20 +105,10 @@ static GSettings * gnc_gsettings_get_settings_obj (const gchar *schema_str)
|
||||
auto full_name_str = normalize_schema_name (schema_str);
|
||||
auto full_name = full_name_str.c_str();
|
||||
auto schema_source {g_settings_schema_source_get_default()};
|
||||
if (!schema_source)
|
||||
{
|
||||
PWARN ("No GSettings schema source available; cannot access schema %s", full_name);
|
||||
LEAVE("");
|
||||
return nullptr;
|
||||
}
|
||||
g_return_val_if_fail(schema_source, nullptr);
|
||||
|
||||
auto schema {g_settings_schema_source_lookup(schema_source, full_name, true)};
|
||||
if (!schema)
|
||||
{
|
||||
PWARN ("GSettings schema %s not found", full_name);
|
||||
LEAVE("");
|
||||
return nullptr;
|
||||
}
|
||||
g_return_val_if_fail(schema, nullptr);
|
||||
|
||||
auto gset = g_settings_new_full (schema, nullptr, nullptr);
|
||||
DEBUG ("Created gsettings object %p for schema %s", gset, full_name);
|
||||
@@ -559,11 +549,7 @@ gnc_settings_dump_schema_paths (void)
|
||||
gchar **non_relocatable;
|
||||
|
||||
auto schema_source {g_settings_schema_source_get_default()};
|
||||
if (!schema_source)
|
||||
{
|
||||
PWARN ("No GSettings schema source available; cannot dump schema paths");
|
||||
return;
|
||||
}
|
||||
g_return_if_fail(schema_source);
|
||||
|
||||
g_settings_schema_source_list_schemas (schema_source, true,
|
||||
&non_relocatable, nullptr);
|
||||
|
||||
Reference in new issue
Block a user