Author: julianfoad Date: Mon Jul 17 09:26:23 2017 New Revision: 1802114 URL: http://svn.apache.org/viewvc?rev=1802114&view=rev Log: Add missing constructors for new types added in r1731163.
* subversion/include/svn_repos.h, subversion/libsvn_repos/log.c (svn_repos_path_change_t, svn_repos_log_entry_t): Note that the constructor should be used. (svn_repos_path_change_create, svn_repos_path_change_dup, svn_repos_log_entry_create, svn_repos_log_entry_dup): New. Modified: subversion/trunk/subversion/include/svn_repos.h subversion/trunk/subversion/libsvn_repos/log.c Modified: subversion/trunk/subversion/include/svn_repos.h URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_repos.h?rev=1802114&r1=1802113&r2=1802114&view=diff ============================================================================== --- subversion/trunk/subversion/include/svn_repos.h (original) +++ subversion/trunk/subversion/include/svn_repos.h Mon Jul 17 09:26:23 2017 @@ -1938,12 +1938,37 @@ svn_repos_node_location_segments(svn_rep * known, i.e. @a node_kind is never #svn_node_unknown and * @a copyfrom_known is always @c TRUE. * + * @note To allow for extending this structure in future releases, + * always use svn_repos_path_change_create() to allocate the stucture. + * * @see svn_fs_path_change3_t * * @since New in 1.10. */ typedef svn_fs_path_change3_t svn_repos_path_change_t; +/** + * Return an #svn_repos_path_change_t structure, allocated in @a result_pool, + * with all fields initialized to their respective null/none/empty/invalid + * values. + * + * @note To allow for extending the #svn_repos_path_change_t structure in + * future releases, this function should always be used to allocate it. + * + * @since New in 1.10. + */ +svn_repos_path_change_t * +svn_repos_path_change_create(apr_pool_t *result_pool); + +/** + * Return a deep copy of @a change, allocated in @a result_pool. + * + * @since New in 1.10. + */ +svn_repos_path_change_t * +svn_repos_path_change_dup(svn_repos_path_change_t *change, + apr_pool_t *result_pool); + /** The callback invoked by log message loopers, such as * svn_repos_get_logs5(). * @@ -1970,6 +1995,9 @@ typedef svn_error_t *(*svn_repos_path_ch /** * A structure to represent all the information about a particular log entry. * + * @note To allow for extending this structure in future releases, + * always use svn_repos_log_entry_create() to allocate the stucture. + * * @since New in 1.10. */ typedef struct svn_repos_log_entry_t @@ -2016,6 +2044,27 @@ typedef struct svn_repos_log_entry_t /* NOTE: Add new fields at the end to preserve binary compatibility. */ } svn_repos_log_entry_t; +/** + * Return an #svn_repos_log_entry_t, allocated in @a result_pool, + * with all fields initialized to their respective null/none/empty/invalid + * values. + * + * @note To allow for extending the #svn_repos_log_entry_t structure in + * future releases, this function should always be used to allocate it. + * + * @since New in 1.10. + */ +svn_repos_log_entry_t * +svn_repos_log_entry_create(apr_pool_t *result_pool); + +/** Return a deep copy of @a log_entry, allocated in @a result_pool. + * + * @since New in 1.10. + */ +svn_repos_log_entry_t * +svn_repos_log_entry_dup(const svn_repos_log_entry_t *log_entry, + apr_pool_t *result_pool); + /** The callback invoked by log message loopers, such as * svn_repos_get_logs5(). Modified: subversion/trunk/subversion/libsvn_repos/log.c URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_repos/log.c?rev=1802114&r1=1802113&r2=1802114&view=diff ============================================================================== --- subversion/trunk/subversion/libsvn_repos/log.c (original) +++ subversion/trunk/subversion/libsvn_repos/log.c Mon Jul 17 09:26:23 2017 @@ -58,6 +58,57 @@ typedef struct log_callbacks_t void *authz_read_baton; } log_callbacks_t; + +svn_repos_path_change_t * +svn_repos_path_change_create(apr_pool_t *result_pool) +{ + svn_repos_path_change_t *change = apr_pcalloc(result_pool, sizeof(*change)); + + change->path.data = ""; + change->change_kind = svn_fs_path_change_reset; + change->mergeinfo_mod = svn_tristate_unknown; + change->copyfrom_rev = SVN_INVALID_REVNUM; + + return change; +} + +svn_repos_path_change_t * +svn_repos_path_change_dup(svn_repos_path_change_t *change, + apr_pool_t *result_pool) +{ + svn_repos_path_change_t *new_change = apr_pmemdup(result_pool, change, + sizeof(*new_change)); + + new_change->path.data = apr_pstrmemdup(result_pool, change->path.data, + change->path.len); + if (change->copyfrom_path) + new_change->copyfrom_path = apr_pstrdup(result_pool, + change->copyfrom_path); + + return new_change; +} + +svn_repos_log_entry_t * +svn_repos_log_entry_create(apr_pool_t *result_pool) +{ + svn_repos_log_entry_t *log_entry = apr_pcalloc(result_pool, + sizeof(*log_entry)); + + return log_entry; +} + +svn_repos_log_entry_t * +svn_repos_log_entry_dup(const svn_repos_log_entry_t *log_entry, + apr_pool_t *result_pool) +{ + svn_repos_log_entry_t *new_entry = apr_pmemdup(result_pool, log_entry, + sizeof(*new_entry)); + + if (log_entry->revprops) + new_entry->revprops = svn_prop_hash_dup(log_entry->revprops, result_pool); + + return new_entry; +} svn_error_t * svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,