perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Apache::Util::size_string issues
Date Mon, 28 Jan 2002 06:26:21 GMT
Doug MacEachern wrote:

> On Fri, 25 Jan 2002, Stas Bekman wrote:

>>- size_string (has nothing to do with Apache
>>                or should it stay in Apache::Util?)
>>
> 
> it used to be a string version of ap_send_size(), which no longer exists
> in favor of the new apr_strfsize() function.  we should use that in 2.0
> and add a compat wrapper for Apache::Util::size_string.

OK, how about this then:

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);
}

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.

_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:stas@stason.org  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


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


Mime
View raw message