From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWWm4-0006ma-Af for qemu-devel@nongnu.org; Mon, 21 May 2012 13:52:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWWm1-0004Dg-UZ for qemu-devel@nongnu.org; Mon, 21 May 2012 13:52:03 -0400 Received: from mail-gg0-f173.google.com ([209.85.161.173]:38746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWWm1-0004D5-O9 for qemu-devel@nongnu.org; Mon, 21 May 2012 13:52:01 -0400 Received: by ggnp1 with SMTP id p1so5765300ggn.4 for ; Mon, 21 May 2012 10:52:00 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1337594591-19309-1-git-send-email-jim@meyering.net> References: <1337594591-19309-1-git-send-email-jim@meyering.net> From: Blue Swirl Date: Mon, 21 May 2012 17:51:39 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 0/3] tighten scope of accidentally global variables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jim Meyering Cc: Jim Meyering , qemu-devel@nongnu.org On Mon, May 21, 2012 at 10:03 AM, Jim Meyering wrote: > From: Jim Meyering > > I noticed this commit, > > =C2=A0 =C2=A0virtio-pci: add missing 'static' > > which made this change: > > =C2=A0 =C2=A0> -const MemoryRegionPortio virtio_portio[] =3D { > =C2=A0 =C2=A0> +static const MemoryRegionPortio virtio_portio[] =3D { > > and wondered if there were other variables like that. > The following command shows that there are: > [note that there are probably more: this finds only those > =C2=A0for which the variable name appears in only one source file. ] Also, only for files at the top level. What about functions? ;-) > > =C2=A0 =C2=A0$ for i in $(nm -e *.o|sed -n 's/.* [BCDGRS] //p'); do \ > =C2=A0 =C2=A0 =C2=A0 =C2=A0test $(git grep -lw $i|wc -l) =3D 1 && echo $i= ;done > =C2=A0 =C2=A0BlockDeviceIoStatus_lookup > =C2=A0 =C2=A0SpiceQueryMouseMode_lookup > =C2=A0 =C2=A0qemu_boot_opts > =C2=A0 =C2=A0qemu_option_rom_opts > =C2=A0 =C2=A0vmstate_info_scsi_requests > =C2=A0 =C2=A0xen_xcg > > The *_lookup names are false positives, since the symbols are actually > used from two or more .o files. =C2=A0Here are patches for the others: > > Jim Meyering (3): > =C2=A0xen: remove unused global, xen_xcg > =C2=A0scsi: declare vmstate_info_scsi_requests to be static > =C2=A0qemu-config: qemu_option_rom_opts, qemu_boot_opts: declare static > > =C2=A0hw/scsi-bus.c =C2=A0 =C2=A0| 2 +- > =C2=A0hw/xen_backend.c | 1 - > =C2=A0qemu-config.c =C2=A0 =C2=A0| 4 ++-- > =C2=A03 files changed, 3 insertions(+), 4 deletions(-) > > -- > 1.7.10.2.552.gaa3bb87