From owner-svn-src-all@freebsd.org Sun Nov 12 00:00:39 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D16D5E509DC; Sun, 12 Nov 2017 00:00:39 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 9E8A5741D8; Sun, 12 Nov 2017 00:00:39 +0000 (UTC) (envelope-from will@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAC00cNq089961; Sun, 12 Nov 2017 00:00:38 GMT (envelope-from will@FreeBSD.org) Received: (from will@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAC00cVc089960; Sun, 12 Nov 2017 00:00:38 GMT (envelope-from will@FreeBSD.org) Message-Id: <201711120000.vAC00cVc089960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: will set sender to will@FreeBSD.org using -f From: Will Andrews Date: Sun, 12 Nov 2017 00:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325729 - head/lib/libkvm X-SVN-Group: head X-SVN-Commit-Author: will X-SVN-Commit-Paths: head/lib/libkvm X-SVN-Commit-Revision: 325729 X-SVN-Commit-Repository: base 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.23 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: Sun, 12 Nov 2017 00:00:39 -0000 Author: will Date: Sun Nov 12 00:00:38 2017 New Revision: 325729 URL: https://svnweb.freebsd.org/changeset/base/325729 Log: libkvm: fix 'index' shadowing. Modified: head/lib/libkvm/kvm_private.c Modified: head/lib/libkvm/kvm_private.c ============================================================================== --- head/lib/libkvm/kvm_private.c Sat Nov 11 23:30:58 2017 (r325728) +++ head/lib/libkvm/kvm_private.c Sun Nov 12 00:00:38 2017 (r325729) @@ -261,9 +261,9 @@ popcount_bytes(uint64_t *addr, uint32_t bit0, uint32_t } void * -_kvm_pmap_get(kvm_t *kd, u_long index, size_t len) +_kvm_pmap_get(kvm_t *kd, u_long idx, size_t len) { - off_t off = index * len; + off_t off = idx * len; if (off >= kd->pt_sparse_off) return (NULL); @@ -699,10 +699,10 @@ again: } int -_kvm_bitmap_init(struct kvm_bitmap *bm, u_long bitmapsize, u_long *index) +_kvm_bitmap_init(struct kvm_bitmap *bm, u_long bitmapsize, u_long *idx) { - *index = ULONG_MAX; + *idx = ULONG_MAX; bm->map = calloc(bitmapsize, sizeof *bm->map); if (bm->map == NULL) return (0); @@ -720,23 +720,23 @@ _kvm_bitmap_set(struct kvm_bitmap *bm, u_long pa, unsi } int -_kvm_bitmap_next(struct kvm_bitmap *bm, u_long *index) +_kvm_bitmap_next(struct kvm_bitmap *bm, u_long *idx) { u_long first_invalid = bm->size * CHAR_BIT; - if (*index == ULONG_MAX) - *index = 0; + if (*idx == ULONG_MAX) + *idx = 0; else - (*index)++; + (*idx)++; - /* Find the next valid index. */ - for (; *index < first_invalid; (*index)++) { - unsigned int mask = *index % CHAR_BIT; - if ((bm->map[*index * CHAR_BIT] & mask) == 0) + /* Find the next valid idx. */ + for (; *idx < first_invalid; (*idx)++) { + unsigned int mask = *idx % CHAR_BIT; + if ((bm->map[*idx * CHAR_BIT] & mask) == 0) break; } - return (*index < first_invalid); + return (*idx < first_invalid); } void