[libvirt] [PATCH 2/2] libxl: Compile regular expression where it is used

Michal Privoznik mprivozn at redhat.com
Thu Sep 5 09:20:06 UTC 2013


On 05.09.2013 00:40, Jim Fehlig wrote:
> Jim Fehlig wrote:
>> The regular expression used to determine guest capabilities
>> was compiled in libxlCapsInitHost() but used in libxlCapsInitGuests().
>> Move compilation to libxlCapsInitGuests() where it is used, and free
>> the compiled regex after use.  Ensure not to free the regex if
>> compilation fails.
>>
>> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
>> ---
>>  src/libxl/libxl_conf.c | 29 +++++++++++++++--------------
>>  1 file changed, 15 insertions(+), 14 deletions(-)
>>
>> diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
>> index fcb278b..c7be7aa 100644
>> --- a/src/libxl/libxl_conf.c
>> +++ b/src/libxl/libxl_conf.c
>> @@ -61,8 +61,7 @@ struct guest_arch {
>>      int ia64_be;
>>  };
>>  
>> -static const char *xen_cap_re = "(xen|hvm)-[[:digit:]]+\\.[[:digit:]]+-(x86_32|x86_64|ia64|powerpc64)(p|be)?";
>> -static regex_t xen_cap_rec;
>> +#define XEN_CAP_REGEX "(xen|hvm)-[[:digit:]]+\\.[[:digit:]]+-(x86_32|x86_64|ia64|powerpc64)(p|be)?";
>>   
> 
> Opps, that's not quite right.  The version I actually compiled and
> tested doesn't have the trailing ';' on the #define :).
> 

Yep, gcc caught that. ACK series (with this change).

Michal




More information about the libvir-list mailing list