[Spice-devel] [PATCH spice-gtk 1/2] channels-smartcard, cleanup: remove test for impossible condition
Christophe Fergeau
cfergeau at redhat.com
Mon Dec 5 03:04:48 PST 2011
On Sat, Dec 03, 2011 at 03:00:22PM +0100, Hans de Goede wrote:
> There is only one caller of smartcard_message_complete_in_flight() and
> that caller already checks that priv->in_flight_message != NULL, as
> it dereferences the priv->in_flight_message pointer.
Today this code will never be triggered, but one never knows what will
happen tomorrow after some refactoring. This check documents one assertion
when we get into this function, which never hurts. We can make it into a
single g_return_if_fail if that would make things clearer, but I'd prefer
to keep it.
Christophe
>
> Signed-off-by: Hans de Goede <hdegoede at redhat.com>
> ---
> gtk/channel-smartcard.c | 5 -----
> 1 files changed, 0 insertions(+), 5 deletions(-)
>
> diff --git a/gtk/channel-smartcard.c b/gtk/channel-smartcard.c
> index f376e53..04815a3 100644
> --- a/gtk/channel-smartcard.c
> +++ b/gtk/channel-smartcard.c
> @@ -264,11 +264,6 @@ smartcard_message_new(VSCMsgType msg_type, SpiceMsgOut *msg_out)
> static void
> smartcard_message_complete_in_flight(SpiceSmartcardChannel *channel)
> {
> - if (channel->priv->in_flight_message == NULL) {
> - g_return_if_fail(g_queue_is_empty(channel->priv->message_queue));
> - return;
> - }
> -
> smartcard_message_free(channel->priv->in_flight_message);
> channel->priv->in_flight_message = g_queue_pop_head(channel->priv->message_queue);
> if (channel->priv->in_flight_message != NULL)
> --
> 1.7.7.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20111205/1d64ba24/attachment.pgp>
More information about the Spice-devel
mailing list