diff mbox

Remove g_sequence_lookup from qemu-img help function

Message ID 1400015466-16048-1-git-send-email-ncmike@ncultra.org
State New
Headers show

Commit Message

Mike D. Day May 13, 2014, 9:11 p.m. UTC
g_sequence_lookup is not supported by glib < 2.28. The usage
of g_sequence_lookup is not essential in this context (it's a
safeguard against duplicate values in the help message).
Removing the call enables the build on all platforms and
does not change the operation of the help function.

Signed-off-by: Mike Day <ncmike@ncultra.org>
---
 qemu-img.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Eric Blake May 13, 2014, 9:48 p.m. UTC | #1
On 05/13/2014 03:11 PM, Mike Day wrote:

Subject line could have used a [PATCHv2] designation to make it obvious
this is a fixed version.  But that doesn't affect what goes into git.

> g_sequence_lookup is not supported by glib < 2.28. The usage
> of g_sequence_lookup is not essential in this context (it's a
> safeguard against duplicate values in the help message).
> Removing the call enables the build on all platforms and
> does not change the operation of the help function.
> 
> Signed-off-by: Mike Day <ncmike@ncultra.org>
> ---
>  qemu-img.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>
Cornelia Huck May 14, 2014, 6:31 a.m. UTC | #2
On Tue, 13 May 2014 17:11:06 -0400
Mike Day <ncmike@ncultra.org> wrote:

> g_sequence_lookup is not supported by glib < 2.28. The usage
> of g_sequence_lookup is not essential in this context (it's a
> safeguard against duplicate values in the help message).
> Removing the call enables the build on all platforms and
> does not change the operation of the help function.
> 
> Signed-off-by: Mike Day <ncmike@ncultra.org>
> ---
>  qemu-img.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)

I don't get duplicates even without the safeguard :)

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Kevin Wolf May 14, 2014, 7:44 a.m. UTC | #3
Am 13.05.2014 um 23:48 hat Eric Blake geschrieben:
> On 05/13/2014 03:11 PM, Mike Day wrote:
> 
> Subject line could have used a [PATCHv2] designation to make it obvious
> this is a fixed version.  But that doesn't affect what goes into git.
> 
> > g_sequence_lookup is not supported by glib < 2.28. The usage
> > of g_sequence_lookup is not essential in this context (it's a
> > safeguard against duplicate values in the help message).
> > Removing the call enables the build on all platforms and
> > does not change the operation of the help function.
> > 
> > Signed-off-by: Mike Day <ncmike@ncultra.org>
> > ---
> >  qemu-img.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>

Thanks, applied to the block branch.

Kevin
Peter Maydell May 14, 2014, 8:23 a.m. UTC | #4
On 14 May 2014 08:44, Kevin Wolf <kwolf@redhat.com> wrote:
> Am 13.05.2014 um 23:48 hat Eric Blake geschrieben:
>> On 05/13/2014 03:11 PM, Mike Day wrote:
>>
>> Subject line could have used a [PATCHv2] designation to make it obvious
>> this is a fixed version.  But that doesn't affect what goes into git.
>>
>> > g_sequence_lookup is not supported by glib < 2.28. The usage
>> > of g_sequence_lookup is not essential in this context (it's a
>> > safeguard against duplicate values in the help message).
>> > Removing the call enables the build on all platforms and
>> > does not change the operation of the help function.
>> >
>> > Signed-off-by: Mike Day <ncmike@ncultra.org>
>> > ---
>> >  qemu-img.c | 7 ++-----
>> >  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> Reviewed-by: Eric Blake <eblake@redhat.com>
>
> Thanks, applied to the block branch.

Ah, I was thinking about applying this directly since it's a build fix.
But I guess it could go through the block branch instead...

thanks
-- PMM
Alexander Graf May 16, 2014, 12:35 p.m. UTC | #5
On 14.05.14 10:23, Peter Maydell wrote:
> On 14 May 2014 08:44, Kevin Wolf <kwolf@redhat.com> wrote:
>> Am 13.05.2014 um 23:48 hat Eric Blake geschrieben:
>>> On 05/13/2014 03:11 PM, Mike Day wrote:
>>>
>>> Subject line could have used a [PATCHv2] designation to make it obvious
>>> this is a fixed version.  But that doesn't affect what goes into git.
>>>
>>>> g_sequence_lookup is not supported by glib < 2.28. The usage
>>>> of g_sequence_lookup is not essential in this context (it's a
>>>> safeguard against duplicate values in the help message).
>>>> Removing the call enables the build on all platforms and
>>>> does not change the operation of the help function.
>>>>
>>>> Signed-off-by: Mike Day <ncmike@ncultra.org>
>>>> ---
>>>>   qemu-img.c | 7 ++-----
>>>>   1 file changed, 2 insertions(+), 5 deletions(-)
>>> Reviewed-by: Eric Blake <eblake@redhat.com>
>> Thanks, applied to the block branch.
> Ah, I was thinking about applying this directly since it's a build fix.
> But I guess it could go through the block branch instead...

Yes, could you please apply it directly?


Alex
diff mbox

Patch

diff --git a/qemu-img.c b/qemu-img.c
index 04ce02a..1ad899e 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -70,11 +70,8 @@  static void add_format_to_seq(void *opaque, const char *fmt_name)
 {
     GSequence *seq = opaque;
 
-    if (!g_sequence_lookup(seq, (gpointer)fmt_name,
-                           compare_data, NULL)) {
-        g_sequence_insert_sorted(seq, (gpointer)fmt_name,
-                                 compare_data, NULL);
-    }
+    g_sequence_insert_sorted(seq, (gpointer)fmt_name,
+                             compare_data, NULL);
 }
 
 static void QEMU_NORETURN GCC_FMT_ATTR(1, 2) error_exit(const char *fmt, ...)