[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/6] qemu/queue.h: leave head structs anonymous
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 2/6] qemu/queue.h: leave head structs anonymous unless necessary |
Date: |
Fri, 7 Dec 2018 14:47:47 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 |
On 07/12/18 08:28, Markus Armbruster wrote:
>
> $ git-grep 'Q[A-Z]*_HEAD([^,]' | grep -v '#define' | grep -v QTAILQ_HEAD
> block/qcow2-bitmap.c:typedef QSIMPLEQ_HEAD(Qcow2BitmapList, Qcow2Bitmap)
> Qcow2BitmapList;
> include/block/block.h:typedef QSIMPLEQ_HEAD(BlockReopenQueue,
> BlockReopenQueueEntry) BlockReopenQueue;
> include/hw/vfio/vfio-common.h:typedef QLIST_HEAD(VFIOGroupList,
> VFIOGroup) VFIOGroupList;
> qemu-bridge-helper.c:typedef QSIMPLEQ_HEAD(ACLList, ACLRule) ACLList;
>
> Are these four names left in intentionally?
Yes, they are the ones which are used in extern global variables or in
function parameters. If they are static variables or struct fields, on
the other hand, you don't need the typedef.
The same is also true of the handful of QTAILQ head structs that are
typedefed in 3/6.
I'll add this to the commit message.
> If the name is indeed not needed for lists of other kinds, should we
> simplify the macros so their users don't have to supply an empty first
> argument?
No, it's just a coincidence. For example QTAILQ needs it (patch 3/6).
Paolo
- [Qemu-devel] [PATCH for-4.0 0/6] qemu/queue.h usage cleanup, improved QTAILQ API, Paolo Bonzini, 2018/12/06
- [Qemu-devel] [PATCH 1/6] qemu/queue.h: do not access tqe_prev directly, Paolo Bonzini, 2018/12/06
- [Qemu-devel] [PATCH 3/6] qemu/queue.h: typedef QTAILQ heads, Paolo Bonzini, 2018/12/06
- [Qemu-devel] [PATCH 2/6] qemu/queue.h: leave head structs anonymous unless necessary, Paolo Bonzini, 2018/12/06
- [Qemu-devel] [PATCH 5/6] qemu/queue.h: simplify reverse access to QTAILQ, Paolo Bonzini, 2018/12/06
- [Qemu-devel] [PATCH 4/6] qemu/queue.h: reimplement QTAILQ without pointer-to-pointers, Paolo Bonzini, 2018/12/06
- [Qemu-devel] [PATCH 6/6] checkpatch: warn about queue/queue.h head structs that are not typedef-ed, Paolo Bonzini, 2018/12/06