[OpenAFS-devel] Refactoring the Solaris libafs code base

Russ Allbery rra@stanford.edu
Wed, 27 Dec 2006 16:38:40 -0800


Sean O'Malley <omalleys@msu.edu> writes:

> I -just- submitted a patch to clean up missing string.h headers.
> basically it either added a string.h header file or changed #include
> <string.h> to:

> #ifdef HAVE_STRING_H
> #include <string.h>
> #else
> #ifdef HAVE_STRINGS_H
> #include <strings.h>
> #endif
> #endif

Surely we don't care about K&R compilers any more and can write this as:

#if HAVE_STRING_H
# include <string.h>
#elif HAVE_STRINGS_H
# include <strings.h>
#endif

which is quite a bit more readable.  However, you really don't need this
at all, I bet.

> (I assume strings.h is needed by the BSD port because it doesnt have
> string.h thus I left it in..)

I'm pretty sure there are no platforms outside of a museum that lack
<string.h> and we can just include it unconditionally.  The last system I
know of without <string.h> was SunOS.

> I was going to attempt to ifdef fcntl.h and add it next...

> ie basically the same as string.h but

> #ifdef HAVE_FCNTL_H
> #include <fcntl.h>
> #endif

There is no need to ifdef fcntl.h unless the code has to also compile on
Windows (and there, I'm not sure if fcntl.h is available or not).  We
don't care about SunOS any more.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>