[Spice-devel] [PATCH 4/9] Implement spice_usb_device_widget_add_err_msg() in usb-device-widget
Alexander Nezhinsky
anezhins at redhat.com
Fri Dec 6 14:27:46 UTC 2019
On Fri, Dec 6, 2019 at 12:12 PM Frediano Ziglio <fziglio at redhat.com> wrote:
>
> In the title I would say "Factor out" instead of "Implement
OK
> +static void spice_usb_device_widget_add_err_msg(SpiceUsbDeviceWidget
> *self,
> > + gchar *new_err_msg)
>
> Why not spice_usb_device_widget_append_err_msg ?
> "add" seems to suggest a list of errors.
>
> But it is (or can be) a list of error messages.
See below, it even puts a newline after the old text.
As far as I understand, it prepares to handle multiple errors occurring one
after another while handling the same event.
> + if (priv->err_msg) {
> > + /* Append the new error message to err_msg,
> > + but only if it's *not* already there! */
> > + if (!strstr(priv->err_msg, new_err_msg)) {
> > + gchar *old_err_msg = priv->err_msg;
> > + priv->err_msg = g_strdup_printf("%s\n%s", old_err_msg,
> > new_err_msg);
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20191206/b85a8986/attachment.html>
More information about the Spice-devel
mailing list