summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-04-12 15:40:01 +0200
committerThomas Haller <thaller@redhat.com>2019-04-15 20:50:50 +0200
commit87d16e935c91fb36727332dacd27e334f1db972c (patch)
treea0ad0afbf37a474ef1ee391d64fcf47072c0d11c
parentf917fabde40f36332ab1d15d89eaaaa49cd9482f (diff)
downloadNetworkManager-87d16e935c91fb36727332dacd27e334f1db972c.tar.gz
cli: drop unnecessary NULL sentinel from nmc_complete_strings()
Since commit 62b939de4e22 ('cli: add nmc_complete_strv() which takes a string array for completion that may contain NULL'), the sentinel is no longer needed.
-rw-r--r--clients/cli/common.c24
-rw-r--r--clients/cli/connections.c10
-rw-r--r--clients/cli/devices.c16
-rw-r--r--clients/cli/general.c4
-rw-r--r--clients/cli/nmcli.c2
-rw-r--r--clients/cli/utils.c4
6 files changed, 30 insertions, 30 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c
index 3c1c315d5e..cb75e345f6 100644
--- a/clients/cli/common.c
+++ b/clients/cli/common.c
@@ -446,7 +446,7 @@ nmc_find_connection (const GPtrArray *connections,
if (NM_IN_STRSET (filter_type, NULL, "id")) {
v = nm_connection_get_id (connection);
if (complete)
- nmc_complete_strings (filter_val, v, NULL);
+ nmc_complete_strings (filter_val, v);
if (nm_streq0 (filter_val, v))
goto found;
}
@@ -454,7 +454,7 @@ nmc_find_connection (const GPtrArray *connections,
if (NM_IN_STRSET (filter_type, NULL, "uuid")) {
v = nm_connection_get_uuid (connection);
if (complete && (filter_type || *filter_val))
- nmc_complete_strings (filter_val, v, NULL);
+ nmc_complete_strings (filter_val, v);
if (nm_streq0 (filter_val, v))
goto found;
}
@@ -463,7 +463,7 @@ nmc_find_connection (const GPtrArray *connections,
v = nm_connection_get_path (connection);
v_num = nm_utils_dbus_path_get_last_component (v);
if (complete && (filter_type || *filter_val))
- nmc_complete_strings (filter_val, v, filter_type ? v_num : NULL, NULL);
+ nmc_complete_strings (filter_val, v, filter_type ? v_num : NULL);
if ( nm_streq0 (filter_val, v)
|| (filter_type && nm_streq0 (filter_val, v_num)))
goto found;
@@ -472,7 +472,7 @@ nmc_find_connection (const GPtrArray *connections,
if (NM_IN_STRSET (filter_type, NULL, "filename")) {
v = nm_remote_connection_get_filename (NM_REMOTE_CONNECTION (connections->pdata[i]));
if (complete && (filter_type || *filter_val))
- nmc_complete_strings (filter_val, v, NULL);
+ nmc_complete_strings (filter_val, v);
if (nm_streq0 (filter_val, v))
goto found;
}
@@ -525,7 +525,7 @@ nmc_find_active_connection (const GPtrArray *active_cons,
if (NM_IN_STRSET (filter_type, NULL, "id")) {
v = nm_active_connection_get_id (candidate);
if (complete)
- nmc_complete_strings (filter_val, v, NULL);
+ nmc_complete_strings (filter_val, v);
if (nm_streq0 (filter_val, v))
goto found;
}
@@ -533,7 +533,7 @@ nmc_find_active_connection (const GPtrArray *active_cons,
if (NM_IN_STRSET (filter_type, NULL, "uuid")) {
v = nm_active_connection_get_uuid (candidate);
if (complete && (filter_type || *filter_val))
- nmc_complete_strings (filter_val, v, NULL);
+ nmc_complete_strings (filter_val, v);
if (nm_streq0 (filter_val, v))
goto found;
}
@@ -542,7 +542,7 @@ nmc_find_active_connection (const GPtrArray *active_cons,
v = con ? nm_connection_get_path (NM_CONNECTION (con)) : NULL;
v_num = nm_utils_dbus_path_get_last_component (v);
if (complete && (filter_type || *filter_val))
- nmc_complete_strings (filter_val, v, filter_type ? v_num : NULL, NULL);
+ nmc_complete_strings (filter_val, v, filter_type ? v_num : NULL);
if ( nm_streq0 (filter_val, v)
|| (filter_type && nm_streq0 (filter_val, v_num)))
goto found;
@@ -551,7 +551,7 @@ nmc_find_active_connection (const GPtrArray *active_cons,
if (NM_IN_STRSET (filter_type, NULL, "filename")) {
v = nm_remote_connection_get_filename (con);
if (complete && (filter_type || *filter_val))
- nmc_complete_strings (filter_val, v, NULL);
+ nmc_complete_strings (filter_val, v);
if (nm_streq0 (filter_val, v))
goto found;
}
@@ -560,7 +560,7 @@ nmc_find_active_connection (const GPtrArray *active_cons,
v = nm_object_get_path (NM_OBJECT (candidate));
v_num = nm_utils_dbus_path_get_last_component (v);
if (complete && (filter_type || *filter_val))
- nmc_complete_strings (filter_val, v, filter_type ? v_num : NULL, NULL);
+ nmc_complete_strings (filter_val, v, filter_type ? v_num : NULL);
if ( nm_streq0 (filter_val, v)
|| (filter_type && nm_streq0 (filter_val, v_num)))
goto found;
@@ -1254,9 +1254,9 @@ call_cmd (NmCli *nmc, GSimpleAsyncResult *simple, const NMCCommand *cmd, int arg
static void
nmc_complete_help (const char *prefix)
{
- nmc_complete_strings (prefix, "help", NULL);
+ nmc_complete_strings (prefix, "help");
if (*prefix == '-')
- nmc_complete_strings (prefix, "-help", "--help", NULL);
+ nmc_complete_strings (prefix, "-help", "--help");
}
/**
@@ -1395,7 +1395,7 @@ void
nmc_complete_bool (const char *prefix)
{
nmc_complete_strings (prefix, "true", "yes", "on",
- "false", "no", "off", NULL);
+ "false", "no", "off");
}
/**
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index d3193ccb3c..6223a8e87f 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -1941,7 +1941,7 @@ get_connection (NmCli *nmc,
}
if (*argc == 1 && nmc->complete)
- nmc_complete_strings (**argv, "id", "uuid", "path", "filename", NULL);
+ nmc_complete_strings (**argv, "id", "uuid", "path", "filename");
if (NM_IN_STRSET (**argv, "id", "uuid", "path", "filename")) {
if (*argc == 1) {
@@ -2100,7 +2100,7 @@ do_connections_show (NmCli *nmc, int argc, char **argv)
guint i_found_cons;
if (argc == 1 && nmc->complete)
- nmc_complete_strings (*argv, "id", "uuid", "path", "filename", "apath", NULL);
+ nmc_complete_strings (*argv, "id", "uuid", "path", "filename", "apath");
if (NM_IN_STRSET (*argv, "id", "uuid", "path", "filename", "apath")) {
selector = *argv;
@@ -2846,7 +2846,7 @@ do_connection_up (NmCli *nmc, int argc, char **argv)
while (argc > 0) {
if (argc == 1 && nmc->complete)
- nmc_complete_strings (*argv, "ifname", "ap", "passwd-file", NULL);
+ nmc_complete_strings (*argv, "ifname", "ap", "passwd-file");
if (strcmp (*argv, "ifname") == 0) {
argc--;
@@ -3098,7 +3098,7 @@ do_connection_down (NmCli *nmc, int argc, char **argv)
const char *selector = NULL;
if (arg_num == 1 && nmc->complete)
- nmc_complete_strings (*arg_ptr, "id", "uuid", "path", "filename", "apath", NULL);
+ nmc_complete_strings (*arg_ptr, "id", "uuid", "path", "filename", "apath");
if (NM_IN_STRSET (*arg_ptr, "id", "uuid", "path", "filename", "apath")) {
selector = *arg_ptr;
@@ -8167,7 +8167,7 @@ do_connection_edit (NmCli *nmc, int argc, char **argv)
next_arg (nmc, &argc, &argv, NULL);
if (argc == 1 && nmc->complete)
- nmc_complete_strings (*argv, "type", "con-name", "id", "uuid", "path", "filename", NULL);
+ nmc_complete_strings (*argv, "type", "con-name", "id", "uuid", "path", "filename");
nmc->return_value = NMC_RESULT_SUCCESS;
diff --git a/clients/cli/devices.c b/clients/cli/devices.c
index ad3a44c4de..0a0c3159e3 100644
--- a/clients/cli/devices.c
+++ b/clients/cli/devices.c
@@ -2473,7 +2473,7 @@ do_device_set (NmCli *nmc, int argc, char **argv)
gboolean flag;
if (argc == 1 && nmc->complete)
- nmc_complete_strings (*argv, "managed", "autoconnect", NULL);
+ nmc_complete_strings (*argv, "managed", "autoconnect");
if (matches (*argv, "managed")) {
argc--;
@@ -2997,7 +2997,7 @@ do_device_wifi_list (NmCli *nmc, int argc, char **argv)
}
rescan = *argv;
if (argc == 1 && nmc->complete)
- nmc_complete_strings (rescan, "auto", "no", "yes", NULL);
+ nmc_complete_strings (rescan, "auto", "no", "yes");
break;
default:
g_assert_not_reached();
@@ -3179,7 +3179,7 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
while (argc > 0) {
if (argc == 1 && nmc->complete) {
nmc_complete_strings (*argv, "ifname", "bssid", "password", "wep-key-type",
- "name", "private", "hidden", NULL);
+ "name", "private", "hidden");
}
if (strcmp (*argv, "ifname") == 0) {
@@ -3229,7 +3229,7 @@ do_device_wifi_connect_network (NmCli *nmc, int argc, char **argv)
goto finish;
}
if (argc == 1 && nmc->complete)
- nmc_complete_strings (*argv, "key", "phrase", NULL);
+ nmc_complete_strings (*argv, "key", "phrase");
if (strcmp (*argv, "key") == 0)
wep_passphrase = FALSE;
else if (strcmp (*argv, "phrase") == 0)
@@ -3711,7 +3711,7 @@ do_device_wifi_hotspot (NmCli *nmc, int argc, char **argv)
while (argc > 0) {
if (argc == 1 && nmc->complete) {
nmc_complete_strings (*argv, "ifname", "con-name", "ssid", "band",
- "channel", "password", NULL);
+ "channel", "password");
}
if (strcmp (*argv, "ifname") == 0) {
@@ -3753,7 +3753,7 @@ do_device_wifi_hotspot (NmCli *nmc, int argc, char **argv)
}
band = *argv;
if (argc == 1 && nmc->complete)
- nmc_complete_strings (band, "a", "bg", NULL);
+ nmc_complete_strings (band, "a", "bg");
if (strcmp (band, "a") && strcmp (band, "bg")) {
g_string_printf (nmc->return_text, _("Error: band argument value '%s' is invalid; use 'a' or 'bg'."),
band);
@@ -3935,7 +3935,7 @@ do_device_wifi_rescan (NmCli *nmc, int argc, char **argv)
/* Get the parameters */
while (argc > 0) {
if (argc == 1 && nmc->complete)
- nmc_complete_strings (*argv, "ifname", "ssid", NULL);
+ nmc_complete_strings (*argv, "ifname", "ssid");
if (strcmp (*argv, "ifname") == 0) {
if (ifname) {
@@ -4122,7 +4122,7 @@ do_device_lldp_list (NmCli *nmc, int argc, char **argv)
next_arg (nmc, &argc, &argv, NULL);
while (argc > 0) {
if (argc == 1 && nmc->complete)
- nmc_complete_strings (*argv, "ifname", NULL);
+ nmc_complete_strings (*argv, "ifname");
if (strcmp (*argv, "ifname") == 0) {
argc--;
diff --git a/clients/cli/general.c b/clients/cli/general.c
index e79bd65588..2acc4da9b8 100644
--- a/clients/cli/general.c
+++ b/clients/cli/general.c
@@ -683,7 +683,7 @@ do_general_logging (NmCli *nmc, int argc, char **argv)
do {
if (argc == 1 && nmc->complete)
- nmc_complete_strings (*argv, "level", "domains", NULL);
+ nmc_complete_strings (*argv, "level", "domains");
if (matches (*argv, "level")) {
argc--;
@@ -878,7 +878,7 @@ do_networking_connectivity (NmCli *nmc, int argc, char **argv)
next_arg (nmc, &argc, &argv, NULL);
if (nmc->complete) {
if (argc == 1)
- nmc_complete_strings (*argv, "check", NULL);
+ nmc_complete_strings (*argv, "check");
return nmc->return_value;
}
diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c
index d7bc2a4629..d8300e780c 100644
--- a/clients/cli/nmcli.c
+++ b/clients/cli/nmcli.c
@@ -732,7 +732,7 @@ process_command_line (NmCli *nmc, int argc, char **argv)
nmc_complete_strings (argv[0], "--terse", "--pretty", "--mode", "--overview",
"--colors", "--escape",
"--fields", "--nocheck", "--get-values",
- "--wait", "--version", "--help", NULL);
+ "--wait", "--version", "--help");
}
if (argv[0][1] == '-' && argv[0][2] == '\0') {
diff --git a/clients/cli/utils.c b/clients/cli/utils.c
index a8b81279ed..a822dd89da 100644
--- a/clients/cli/utils.c
+++ b/clients/cli/utils.c
@@ -189,10 +189,10 @@ next_arg (NmCli *nmc, int *argc, char ***argv, ...)
if (nmc && nmc->complete && *argc == 1) {
while ((cmd_option = va_arg (args, const char *)))
- nmc_complete_strings (**argv, cmd_option, NULL);
+ nmc_complete_strings (**argv, cmd_option);
if (***argv == '-')
- nmc_complete_strings (**argv, "--ask", "--show-secrets", NULL);
+ nmc_complete_strings (**argv, "--ask", "--show-secrets");
va_end (args);
return 0;