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

Re: [Xen-devel] [PATCH 3 of 3] xl: allow for node-wise specification of vcpu pinning



On Thu, 2012-10-18 at 14:11 +0100, Dario Faggioli wrote:
> On Thu, 2012-10-18 at 12:23 +0100, Ian Campbell wrote: 
> > On Tue, 2012-10-16 at 18:26 +0100, Dario Faggioli wrote:
> > 
> > > +            isnot = 1;
> > > +        }
> > > +        /* Check if we're dealing with a full node */
> > > +        if (strstr(toka, "node:") == toka || strstr(toka, "nodes:") == 
> > > toka) {
> > 
> > Isn't strstr(FOO, "thing") == FOO just an expensive way of writing
> > strncmp(FOO, "ting", sizeof(...))?
> > 
> Mmm... what I wanted was to make sure that "thing" not only is part of
> FOO, but that also is the very beginning of that same string. That's why
> I exploited the fact that strstr() returns a pointer to the beginning of
> the substring "thing" within FOO.
> 
> Now that you mentioned it, I think that I actually can achieve the same
> with strncmp, limiting the comparison at strlen("thing"). If that was
> what you meant, the answer is yes, I can do that (and I agree it's
> probably better).

Right, With the strstr method if there is 1000 characters in the input
before the "thing" you've wasted a bunch of time scanning for it just to
throw it away, whereas with str*cmp you would give up after the first
non-matching char.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.