lib/mtree: drop redundant name checks
authorLuca BRUNO <luca.bruno@coreos.com>
Wed, 7 Sep 2022 12:33:37 +0000 (12:33 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Wed, 7 Sep 2022 12:33:37 +0000 (12:33 +0000)
This drops several NULL checks against filename input argument.
Those checks are both redundant (as filename validation already
checks for that) and dangerous (as they return early without
setting an error value).

src/libostree/ostree-mutable-tree.c

index 58dd3c4cf4d0ee910cc6c04e37f5c2d513fccfb0..60e3be2f5bf5a0cc3741494ed87d304b1a2ff214 100644 (file)
@@ -303,8 +303,6 @@ ostree_mutable_tree_replace_file (OstreeMutableTree *self,
                                   const char        *checksum,
                                   GError           **error)
 {
-  g_return_val_if_fail (name != NULL, FALSE);
-
   if (!ot_util_filename_validate (name, error))
     return FALSE;
 
@@ -338,8 +336,6 @@ ostree_mutable_tree_remove (OstreeMutableTree *self,
                             gboolean           allow_noent,
                             GError           **error)
 {
-  g_return_val_if_fail (name != NULL, FALSE);
-
   if (!ot_util_filename_validate (name, error))
     return FALSE;
 
@@ -374,8 +370,6 @@ ostree_mutable_tree_ensure_dir (OstreeMutableTree *self,
                                 OstreeMutableTree **out_subdir,
                                 GError           **error)
 {
-  g_return_val_if_fail (name != NULL, FALSE);
-
   if (!ot_util_filename_validate (name, error))
     return FALSE;