[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH 2] V2 Allocating large buffers on the stack was: Re: Subversion 1.2.0 RC3 (final candidate) on Monday?

From: Patrick Mayweg <mayweg_at_qint.de>
Date: 2005-05-09 08:56:58 CEST

Hi Jani,
thanks again for pointing that out. I have made a new patch.
Regards,
Patrick

Log message:
[[[
Use the pool memory instead of stack memory for big buffers in
svn_subst_translate_stream, which needs a new parameter.

* subversion/include/svn_subst.h
 (svn_subst_translate_stream) : add new apr_pool parameter.

* subversion/libsvn_subr/subst.c
 (svn_subst_translate_stream) : add new apr_pool parameter and use it
allocate
  a big buffer from that pool.
 (svn_subst_copy_and_translate2, svn_subst_copy_and_translate) : add pool
  parameter to svn_subst_translate_stream call.

* subversion/libsvn_wc/props.c
 (validate_eol_prop_against_file) : add pool parameter to
  svn_subst_translate_stream call.

* subversion/libsvn_client/cat.c
 (cat_local_file,svn_client_cat2) : add pool parameter to
  svn_subst_translate_stream call.
]]]

Jani Averbach wrote:

>On 2005-05-08 16:04+0200, Patrick Mayweg wrote:
>
>
>
>>Index: subversion/libsvn_subr/subst.c
>>===================================================================
>>--- subversion/libsvn_subr/subst.c (revision 14544)
>>+++ subversion/libsvn_subr/subst.c (working copy)
>>@@ -591,9 +591,10 @@
>> const char *eol_str,
>> svn_boolean_t repair,
>> const svn_subst_keywords_t *keywords,
>>- svn_boolean_t expand)
>>+ svn_boolean_t expand,
>>+ apr_pool_t *pool)
>> {
>>- char buf[SVN_STREAM_CHUNK_SIZE + 1];
>>+ char *buf = apr_palloc(pool, SVN_STREAM_CHUNK_SIZE + 1);
>> const char *p, *interesting;
>> apr_size_t len, readlen;
>> apr_size_t eol_str_len = eol_str ? strlen (eol_str) : 0;
>>
>>
>
>Same thing here, sizeof used with dynamically allocated buffer.
> ...
> readlen = sizeof (buf) - 1;
> while (readlen == sizeof (buf) - 1)
> ...
>
>BR, Jani
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon May 9 08:57:48 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.