From: Olaf Hering Subject: [PATCH 01 of 18] tools/blktap: remove unneeded pointer dereferencing in convert_dev_name_to_num Date: Mon, 02 Apr 2012 22:15:24 +0200 Message-ID: <21640ef72ce861892d71.1333397724@probook.site> References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xensource.com Cc: Ian Jackson List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Olaf Hering # 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 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) {