You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Rall <dl...@collab.net> on 2006/11/23 18:02:06 UTC

Re: svn commit: r22410 - in trunk: . subversion/libsvn_client

Alternately, you could memset() a stack-allocated
svn_client_commit_item2_t stucture to null out all of its field.

On Wed, 22 Nov 2006, glasser@tigris.org wrote:

> Author: glasser
> Date: Wed Nov 22 21:15:43 2006
> New Revision: 22410
> 
> Log:
> r21900 moved a pool-allocated svn_client_commit_item2_t to a stack
> variable; however, this meant that the structure was not zeroed out
> anymore, and so junk in the "path" field could cause the wrong line to
> be printed in the log message fetcher.  For consistency with every
> other use of svn_client_commit_item2_t in the codebase, move it back
> to the pool.
> 
> * subversion/libsvn_client/prop_commands.c
>   (propset_on_url): Allocate an svn_client_commit_item2_t in the heap.
> 
> 
> Modified:
>    trunk/   (props changed)
>    trunk/subversion/libsvn_client/prop_commands.c
> 
> Modified: trunk/subversion/libsvn_client/prop_commands.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/prop_commands.c?pathrev=22410&r1=22409&r2=22410
> ==============================================================================
> --- trunk/subversion/libsvn_client/prop_commands.c	(original)
> +++ trunk/subversion/libsvn_client/prop_commands.c	Wed Nov 22 21:15:43 2006
> @@ -247,14 +247,15 @@
>    /* Create a new commit item and add it to the array. */
>    if (ctx->log_msg_func || ctx->log_msg_func2)
>      {
> -      svn_client_commit_item2_t item;
> +      svn_client_commit_item2_t *item;
>        const char *tmp_file;
>        apr_array_header_t *commit_items 
> -        = apr_array_make(pool, 1, sizeof(&item));
> -      
> -      item.url = target;
> -      item.state_flags = SVN_CLIENT_COMMIT_ITEM_PROP_MODS;
> -      APR_ARRAY_PUSH(commit_items, svn_client_commit_item2_t *) = &item;
> +        = apr_array_make(pool, 1, sizeof(item));
> +     
> +      item = apr_pcalloc(pool, sizeof(*item));
> +      item->url = target;
> +      item->state_flags = SVN_CLIENT_COMMIT_ITEM_PROP_MODS;
> +      APR_ARRAY_PUSH(commit_items, svn_client_commit_item2_t *) = item;
>        SVN_ERR(svn_client__get_log_msg(&message, &tmp_file, commit_items,
>                                        ctx, pool));
>        if (! message)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org

Re: svn commit: r22410 - in trunk: . subversion/libsvn_client

Posted by David Glasser <gl...@mit.edu>.
Right, I know I can do that, but I figured consistency with every
other use of that type was reasonable.

--dave

On 11/23/06, Daniel Rall <dl...@collab.net> wrote:
> Alternately, you could memset() a stack-allocated
> svn_client_commit_item2_t stucture to null out all of its field.
>
> On Wed, 22 Nov 2006, glasser@tigris.org wrote:
>
> > Author: glasser
> > Date: Wed Nov 22 21:15:43 2006
> > New Revision: 22410
> >
> > Log:
> > r21900 moved a pool-allocated svn_client_commit_item2_t to a stack
> > variable; however, this meant that the structure was not zeroed out
> > anymore, and so junk in the "path" field could cause the wrong line to
> > be printed in the log message fetcher.  For consistency with every
> > other use of svn_client_commit_item2_t in the codebase, move it back
> > to the pool.
> >
> > * subversion/libsvn_client/prop_commands.c
> >   (propset_on_url): Allocate an svn_client_commit_item2_t in the heap.
> >
> >
> > Modified:
> >    trunk/   (props changed)
> >    trunk/subversion/libsvn_client/prop_commands.c
> >
> > Modified: trunk/subversion/libsvn_client/prop_commands.c
> > URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/prop_commands.c?pathrev=22410&r1=22409&r2=22410
> > ==============================================================================
> > --- trunk/subversion/libsvn_client/prop_commands.c    (original)
> > +++ trunk/subversion/libsvn_client/prop_commands.c    Wed Nov 22 21:15:43 2006
> > @@ -247,14 +247,15 @@
> >    /* Create a new commit item and add it to the array. */
> >    if (ctx->log_msg_func || ctx->log_msg_func2)
> >      {
> > -      svn_client_commit_item2_t item;
> > +      svn_client_commit_item2_t *item;
> >        const char *tmp_file;
> >        apr_array_header_t *commit_items
> > -        = apr_array_make(pool, 1, sizeof(&item));
> > -
> > -      item.url = target;
> > -      item.state_flags = SVN_CLIENT_COMMIT_ITEM_PROP_MODS;
> > -      APR_ARRAY_PUSH(commit_items, svn_client_commit_item2_t *) = &item;
> > +        = apr_array_make(pool, 1, sizeof(item));
> > +
> > +      item = apr_pcalloc(pool, sizeof(*item));
> > +      item->url = target;
> > +      item->state_flags = SVN_CLIENT_COMMIT_ITEM_PROP_MODS;
> > +      APR_ARRAY_PUSH(commit_items, svn_client_commit_item2_t *) = item;
> >        SVN_ERR(svn_client__get_log_msg(&message, &tmp_file, commit_items,
> >                                        ctx, pool));
> >        if (! message)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> > For additional commands, e-mail: svn-help@subversion.tigris.org
>
>
>


-- 
David Glasser | glasser@mit.edu | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org