From owner-svn-src-all@FreeBSD.ORG Thu Sep 25 22:22:58 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 685385FD; Thu, 25 Sep 2014 22:22:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54021A84; Thu, 25 Sep 2014 22:22:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8PMMw8F036413; Thu, 25 Sep 2014 22:22:58 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8PMMwMX036412; Thu, 25 Sep 2014 22:22:58 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201409252222.s8PMMwMX036412@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 25 Sep 2014 22:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r272143 - head/contrib/hyperv/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Sep 2014 22:22:58 -0000 Author: delphij Date: Thu Sep 25 22:22:57 2014 New Revision: 272143 URL: http://svnweb.freebsd.org/changeset/base/272143 Log: Use a char * as iterator over a bounded string. MFC after: 1 week Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c Modified: head/contrib/hyperv/tools/hv_kvp_daemon.c ============================================================================== --- head/contrib/hyperv/tools/hv_kvp_daemon.c Thu Sep 25 22:22:54 2014 (r272142) +++ head/contrib/hyperv/tools/hv_kvp_daemon.c Thu Sep 25 22:22:57 2014 (r272143) @@ -601,8 +601,7 @@ kvp_mac_to_if_name(char *mac) struct ifaddrs *head_ifaddrs_ptr; struct sockaddr_dl *sdl; int status; - size_t i; - char *buf_ptr; + char *buf_ptr, *p; status = getifaddrs(&ifaddrs_ptr); @@ -613,8 +612,8 @@ kvp_mac_to_if_name(char *mac) if (sdl->sdl_type == IFT_ETHER) { buf_ptr = strdup(ether_ntoa((struct ether_addr *)(LLADDR(sdl)))); if (buf_ptr != NULL) { - for (i = 0; i < strlen(buf_ptr); i++) - buf_ptr[i] = toupper(buf_ptr[i]); + for (p = buf_ptr; *p != '\0'; p++) + *p = toupper(*p); if (strncmp(buf_ptr, mac, strlen(mac)) == 0) { /* Caller will free the memory */