summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-01-11 09:32:48 +0000
committerJim Meyering <jim@meyering.net>2003-01-11 09:32:48 +0000
commitc7463c38f85d29582a7dd79cd4b8f649c5fc45d3 (patch)
treed91a37bbb6408c7c95eae34f42c7d78bf8fae3c7
parenteb04d885c2683e98fba3931d3a8b6f6b0e13924b (diff)
downloadcoreutils-c7463c38f85d29582a7dd79cd4b8f649c5fc45d3.tar.xz
Don't test HAVE_ERRNO_H. It's not necessary.
Don't test HAVE_STDDEF_H. It's not necessary. Use definition of PTR_INT_TYPE from obstack.h.
-rw-r--r--lib/canonicalize.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/canonicalize.c b/lib/canonicalize.c
index cfd3be60e..fd6de0559 100644
--- a/lib/canonicalize.c
+++ b/lib/canonicalize.c
@@ -38,9 +38,7 @@ void free ();
#include <sys/stat.h>
-#if HAVE_ERRNO_H
-# include <errno.h>
-#endif
+#include <errno.h>
#include "xalloc.h"
#include "xgetcwd.h"
@@ -55,11 +53,21 @@ extern int errno;
#if !HAVE_RESOLVEPATH
-# if HAVE_STDDEF_H
-# include <stddef.h>
-# define PTR_INT_TYPE ptrdiff_t
+/* If __PTRDIFF_TYPE__ is
+ defined, as with GNU C, use that; that way we don't pollute the
+ namespace with <stddef.h>'s symbols. Otherwise, if <stddef.h> is
+ available, include it and use ptrdiff_t. In traditional C, long is
+ the best that we can do. */
+
+# ifdef __PTRDIFF_TYPE__
+# define PTR_INT_TYPE __PTRDIFF_TYPE__
# else
-# define PTR_INT_TYPE long
+# ifdef HAVE_STDDEF_H
+# include <stddef.h>
+# define PTR_INT_TYPE ptrdiff_t
+# else
+# define PTR_INT_TYPE long
+# endif
# endif
# include "pathmax.h"