[PATCH BlueZ 2/3] client: replace validate_input() with argsisutf8()

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

 



argsisutf8() does the same thing as validate_input(), but can
be used elsewhere.
---
 client/main.c | 17 ++---------------
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/client/main.c b/client/main.c
index 1daa3d480..6039aa50c 100644
--- a/client/main.c
+++ b/client/main.c
@@ -843,18 +843,6 @@ static gboolean parse_argument(int argc, char *argv[], const char **arg_table,
 	return FALSE;
 }
 
-static int validate_input(int argc, char *argv[])
-{
-	for (int i = 0; i < argc; i++) {
-		if (!strisutf8(argv[i], strlen(argv[i]))) {
-			printf("Invalid character in string: %s\n", argv[i]);
-			return -EINVAL;
-		}
-	}
-
-	return 0;
-}
-
 static void cmd_list(int argc, char *argv[])
 {
 	GList *list;
@@ -3405,9 +3393,8 @@ int main(int argc, char *argv[])
 	int timeout;
 	unsigned int timeout_id;
 
-	status = validate_input(argc, argv);
-	if (status)
-		return status;
+	if (!argsisutf8(argc, argv))
+		return -EINVAL;
 
 	bt_shell_init(argc, argv, &opt);
 	bt_shell_set_menu(&main_menu);
-- 
2.34.1





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux