perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject Re: Apache::Util::size_string issues
Date Tue, 29 Jan 2002 05:04:01 GMT
On Mon, 28 Jan 2002, Stas Bekman wrote:
 
> static MP_INLINE
> SV *mpxs_Apache__Util_size_string(pTHX_ apr_off_t  size)
> {
>      char buff[5];
> 
>      apr_strfsize(size, buff);
> 
>      return newSVpvn(buff, 4);
> }

that'd be fine.  i'd probably use mpxs_set_targ instead, but that can be
later.

> we want it to be perlish, right?
> 
> there is a problem with apr_off_t since we typedef it as IV, therefore 
> if you try:
> 
>   Apache::Util::size_string(42_000_000_000);
> 
> it looses data when converting from NV or PV to IV. Which means that we 
> can use this function only up to 1G numbers or so. Doesn't sound good.
> 
> Also apr_strfsize is in the APR::Strings module in the map file. Should 
> we have APR::Strings::strfsize instead of Apache__Util_size_string.

normally off_t is the same size as IV, you'd have to compile apache with
largefile flags to make it bigger.  might be better to change apr_strftime
to use a type that can always hold a bigger number.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message