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

Jim Fehlig jfehlig at suse.com
Thu Sep 5 17:02:07 UTC 2013


Michal Privoznik wrote:
> 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).
>   

Thanks.  I added link to the thread which inspired this series in patch
1 commit message and pushed.

Regards,
Jim




More information about the libvir-list mailing list