[Spice-devel] [PATCH spice-gtk] main: use glib sort

Hans de Goede hdegoede at redhat.com
Wed Feb 20 09:09:49 PST 2013


ACK.

On 02/20/2013 12:08 PM, Marc-André Lureau wrote:
> Use glib sort for monitors. This allows to share the same
> implementation and behaviour on various platforms.
> ---
>   gtk/channel-main.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gtk/channel-main.c b/gtk/channel-main.c
> index 40d27cc..fe57684 100644
> --- a/gtk/channel-main.c
> +++ b/gtk/channel-main.c
> @@ -967,7 +967,7 @@ static void agent_msg_queue_many(SpiceMainChannel *channel, int type, const void
>       g_warn_if_fail(out == NULL);
>   }
>
> -static int monitors_cmp(const void *p1, const void *p2)
> +static int monitors_cmp(const void *p1, const void *p2, gpointer user_data)
>   {
>       const VDAgentMonConfig *m1 = p1;
>       const VDAgentMonConfig *m2 = p2;
> @@ -988,7 +988,7 @@ static void monitors_align(VDAgentMonConfig *monitors, int nmonitors)
>
>       /* sort by distance from origin */
>       sorted_monitors = g_memdup(monitors, nmonitors * sizeof(VDAgentMonConfig));
> -    qsort(sorted_monitors, nmonitors, sizeof(VDAgentMonConfig), monitors_cmp);
> +    g_qsort_with_data(sorted_monitors, nmonitors, sizeof(VDAgentMonConfig), monitors_cmp, NULL);
>
>       /* super-KISS ltr alignment, feel free to improve */
>       for (i = 0; i < nmonitors; i++) {
>


More information about the Spice-devel mailing list