httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <ad...@rowe-clan.net>
Subject Re: [PATCH] APR_INT64_T_FMT addition and modified AB
Date Thu, 12 Apr 2001 01:52:19 GMT

----- Original Message ----- 
From: "Justin Erenkrantz" <jerenkrantz@ebuilt.com>
To: <dev@apr.apache.org>; <new-httpd@apache.org>
Sent: Wednesday, April 11, 2001 6:46 PM
Subject: [PATCH] APR_INT64_T_FMT addition and modified AB


> This syncs up Unix with Win32 (wow!) as far as having APR_INT64_T_FMT.
> include/apr.hw has it defined, but include/apr.h doesn't.  This is a
> first pass at getting the logic right.

Index: configure.in
===================================================================
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.288
diff -u -r1.288 configure.in
--- configure.in 2001/04/09 16:40:19 1.288
+++ configure.in 2001/04/11 23:25:24
@@ -646,6 +646,14 @@
     socklen_t_value="int"
 fi
 
+if test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_int"; then
+    int64_t_fmt='#define APR_INT64_T_FMT "d"'
+elif test "$ac_cv_sizeof_long_long" = "$ac_cv_sizeof_long"; then
+    int64_t_fmt='#define APR_INT64_T_FMT "ld"'
+else
+    int64_t_fmt='#define APR_INT64_T_FMT "lld"'
+fi
+

This is perpetuating the old problem... you need to back up and start by 
defining what _is_ an apr_int64_t... something we have never done 
correctly.  Your logic above is getting there, but we can't assume 
long_long on all platforms (I don't believe.)  Need to get apr_int64_t 
defined right, then proceed.

if apr_int64_t is an int, don't define it as long_long.  And don't even
bother testing for the sizeof_long_long vs. sizeof_int, just compare each
type to the sizeof constant 8 :-)

> Does anyone have any ideas for mimicing LLONG_MAX on machines that
> don't have limits.h?  I dread using the 999999 that was there before in
> ab - I'd like to replace this with something more sane.  We could do:
> 
> #ifndef LLONG_MAX
> #define APR_INT64_MAX 0x7fffffffffffffffLL
> #else
> #define APR_INT64_MAX LLONG_MAX
> #endif

We have a wrapper APR_INT64_C(0x7fffffffffffffff) that is used to tack on the 
appropriate L/LL (or on win32, i64) suffix.  It needs a little more refinement
as well.

Nail those three, and I think you have it.

I put out this patch a week ago, I don't know if it will so much as compile,
but you can hack your work above with the __int64 stuff and I think we should
be all rounded out :-)


Mime
View raw message