mirror of
https://github.com/flatpak/flatpak.git
synced 2026-03-26 19:04:56 -04:00
app: Fix inefficiency in pin and mask commands
There's no point reading data from disk on a code path that doesn't do anything with it.
This commit is contained in:
@@ -49,7 +49,6 @@ flatpak_builtin_mask (int argc, char **argv, GCancellable *cancellable, GError *
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(GPtrArray) dirs = NULL;
|
||||
FlatpakDir *dir;
|
||||
g_autoptr(GPtrArray) patterns = NULL;
|
||||
int i;
|
||||
|
||||
context = g_option_context_new (_("[PATTERN…] - disable updates and automatic installation matching patterns"));
|
||||
@@ -62,10 +61,12 @@ flatpak_builtin_mask (int argc, char **argv, GCancellable *cancellable, GError *
|
||||
|
||||
dir = g_ptr_array_index (dirs, 0);
|
||||
|
||||
patterns = flatpak_dir_get_config_patterns (dir, "masked");
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
g_autoptr(GPtrArray) patterns = NULL;
|
||||
|
||||
patterns = flatpak_dir_get_config_patterns (dir, "masked");
|
||||
|
||||
if (patterns->len == 0)
|
||||
{
|
||||
if (flatpak_fancy_output ())
|
||||
|
||||
@@ -51,7 +51,6 @@ flatpak_builtin_pin (int argc, char **argv, GCancellable *cancellable, GError **
|
||||
g_autoptr(GOptionContext) context = NULL;
|
||||
g_autoptr(GPtrArray) dirs = NULL;
|
||||
FlatpakDir *dir;
|
||||
g_autoptr(GPtrArray) patterns = NULL;
|
||||
int i;
|
||||
|
||||
context = g_option_context_new (_("[PATTERN…] - disable automatic removal of runtimes matching patterns"));
|
||||
@@ -64,10 +63,12 @@ flatpak_builtin_pin (int argc, char **argv, GCancellable *cancellable, GError **
|
||||
|
||||
dir = g_ptr_array_index (dirs, 0);
|
||||
|
||||
patterns = flatpak_dir_get_config_patterns (dir, "pinned");
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
g_autoptr(GPtrArray) patterns = NULL;
|
||||
|
||||
patterns = flatpak_dir_get_config_patterns (dir, "pinned");
|
||||
|
||||
if (patterns->len == 0)
|
||||
{
|
||||
if (flatpak_fancy_output ())
|
||||
|
||||
Reference in New Issue
Block a user