Date: Sun, 3 Jul 2011 15:22:50 -0500 From: Zhihao Yuan <lichray@gmail.com> To: Ed Schouten <ed@80386.nl> Cc: freebsd-hackers@freebsd.org, Robert Millan <rmh@debian.org>, Ed Maste <emaste@freebsd.org> Subject: Re: [PATCH] build config(8) on GNU systems Message-ID: <CAGsORuB7HhVrdR6f7O9HSXtQK3egYckgugLqV6PY3M0TDB-Sxg@mail.gmail.com> In-Reply-To: <20110703194908.GO71453@hoeg.nl> References: <CAOfDtXP-vZ=qDKZuw0P7=NwX5BfUpqqvGsLLrVHTjrnaRjcMhQ@mail.gmail.com> <20110703194908.GO71453@hoeg.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
Programmers always want to make things "cooler". Just leave the ->d_namlen there :) On Sun, Jul 3, 2011 at 2:49 PM, Ed Schouten <ed@80386.nl> wrote: > * Robert Millan <rmh@debian.org>, 20110702 16:56: >> Index: usr.sbin/config/main.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- usr.sbin/config/main.c =C2=A0 =C2=A0(revision 223721) >> +++ usr.sbin/config/main.c =C2=A0 =C2=A0(working copy) >> @@ -591,7 +591,11 @@ >> =C2=A0 =C2=A0 =C2=A0 if ((dirp =3D opendir(p)) =3D=3D NULL) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 err(EX_OSERR, "opendir = %s", p); >> =C2=A0 =C2=A0 =C2=A0 while ((dp =3D readdir(dirp)) !=3D NULL) { >> +#ifdef _DIRENT_HAVE_D_NAMLEN >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 i =3D dp->d_namlen - 2; >> +#else >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 i =3D strlen (dp->d_name) - = 2; >> +#endif >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Skip non-headers */ >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (dp->d_name[i] !=3D = '.' || dp->d_name[i + 1] !=3D 'h') >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 continue; > > Why not simply use strlen() unconditionally? > > -- > =C2=A0Ed Schouten <ed@80386.nl> > =C2=A0WWW: http://80386.nl/ > --=20 Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___________________________________________________ 4BSD -- http://4bsd.biz/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGsORuB7HhVrdR6f7O9HSXtQK3egYckgugLqV6PY3M0TDB-Sxg>