apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Knight <Christopher.D.Kni...@nasa.gov>
Subject apr_file_printf - fixed-length buffer and %s
Date Thu, 25 Mar 2004 23:08:26 GMT
We recently ran into an issue where we hit the limit of the buffer size
in apr_file_printf. A quick change to apr_file_puts(apr_psprintf(...
fixed the problem but it got me thinking:

1) The apr_file_io.h should mention this limitation. (It became obvious
after we noticed that apr_file_printf was not needing a pool.)

2) It seems to me that, with a rewrite, the buffer should only be
necessary for formatting numerical expansions (i.e. %03.2d) and that the
format string and "%s" expansions could be written directly to the file
and bypass a buffer. This should improve performance and ensure that the
buffer size limit is not an issue. (And a smaller buffer should be
acceptable?) I would be willing to take this re-write on, if I get the
blessing of the apr developers...




Mime
View raw message