Current-Users archive

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

Re: Some more setenv(3) update



On Wed, Oct 13, 2010 at 12:04:03AM +0200, Joerg Sonnenberger wrote:
> On Mon, Oct 11, 2010 at 11:01:30PM +0000, Christos Zoulas wrote:
> > You could move the loop:
> > 
> >        for (cc = name; *cc && *cc != '='; ++cc)        /* no `=' in name */
> >                continue;
> 
> You could also use the more concise strcspn.

strcspn() might be more concise, but it is a much slower function
than strchr()....
I would be tempted to write:
        for (cc = name; *cc != '='; cc++) {
                if (*cc == 0)
                        return EINAL;
        }

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index