bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

findutils-4.1.6/lib/strtoumax.c dirty;) patchfix


From: Oleg Borodin
Subject: findutils-4.1.6/lib/strtoumax.c dirty;) patchfix
Date: 15 Dec 2000 18:49:49 +0200

Hi!

package: findutils-4.1.6
Sustem: FreeBSD4.2
Problem: gfind . -mtime xxxx -xxxx ... core dump;-(
path-fix:
diff -dr -u12 findutils-4.1.6.orig/lib/strtoumax.c 
findutils-4.1.6/lib/strtoumax.c
--- findutils-4.1.6.orig/lib/strtoumax.c        Tue Oct 10 01:56:11 2000
+++ findutils-4.1.6/lib/strtoumax.c     Sun Nov 26 23:41:20 2000
@@ -39,37 +39,42 @@
 
 #if NEED_STRTOUL_DECL
 unsigned long strtoul PARAMS ((char const *, char **, int));
 #endif
 
 #if NEED_STRTOULL_DECL && HAVE_UNSIGNED_LONG_LONG
 unsigned long long strtoull PARAMS ((char const *, char **, int));
 #endif
 
 uintmax_t
 strtoumax (char const *ptr, char **endptr, int base)
 {
-#define USE_IF_EQUIVALENT(function) \
-    if (sizeof (uintmax_t) == sizeof function (ptr, endptr, base)) \
-      return function (ptr, endptr, base);
 
-#if HAVE_UNSIGNED_LONG_LONG
-    USE_IF_EQUIVALENT (strtoull)
+#if HAVE_DECL_STRTOULL && HAVE_UNSIGNED_LONG_LONG
+# define function strtoull
+#else /* HAVE_DECL_STRTOUL */
+/* The strtoul() function conforms to ISO 9899: 1990 (``ISO C''). */
+# define function strtoul
 #endif
 
-  USE_IF_EQUIVALENT (strtoul)
+  if (sizeof (uintmax_t) == sizeof function (ptr, endptr, base))
+    return function (ptr, endptr, base);
+  else 
+    return (uintmax_t)function (ptr, endptr, base);
 
   abort ();
 }
 
 #ifdef TESTING
 # include <stdio.h>
 int
 main ()
 {
   char *p, *endptr;
   printf ("sizeof uintmax_t: %d\n", sizeof (uintmax_t));
+#if HAVE_DECL_STRTOULL
   printf ("sizeof strtoull(): %d\n", sizeof strtoull(p, &endptr, 10));
+#endif
   printf ("sizeof strtoul(): %d\n", sizeof strtoul(p, &endptr, 10));
   exit (0);
 }
 #endif



-- 
Borodin Oleg
mailto:address@hidden
ph/fax:+7 0112 593459




reply via email to

[Prev in Thread] Current Thread [Next in Thread]