This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] glob: Avoid copying the d_name field of struct dirent [BZ #19779]


> >> +      struct readdir_result result = {NULL};
> >
> > Put spaces around NULL, or just use {} (which has the same semantics).
> 
> I have to use NULL because empty initializers are not part of C89.  So I 
> added the spaces.

OK.  FWIW, I usually use a trailing comma i.e. "{ NULL, }" as implicit
documentation that it's zero-initializing members I didn't list explicitly.

> I prefer having the copy, it is quite short and avoids another level of 
> macro nesting.

The libc sources are riddled with the evidence of my pathological aversion
to duplicated code, and there are certainly cases to be made that it has
not always been the easiest thing to maintain.  Knee-jerk reactions aside,
my true motivation is to ease maintenance and minimize chances of omitting
a change in one place when making it in the other.  So if we manifestly
achieve that not happening, then it's fine.

> I'm attaching the new version.

OK by me.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]