svn commit: r348007 - projects/fuse2/lib/libc/gen
Alan Somers
asomers at freebsd.org
Mon May 20 20:43:56 UTC 2019
On Mon, May 20, 2019 at 2:22 PM Konstantin Belousov <kostikbel at gmail.com> wrote:
>
> On Mon, May 20, 2019 at 07:36:36PM +0000, Alan Somers wrote:
> > +static bool
> > +are_fusefs(const char *fsname, const char *vfc_name)
> > +{
> > + const char fusefs[] = "fusefs";
> > + const char fusefs_dot[] = "fusefs.";
> Both arrays should be static.
Ok.
>
> > +
> > + return (strncmp(fsname, fusefs_dot, strlen(fusefs_dot)) == 0 &&
> strlen() is not needed, you can use sizeof() - 1.
>
> > + strcmp(fusefs, vfc_name) == 0);
> > +}
True, but I though that strlen would be more readable. Clang is smart
enough to realize that strlen's argument is a constant and omit the
call to strlen, so that's what I went with. Is there any other reason
to prefer sizeof() - 1 ?
-Alan
More information about the svn-src-projects
mailing list