Alle domenica 9 settembre 2012, Samuel Thibault ha scritto:
> Pino Toscano, le Fri 07 Sep 2012 20:02:56 +0200, a écrit :
> > +static int args_filename_length (const char *name)
> > +{
> > +  const char *p = name;
> > +  while (*p != '\0' && *p != ' ')
> > +    ++p;
> 
> Why not using index(name, ' ') here?

If I would use strchr, the code would be something like:
  const char *p = strchr (name, ' ');
  return p != NULL ? p - name : strlen (name);
which, for the common case, would mean scanning the string twice.
If it is not considered an issue I can change it anyway.

-- 
Pino Toscano

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

Reply via email to