[rbldnsd] Minor portability (non GCC compiller) enhancements
to 0.966a
Victor Duchovni
Victor.Duchovni at MorganStanley.com
Fri Nov 24 19:22:24 MSK 2006
On Fri, Nov 24, 2006 at 06:40:57PM +0300, Michael Tokarev wrote:
> > + if (setsockopt(sock[i], SOL_SOCKET, SO_RCVBUF, (char *)&x, sizeof x) == 0)
>
> Usually, setsockopt's 4th argument is a void pointer. If it is not, the
> proper cast - IMHO - is to (void*), not (char*). Win32 SDK defines this
> arg as (const char *), but casting to/from void* is usually not required.
> I'd cast it to (void*). The same (or similar) comment applies to recvfrom()
> and other routines.
It is a (char *) on (older) systems where it is not a (void *), the
historically correct data type is fine, but (void *) should be OK too.
> > [ user/group code ]
>
> Ok, it was quite messy, but seems to be correct.
> Readability fix ;)
Yes.
> > +#ifndef __GNUC__
> > +#define inline
> > +#endif
>
> Umm. I'd not do this. Especially due to the following routine.
> Alot of compilers supports `inline' keyword nowadays. Maybe it
> should be a configure test instead. Are there any real issue(s)
> with using inline?
I still have some systems whose preferred compiler is not GCC, I don't
see a reason why they should not be able to compile the code even if the
result may not be as efficient. Aggressive optimization (if enabled)
should inline these without the directive.
> > #ifndef INCOMPAT_0_99
> > +#ifdef __GNUC__
> > #warning NS record compatibility mode: remove for 1.0 final
> > +#endif
>
> Any compiler out there wich doesn't understand #warning?
> In any case, this whole stuff is going away soon.
The same compiler that does not understand "inline".
> > const struct dslist *dsl;
> > { /* zone header */
> > char name[DNS_MAXDOMAIN+1];
> > - const unsigned char **nsdna = z->z_nsdna;
> > + const unsigned char * const *nsdna = z->z_nsdna;
>
> Good catch.
The same compiler refuses to compile the code unless I do that...
--
/"\ ASCII RIBBON NOTICE: If received in error,
\ / CAMPAIGN Victor Duchovni please destroy and notify
X AGAINST IT Security, sender. Sender does not waive
/ \ HTML MAIL Morgan Stanley confidentiality or privilege,
and use is prohibited.
More information about the rbldnsd
mailing list