Daniel P. Berrangé <berra...@redhat.com> [2019-10-07, 06:14PM +0100]:
> @@ -2306,20 +2304,17 @@ 
> virDomainQemuMonitorEventStateRegisterID(virConnectPtr conn,
>          return -1;
>      data->flags = flags;
>      if (event && flags != -1) {
> -        int rflags = REG_NOSUB;
> -
> -        if (flags & VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE)
> -            rflags |= REG_ICASE;
>          if (flags & VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_REGEX) {
> -            int err = regcomp(&data->regex, event, rflags);
> +            int cflags = 0;

Do we want to use G_REGEX_OPTIMIZE here?

> +            g_autoptr(GError) err = NULL;
>  
> -            if (err) {
> -                char error[100];
> -                regerror(err, &data->regex, error, sizeof(error));
> +            if (flags & 
> VIR_CONNECT_DOMAIN_QEMU_MONITOR_EVENT_REGISTER_NOCASE)
> +                cflags |= G_REGEX_CASELESS;
> +            data->regex = g_regex_new(event, cflags, 0, &err);
> +            if (!data->regex) {
>                  virReportError(VIR_ERR_INVALID_ARG,
>                                 _("failed to compile regex '%s': %s"),
> -                               event, error);
> -                regfree(&data->regex);
> +                               event, err->message);
>                  VIR_FREE(data);
>                  return -1;
>              }
> -- 
> 2.21.0
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

-- 
IBM Systems
Linux on Z & Virtualization Development
--------------------------------------------------
IBM Deutschland Research & Development GmbH
Schönaicher Str. 220, 71032 Böblingen
Phone: +49 7031 16 1819
--------------------------------------------------
Vorsitzende des Aufsichtsrats: Matthias Hartmann
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to