summaryrefslogtreecommitdiff
path: root/main/ldb/strtoull.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/ldb/strtoull.patch')
-rw-r--r--main/ldb/strtoull.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/main/ldb/strtoull.patch b/main/ldb/strtoull.patch
new file mode 100644
index 00000000000..2fcd928a3d1
--- /dev/null
+++ b/main/ldb/strtoull.patch
@@ -0,0 +1,89 @@
+diff --git a/lib/replace/replace.c b/lib/replace/replace.c
+index 0652cb4..02b6ebf 100644
+--- a/lib/replace/replace.c
++++ b/lib/replace/replace.c
+@@ -559,41 +559,6 @@ long long int rep_strtoll(const char *str, char **endptr, int base)
+ #endif /* HAVE_STRTOLL */
+
+
+-#ifndef HAVE_STRTOULL
+-unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
+-{
+-#ifdef HAVE_STRTOUQ
+- return strtouq(str, endptr, base);
+-#elif defined(HAVE___STRTOULL)
+- return __strtoull(str, endptr, base);
+-#elif SIZEOF_LONG == SIZEOF_LONG_LONG
+- return (unsigned long long int) strtoul(str, endptr, base);
+-#else
+-# error "You need a strtoull function"
+-#endif
+-}
+-#else
+-#ifdef HAVE_BSD_STRTOLL
+-#undef strtoull
+-unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
+-{
+- int saved_errno = errno;
+- unsigned long long int nb = strtoull(str, endptr, base);
+- /* With glibc EINVAL is only returned if base is not ok */
+- if (errno == EINVAL) {
+- if (base == 0 || (base >1 && base <37)) {
+- /* Base was ok so it's because we were not
+- * able to make the conversion.
+- * Let's reset errno.
+- */
+- errno = saved_errno;
+- }
+- }
+- return nb;
+-}
+-#endif /* HAVE_BSD_STRTOLL */
+-#endif /* HAVE_STRTOULL */
+-
+ #ifndef HAVE_SETENV
+ int rep_setenv(const char *name, const char *value, int overwrite)
+ {
+diff --git a/lib/replace/replace.h b/lib/replace/replace.h
+index a8910e2..854b1a7 100644
+--- a/lib/replace/replace.h
++++ b/lib/replace/replace.h
+@@ -394,16 +394,6 @@ long long int rep_strtoll(const char *str, char **endptr, int base);
+ #endif
+ #endif
+
+-#ifndef HAVE_STRTOULL
+-#define strtoull rep_strtoull
+-unsigned long long int rep_strtoull(const char *str, char **endptr, int base);
+-#else
+-#ifdef HAVE_BSD_STRTOLL /* yes, it's not HAVE_BSD_STRTOULL */
+-#define strtoull rep_strtoull
+-unsigned long long int rep_strtoull(const char *str, char **endptr, int base);
+-#endif
+-#endif
+-
+ #ifndef HAVE_FTRUNCATE
+ #define ftruncate rep_ftruncate
+ int rep_ftruncate(int,off_t);
+diff --git a/lib/replace/wscript b/lib/replace/wscript
+index 4c774d9..a1dc6d0 100644
+--- a/lib/replace/wscript
++++ b/lib/replace/wscript
+@@ -411,7 +411,7 @@ def configure(conf):
+ conf.CHECK_FUNCS('initgroups pread pwrite strndup strcasestr strsep')
+ conf.CHECK_FUNCS('strtok_r mkdtemp dup2 dprintf vdprintf isatty chown lchown')
+ conf.CHECK_FUNCS('link readlink symlink realpath snprintf vsnprintf')
+- conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen strtoull __strtoull')
++ conf.CHECK_FUNCS('asprintf vasprintf setenv unsetenv strnlen')
+ conf.CHECK_FUNCS('strtouq strtoll __strtoll strtoq memalign posix_memalign')
+ conf.CHECK_FUNCS('fmemopen')
+
+@@ -866,7 +866,7 @@ REPLACEMENT_FUNCTIONS = {
+ 'memmove', 'strdup', 'setlinebuf', 'vsyslog', 'strnlen',
+ 'strndup', 'waitpid', 'seteuid', 'setegid', 'chroot',
+ 'mkstemp', 'mkdtemp', 'pread', 'pwrite', 'strcasestr',
+- 'strsep', 'strtok_r', 'strtoll', 'strtoull', 'setenv', 'unsetenv',
++ 'strsep', 'strtok_r', 'strtoll', 'setenv', 'unsetenv',
+ 'utime', 'utimes', 'dup2', 'chown', 'link', 'readlink',
+ 'symlink', 'lchown', 'realpath', 'memmem', 'vdprintf',
+ 'dprintf', 'get_current_dir_name', 'copy_file_range',