Re: [PATCH v2 17/23] conf: convert over to use GRegex for regular expressions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel P. Berrangé <berrange@xxxxxxxxxx> [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@xxxxxxxxxx
> 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux