Checkout
kotkov
committed
on 09 Oct
Adjust lifetime of the result returned from svn_repos__normalize_prop().

Previously, this function would make an unconditional copy of the … Show more
Adjust lifetime of the result returned from svn_repos__normalize_prop().

Previously, this function would make an unconditional copy of the value into

the result pool.  While this may look convenient in some of the cases, there

is a downside of making unnecessary copies even if no normalization happened.

Instead of that, let's give the calling site control over the results' lifetime

by not making the copy if the input did not change.  The callers may still dup()

the value if they need to, but with this approach there are no unavoidable

copies in various situations, such as where we would like to only update the

value if it changed or where we don't have an appropriate scratch pool, but

need to normalize the property value anyway.

* subversion/include/private/svn_repos_private.h

 (svn_repos__normalize_prop): Adjust documentation.

* subversion/libsvn_repos/fs-wrap.c

 (svn_repos__normalize_prop): Do not duplicate the input if no normalization

  is required.

* subversion/libsvn_repos/dump_editor.c

 (normalize_props): Adjust call to svn_repos__normalize_prop(), explicitly

  duplicate the property value into the result pool.

* subversion/svnrdump/load_editor.c

 (set_revision_property, set_node_property): Explicitly duplicate the property

  values into the long-living pool.

* subversion/svnrdump/util.c

 (svn_rdump__normalize_props): Adjust call to svn_repos__normalize_prop(),

  explicitly duplicate the property value into the result pool.

Show less