[gvdb/mcatanzaro/write-contents-async: 4/4] Add some g_return checks to gvdb_table_write_contents()



commit 16fb81cd7e3a3586252fc5d185e5c2c95125d045
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Fri Jun 21 09:58:15 2019 -0500

    Add some g_return checks to gvdb_table_write_contents()
    
    I'm not auditing all the public functions in this file for precondition
    checks, but since I'm adding an async version of this function, it
    makes sense to ensure there are matching checks for the sync version.

 gvdb-builder.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gvdb-builder.c b/gvdb-builder.c
index 55b4513..ff28edf 100644
--- a/gvdb-builder.c
+++ b/gvdb-builder.c
@@ -511,6 +511,10 @@ gvdb_table_write_contents (GHashTable   *table,
   FileBuilder *fb;
   GString *str;
 
+  g_return_val_if_fail (table != NULL, FALSE);
+  g_return_val_if_fail (filename != NULL, FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
   fb = file_builder_new (byteswap);
   file_builder_add_hash (fb, table, &root);
   str = file_builder_serialise (fb, root);


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