Re: [PATCH 1/6] Allow network model to contain "-"

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

 



On Fri, 2011-12-09 at 12:34 -0700, Eric Blake wrote:
> On 12/08/2011 05:38 PM, Eric Blake wrote:
> >>          int i;
> >>          for (i = 0 ; i < strlen(model) ; i++) {
> 
> Hmm - an O(n) function call on an O(n) loop, for a quadratic action (of
> course, it's in the noise, since the user's model name is likely short).
>  But we can do better with a more efficient search for bogus bytes
> (strspn is O(n), if implemented well in libc).
> 
> >> -            int char_ok = c_isalnum(model[i]) || model[i] == '_';
> >> -            if (!char_ok) {
> >> +            if (!c_isalnum(model[i]) && model[i] != '_' && model[i] != '-') {
> > 
> > I'm not sure if we need to tweak our RNG grammar to also allow this in
> > the XML validation.  I'll check that out tomorrow, when I get around to
> > applying this one and reviewing the rest of the series.
> 
> It turns out the XML didn't do any validation at all.  Here's what I
> came up with - tightening the RNG and relaxing the domain_conf code, so
> that they now match.  Since the concept is the same as yours, I went
> ahead and pushed it, but I claimed authorship on this one, since I
> practically rewrote it.

Yep fair enough. Your new version is much nicer, looks good.

cheers

Attachment: signature.asc
Description: This is a digitally signed message part

--
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]