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

[Xen-devel] [PATCH 01 of 18] tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num



# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1333397497 -7200
# Node ID 21640ef72ce861892d71f3916ba6ed0f9a411cca
# Parent  14609be41f369c26e759c5d63cc0d2be2fc5b9b6
tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num

xs_api.c: In function 'convert_dev_name_to_num':
xs_api.c:227:4: warning: value computed is not used [-Wunused-value]
xs_api.c:229:3: warning: value computed is not used [-Wunused-value]
xs_api.c:235:4: warning: value computed is not used [-Wunused-value]
xs_api.c:237:3: warning: value computed is not used [-Wunused-value]
xs_api.c:244:4: warning: value computed is not used [-Wunused-value]
xs_api.c:246:3: warning: value computed is not used [-Wunused-value]

Do not dereference pointer before increment.

v2:
 - update description, fix only the actual compiler warning
   other unrelated changes will go into a separate patch

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

diff -r 14609be41f36 -r 21640ef72ce8 tools/blktap/lib/xs_api.c
--- a/tools/blktap/lib/xs_api.c
+++ b/tools/blktap/lib/xs_api.c
@@ -224,26 +224,26 @@ int convert_dev_name_to_num(char *name) 
                for(i = 0, ptr = alpha; i < strlen(alpha); i++) {
                        if(*ptr == *p)
                                break;
-                       *ptr++;
+                       ptr++;
                }
-               *p++;
+               p++;
                ret = BASE_DEV_VAL + (16*i) + atoi(p);
        } else if (strstr(name, p_hd) != NULL) {
                p = name + strlen(p_hd);
                for (i = 0, ptr = alpha; i < strlen(alpha); i++) {
                        if(*ptr == *p) break;
-                       *ptr++;
+                       ptr++;
                }
-               *p++;
+               p++;
                ret = (majors[i/2]*256) + atoi(p);
 
        } else if (strstr(name, p_xvd) != NULL) {
                p = name + strlen(p_xvd);
                for(i = 0, ptr = alpha; i < strlen(alpha); i++) {
                        if(*ptr == *p) break;
-                       *ptr++;
+                       ptr++;
                }
-               *p++;
+               p++;
                ret = (202*256) + (16*i) + atoi(p);
 
        } else if (strstr(name, p_plx) != NULL) {

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.