On 10/16/05, Kouhei Sutou <kou@cozmixng.org> wrote:
> Hi,
>
> I'm sorry for my unclear explain.
>
> In <df2177af0510152245v70ced4dbj40a113d03028ad31@mail.gmail.com>
> "Re: svn commit: r16735 - in trunk/subversion: libsvn_subr libsvn_wc" on Sun, 16 Oct 2005 01:45:13 -0400,
> David James <james82@gmail.com> wrote:
>
> > > > + *new_item = *item;
> > > > +
> > > > + if (new_item->path)
> > >
> > > if (new_item->kind && new_item->path)
> > >
> > > We need to check new_item->kind value is svn_node_none or
> > > not.
> > Really? I did not know this. Why?
>
> When item->kind is svn_node_none, item->path value may be
> not initialized.
>
> For example from mkdir_urls() in libsvn_client/commit.c:
>
> item = apr_pcalloc (pool, sizeof (*item));
> item->url = svn_path_join (common, path, pool);
> item->state_flags = SVN_CLIENT_COMMIT_ITEM_ADD;
>
> item->path and item->kind are not initialized. So
> item->path's value isn't ensured. But item->kind value
> is initialized as 0 (= svn_node_none) because
> svn_node_kind_t which is item->kind type is enum type.
Unlike apr_palloc, apr_pcalloc initalizes all fields to NULL, so
item->path, item->kind, and item->wcprop_changes are initialized to
NULL here.
Cheers,
David
--
David James -- http://www.cs.toronto.edu/~james
Received on Sun Oct 16 08:06:43 2005