girepository: Combine input file validation code paths in utilities

The code and strings are the same, so let’s simplify things and reduce
LoC for no functional change.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2024-02-26 12:46:53 +00:00
parent 08b3f14a32
commit bd17a09862
2 changed files with 2 additions and 14 deletions

View File

@ -196,19 +196,13 @@ main (int argc, char **argv)
return 0;
}
if (!input)
if (!input || g_strv_length (input) != 1)
{
g_fprintf (stderr, "%s\n", _("Please specify exactly one input file"));
return 1;
}
if (g_strv_length (input) != 1)
{
g_printerr ("%s\n", _("Please specify exactly one input file"));
return 1;
}
g_debug ("[parsing] start, %d includes",
includedirs ? g_strv_length (includedirs) : 0);

View File

@ -90,19 +90,13 @@ main (gint argc,
goto out;
}
if (!namespaces)
if (!namespaces || g_strv_length (namespaces) > 1)
{
status = EXIT_FAILURE;
g_printerr ("%s\n", _("Please specify exactly one namespace"));
goto out;
}
if (g_strv_length (namespaces) > 1)
{
status = EXIT_FAILURE;
g_printerr ("%s\n", _("Please specify exactly one namespace"));
goto out;
}
namespace = namespaces[0];
if (!opt_shlibs && !opt_typelibs)