[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 0/3] tighten scope of accidentally global variab
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] [PATCH 0/3] tighten scope of accidentally global variables |
Date: |
Mon, 21 May 2012 17:51:39 +0000 |
On Mon, May 21, 2012 at 10:03 AM, Jim Meyering <address@hidden> wrote:
> From: Jim Meyering <address@hidden>
>
> 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. ]
Also, only for files at the top level. What about functions? ;-)
>
> $ 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