Bugzilla – Attachment 1089 Details for
Bug 1171
configure can't always figure out LLONG_MAX.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
reinvent the "%lld" wheel of printf.
openssh-config-llong_max.patch (text/plain), 2.10 KB, created by
Darren Tucker
on 2006-03-03 16:42:17 AEDT
(
hide
)
Description:
reinvent the "%lld" wheel of printf.
Filename:
MIME Type:
Creator:
Darren Tucker
Created:
2006-03-03 16:42:17 AEDT
Size:
2.10 KB
patch
obsolete
>Index: configure.ac >=================================================================== >RCS file: /usr/local/src/security/openssh/cvs/openssh_cvs/configure.ac,v >retrieving revision 1.332 >diff -u -p -r1.332 configure.ac >--- configure.ac 26 Feb 2006 01:31:49 -0000 1.332 >+++ configure.ac 3 Mar 2006 02:11:21 -0000 >@@ -2132,6 +2132,34 @@ if test -z "$have_llong_max"; then > #define __USE_ISOC99 > #include <limits.h> > #define DATA "conftest.llminmax" >+#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a)) >+ >+/* >+ * printf in libc on some platforms (eg old Tru64) does not understand %lld so >+ * we do this the hard way. >+ */ >+static int >+fprint_ll(FILE *f, long long n) >+{ >+ unsigned int i; >+ int l[sizeof(long long) * 8]; >+ >+ if (n < 0) >+ if (fprintf(f, "-") < 0) >+ return -1; >+ for (i = 0; n != 0; i++) { >+ l[i] = my_abs(n % 10); >+ n /= 10; >+ } >+ do { >+ if (fprintf(f, "%d", l[--i]) < 0) >+ return -1; >+ } while (i != 0); >+ if (fprintf(f, " ") < 0) >+ return -1; >+ return 0; >+} >+ > int main(void) { > FILE *f; > long long i, llmin, llmax = 0; >@@ -2153,14 +2181,18 @@ int main(void) { > > /* Sanity check */ > if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax >- || llmax - 1 > llmax) { >+ || llmax - 1 > llmax || llmin == llmax || llmin == 0 >+ || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) { > fprintf(f, "unknown unknown\n"); > exit(2); > } > >- if (fprintf(f ,"%lld %lld", llmin, llmax) < 0) >+ if (fprint_ll(f, llmin) < 0) > exit(3); >- >+ if (fprint_ll(f, llmax) < 0) >+ exit(4); >+ if (fclose(f) < 0) >+ exit(5); > exit(0); > } > ]])], >@@ -2168,17 +2200,6 @@ int main(void) { > llong_min=`$AWK '{print $1}' conftest.llminmax` > llong_max=`$AWK '{print $2}' conftest.llminmax` > >- # snprintf on some Tru64s doesn't understand "%lld" >- case "$host" in >- alpha-dec-osf*) >- if test "x$ac_cv_sizeof_long_long_int" = "x8" && >- test "x$llong_max" = "xld"; then >- llong_min="-9223372036854775808" >- llong_max="9223372036854775807" >- fi >- ;; >- esac >- > AC_MSG_RESULT($llong_max) > AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL], > [max value of long long calculated by configure])
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
djm
:
ok+
Actions:
View
|
Diff
Attachments on
bug 1171
: 1089 |
1090