qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH-for-4.1? 5/7] vl: Use qemu_strtoi() instead of strto


From: Philippe Mathieu-Daudé
Subject: [Qemu-devel] [PATCH-for-4.1? 5/7] vl: Use qemu_strtoi() instead of strtol()
Date: Fri, 12 Jul 2019 15:39:26 +0200

Since we'll move this code around, fix this checkpatch warning
first:

  ERROR: consider using qemu_strtol in preference to strtol

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 vl.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/vl.c b/vl.c
index 96de4f74b9..c7f4d01c99 100644
--- a/vl.c
+++ b/vl.c
@@ -978,8 +978,7 @@ static struct bt_device_s *bt_device_add(const char *opt)
     pstrcpy(devname, MIN(sizeof(devname), len), opt);
 
     if (endp) {
-        vlan_id = strtol(endp + 6, &endp, 0);
-        if (*endp) {
+        if (qemu_strtoi(endp + 6, (const char **)&endp, 0, &vlan_id) < 0) {
             error_report("unrecognised bluetooth vlan Id");
             return 0;
         }
@@ -1019,8 +1018,7 @@ static int bt_parse(const char *opt)
         if (!*endp || *endp == ',') {
             if (*endp) {
                 if (strstart(endp, ",vlan=", &p)) {
-                    vlan = strtol(p, (char **) &endp, 0);
-                    if (*endp) {
+                    if (qemu_strtoi(p, &endp, 0, &vlan) < 0) {
                         error_report("bad scatternet '%s'", p);
                         return 1;
                     }
-- 
2.20.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]