From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59026) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWPSk-0005Sl-Pl for qemu-devel@nongnu.org; Mon, 21 May 2012 06:03:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWPSf-0002fO-OJ for qemu-devel@nongnu.org; Mon, 21 May 2012 06:03:38 -0400 Received: from mx.meyering.net ([88.168.87.75]:36011 helo=hx.meyering.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWPSf-0002f5-DT for qemu-devel@nongnu.org; Mon, 21 May 2012 06:03:33 -0400 From: Jim Meyering Date: Mon, 21 May 2012 12:03:08 +0200 Message-Id: <1337594591-19309-1-git-send-email-jim@meyering.net> Subject: [Qemu-devel] [PATCH 0/3] tighten scope of accidentally global variables List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Jim Meyering , Blue Swirl From: Jim Meyering I noticed this commit, virtio-pci: add missing 'static' which made this change: > -const MemoryRegionPortio virtio_portio[] = { > +static const MemoryRegionPortio virtio_portio[] = { 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 for which the variable name appears in only one source file. ] $ for i in $(nm -e *.o|sed -n 's/.* [BCDGRS] //p'); do \ test $(git grep -lw $i|wc -l) = 1 && echo $i;done BlockDeviceIoStatus_lookup SpiceQueryMouseMode_lookup qemu_boot_opts qemu_option_rom_opts vmstate_info_scsi_requests xen_xcg The *_lookup names are false positives, since the symbols are actually used from two or more .o files. Here are patches for the others: Jim Meyering (3): xen: remove unused global, xen_xcg scsi: declare vmstate_info_scsi_requests to be static qemu-config: qemu_option_rom_opts, qemu_boot_opts: declare static hw/scsi-bus.c | 2 +- hw/xen_backend.c | 1 - qemu-config.c | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) -- 1.7.10.2.552.gaa3bb87