Hi,
> - If the get_next() invocation is simple, then style (1) is perfectly fine.
Fully agree. Duplicating a single line is perfectly fine if it is
simple enough that you can hardly get it wrong.
> - Style (2) is the worst of all.
Yes, especially because the break is three lines not two due
Laszlo Ersek 于2020年8月14日周五 上午4:21写道:
>
> On 08/13/20 17:36, Li Qiang wrote:
> > Just use 'while (true)' to avoid duplicated.
> > No function change.
> >
> > Signed-off-by: Li Qiang
> > ---
> > hw/display/virtio-gpu.c | 8 +---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff
On 08/13/20 17:36, Li Qiang wrote:
> Just use 'while (true)' to avoid duplicated.
> No function change.
>
> Signed-off-by: Li Qiang
> ---
> hw/display/virtio-gpu.c | 8 +---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
Just use 'while (true)' to avoid duplicated.
No function change.
Signed-off-by: Li Qiang
---
hw/display/virtio-gpu.c | 8 +---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 5f0dd7c150..9cef313f5e 100644
--- a/hw/display/