changeset 5866:d284693d309c

* lib/canonicalize.c: Include canonicalize.h first, to test interface. Include <stddef.h> unconditionally, since we assume C89 now. All uses of PTR_INT_TYPE replaced by ptrdiff_t. * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME]): Don't check for stddef.h.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 18 May 2005 19:46:16 +0000
parents b56e4ab06e2e
children 67b499052f7f
files lib/canonicalize.c m4/canonicalize.m4
diffstat 2 files changed, 6 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/lib/canonicalize.c
+++ b/lib/canonicalize.c
@@ -20,6 +20,8 @@
 # include <config.h>
 #endif
 
+#include "canonicalize.h"
+
 #ifdef STDC_HEADERS
 # include <stdlib.h>
 #else
@@ -43,6 +45,7 @@
 #endif
 
 #include <errno.h>
+#include <stddef.h>
 
 #include "cycle-check.h"
 #include "path-concat.h"
@@ -54,24 +57,6 @@
 # define __set_errno(Val) errno = (Val)
 #endif
 
-/* 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
-# ifdef HAVE_STDDEF_H
-#  include <stddef.h>
-#  define PTR_INT_TYPE ptrdiff_t
-# else
-#  define PTR_INT_TYPE long
-# endif
-#endif
-
-#include "canonicalize.h"
 #include "pathmax.h"
 #include "xreadlink.h"
 
@@ -230,7 +215,7 @@
 
 	  if (dest + (end - start) >= rpath_limit)
 	    {
-	      PTR_INT_TYPE dest_offset = dest - rpath;
+	      ptrdiff_t dest_offset = dest - rpath;
 	      size_t new_size = rpath_limit - rpath;
 
 	      if (end - start + 1 > PATH_MAX)
--- a/m4/canonicalize.m4
+++ b/m4/canonicalize.m4
@@ -1,4 +1,4 @@
-#serial 7
+#serial 8
 
 # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -13,6 +13,6 @@
     AC_LIBOBJ([canonicalize])
 
     AC_REQUIRE([AC_HEADER_STDC])
-    AC_CHECK_HEADERS(string.h sys/param.h stddef.h)
+    AC_CHECK_HEADERS(string.h sys/param.h)
     AC_CHECK_FUNCS(resolvepath canonicalize_file_name)
   ])