]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Added more fallbacks if strtoll() or strtoull() isn't implemented
authorTimo Sirainen <tss@iki.fi>
Thu, 12 Jun 2008 20:31:51 +0000 (23:31 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 12 Jun 2008 20:31:51 +0000 (23:31 +0300)
(e.g. HP-UX).

--HG--
branch : HEAD

configure.in
src/lib/compat.c
src/lib/compat.h

index 1fcf7da11a051d047ccb4e2467f3d33b6ee0d3a4..8fb53571d333a5479fd4fd3278e9b28125c65ec4 100644 (file)
@@ -15,7 +15,7 @@ AC_C_INLINE
 AC_PROG_LIBTOOL
 AM_ICONV
 
-AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h malloc.h \
+AC_CHECK_HEADERS(strings.h stdint.h unistd.h dirent.h malloc.h inttypes.h \
   sys/uio.h sys/sysmacros.h sys/resource.h sys/select.h libgen.h \
   sys/quota.h sys/fs/ufs_quota.h ufs/ufs/quota.h jfs/quota.h \
   mntent.h sys/mnttab.h sys/event.h sys/time.h sys/mkdev.h linux/dqblk_xfs.h \
@@ -429,9 +429,9 @@ dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
 AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
                strcasecmp stricmp vsyslog writev pread \
               setrlimit setproctitle seteuid setreuid setegid setresgid \
-              strtoull strtouq setpriority quotactl getmntent kqueue kevent \
-              backtrace_symbols walkcontext dirfd clearenv \
-              malloc_usable_size)
+              strtoull strtoll strtoumax strtoimax strtouq strtoq \
+              setpriority quotactl getmntent kqueue kevent backtrace_symbols \
+              walkcontext dirfd clearenv malloc_usable_size)
 
 dnl * I/O loop function
 have_ioloop=no
index 29cfa494d3cf5703647a7c7dc446e5b061862bef..57e24b65247effd5195c99295ef41cfe60ad192f 100644 (file)
@@ -17,6 +17,9 @@
 #include <ctype.h>
 #include <unistd.h>
 #include <syslog.h>
+#ifdef HAVE_INTTYPES_H
+#  include <inttypes.h> /* for strtoimax() and strtoumax() */
+#endif
 
 #ifndef INADDR_NONE
 #  define INADDR_NONE INADDR_BROADCAST
@@ -201,7 +204,9 @@ char *my_basename(char *path)
 #ifndef HAVE_STRTOULL
 unsigned long long int my_strtoull(const char *nptr, char **endptr, int base)
 {
-#ifdef HAVE_STRTOUQ
+#ifdef HAVE_STRTOUMAX
+       return strtoumax(nptr, endptr, base);
+#elif defined(HAVE_STRTOUQ)
        return strtouq(nptr, endptr, base);
 #else
        unsigned long ret = 0;
@@ -220,3 +225,16 @@ unsigned long long int my_strtoull(const char *nptr, char **endptr, int base)
 #endif
 }
 #endif
+
+#ifndef HAVE_STRTOLL
+unsigned long long int my_strtoll(const char *nptr, char **endptr, int base)
+{
+#ifdef HAVE_STRTOIMAX 
+       return strtoimax(nptr, endptr, base);
+#elif defined (HAVE_STRTOQ)
+       return strtoq(nptr, endptr, base);
+#else
+       i_panic("strtoll() not implemented");
+#endif
+}
+#endif
index 1e765826793a3127a04bd2acf8fd0af33bd15057..960d1a18a7c9c59725d0cb26ee8f98b4d045da77 100644 (file)
@@ -188,6 +188,10 @@ char *my_basename(char *path);
 #  define strtoull my_strtoull
 unsigned long long int my_strtoull(const char *nptr, char **endptr, int base);
 #endif
+#ifndef HAVE_STRTOLL
+#  define strtoll my_strtoll
+unsigned long long int my_strtoll(const char *nptr, char **endptr, int base);
+#endif
 
 /* ctype.h isn't safe with signed chars,
    use our own instead if really needed */