Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/caching.c URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/caching.c?rev=1653578&r1=1653577&r2=1653578&view=diff ============================================================================== --- subversion/branches/pin-externals/subversion/libsvn_fs_x/caching.c (original) +++ subversion/branches/pin-externals/subversion/libsvn_fs_x/caching.c Wed Jan 21 16:22:19 2015 @@ -43,15 +43,16 @@ #include "private/svn_subr_private.h" /* Take the ORIGINAL string and replace all occurrences of ":" without - * limiting the key space. Allocate the result in POOL. + * limiting the key space. Allocate the result in RESULT_POOL. */ static const char * normalize_key_part(const char *original, - apr_pool_t *pool) + apr_pool_t *result_pool) { apr_size_t i; apr_size_t len = strlen(original); - svn_stringbuf_t *normalized = svn_stringbuf_create_ensure(len, pool); + svn_stringbuf_t *normalized = svn_stringbuf_create_ensure(len, + result_pool); for (i = 0; i < len; ++i) { @@ -73,15 +74,14 @@ normalize_key_part(const char *original, according to FS->CONFIG. *CACHE_NAMESPACE receives the cache prefix to use. - Use FS->pool for allocating the memcache and CACHE_NAMESPACE, and POOL - for temporary allocations. */ + Allocate CACHE_NAMESPACE in RESULT_POOL. */ static svn_error_t * read_config(const char **cache_namespace, svn_boolean_t *cache_txdeltas, svn_boolean_t *cache_fulltexts, svn_boolean_t *cache_revprops, svn_fs_t *fs, - apr_pool_t *pool) + apr_pool_t *result_pool) { /* No cache namespace by default. I.e. all FS instances share the * cached data. If you specify different namespaces, the data will @@ -97,7 +97,7 @@ read_config(const char **cache_namespace = normalize_key_part(svn_hash__get_cstring(fs->config, SVN_FS_CONFIG_FSFS_CACHE_NS, ""), - pool); + result_pool); /* don't cache text deltas by default. * Once we reconstructed the fulltexts from the deltas, @@ -172,21 +172,21 @@ warn_and_fail_on_cache_errors(svn_error_ #ifdef SVN_DEBUG_CACHE_DUMP_STATS /* Baton to be used for the dump_cache_statistics() pool cleanup function, */ -struct dump_cache_baton_t +typedef struct dump_cache_baton_t { /* the pool about to be cleaned up. Will be used for temp. allocations. */ apr_pool_t *pool; /* the cache to dump the statistics for */ svn_cache__t *cache; -}; +} dump_cache_baton_t; /* APR pool cleanup handler that will printf the statistics of the cache referenced by the baton in BATON_VOID. */ static apr_status_t dump_cache_statistics(void *baton_void) { - struct dump_cache_baton_t *baton = baton_void; + dump_cache_baton_t *baton = baton_void; apr_status_t result = APR_SUCCESS; svn_cache__info_t info; @@ -267,7 +267,7 @@ init_callbacks(svn_cache__t *cache, /* schedule printing the access statistics upon pool cleanup, * i.e. end of FSX session. */ - struct dump_cache_baton_t *baton; + dump_cache_baton_t *baton; baton = apr_palloc(pool, sizeof(*baton)); baton->pool = pool; @@ -357,12 +357,13 @@ create_cache(svn_cache__t **cache_p, svn_error_t * svn_fs_x__initialize_caches(svn_fs_t *fs, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; - const char *prefix = apr_pstrcat(pool, + svn_fs_x__data_t *ffd = fs->fsap_data; + const char *prefix = apr_pstrcat(scratch_pool, "fsx:", fs->uuid, - "/", normalize_key_part(fs->path, pool), + "/", normalize_key_part(fs->path, + scratch_pool), ":", SVN_VA_NULL); svn_membuffer_t *membuffer; @@ -378,9 +379,10 @@ svn_fs_x__initialize_caches(svn_fs_t *fs &cache_fulltexts, &cache_revprops, fs, - pool)); + scratch_pool)); - prefix = apr_pstrcat(pool, "ns:", cache_namespace, ":", prefix, SVN_VA_NULL); + prefix = apr_pstrcat(scratch_pool, "ns:", cache_namespace, ":", prefix, + SVN_VA_NULL); membuffer = svn_cache__get_global_membuffer_cache(); @@ -405,27 +407,6 @@ svn_fs_x__initialize_caches(svn_fs_t *fs apr_pool_cleanup_null); #endif - /* Make the cache for revision roots. For the vast majority of - * commands, this is only going to contain a few entries (svnadmin - * dump/verify is an exception here), so to reduce overhead let's - * try to keep it to just one page. I estimate each entry has about - * 72 bytes of overhead (svn_revnum_t key, svn_fs_id_t + - * id_private_t + 3 strings for value, and the cache_entry); the - * default pool size is 8192, so about a hundred should fit - * comfortably. */ - SVN_ERR(create_cache(&(ffd->rev_root_id_cache), - NULL, - membuffer, - 1, 100, - svn_fs_x__serialize_id, - svn_fs_x__deserialize_id, - sizeof(svn_revnum_t), - apr_pstrcat(pool, prefix, "RRI", SVN_VA_NULL), - 0, - fs, - no_handler, - fs->pool, pool)); - /* Rough estimate: revision DAG nodes have size around 320 bytes, so * let's put 16 on a page. */ SVN_ERR(create_cache(&(ffd->rev_node_cache), @@ -435,11 +416,11 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__dag_serialize, svn_fs_x__dag_deserialize, APR_HASH_KEY_STRING, - apr_pstrcat(pool, prefix, "DAG", SVN_VA_NULL), + apr_pstrcat(scratch_pool, prefix, "DAG", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* 1st level DAG node cache */ ffd->dag_node_cache = svn_fs_x__create_dag_cache(fs->pool); @@ -451,12 +432,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 1024, 8, svn_fs_x__serialize_dir_entries, svn_fs_x__deserialize_dir_entries, - sizeof(svn_fs_x__id_part_t), - apr_pstrcat(pool, prefix, "DIR", SVN_VA_NULL), + sizeof(svn_fs_x__id_t), + apr_pstrcat(scratch_pool, prefix, "DIR", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* Only 16 bytes per entry (a revision number + the corresponding offset). Since we want ~8k pages, that means 512 entries per page. */ @@ -467,12 +448,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_manifest, svn_fs_x__deserialize_manifest, sizeof(svn_revnum_t), - apr_pstrcat(pool, prefix, "PACK-MANIFEST", + apr_pstrcat(scratch_pool, prefix, "PACK-MANIFEST", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* initialize node revision cache, if caching has been enabled */ SVN_ERR(create_cache(&(ffd->node_revision_cache), @@ -481,12 +462,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 32, 32, /* ~200 byte / entry; 1k entries total */ svn_fs_x__serialize_node_revision, svn_fs_x__deserialize_node_revision, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "NODEREVS", SVN_VA_NULL), + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "NODEREVS", + SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* initialize representation header cache, if caching has been enabled */ SVN_ERR(create_cache(&(ffd->rep_header_cache), @@ -495,12 +477,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 1, 1000, /* ~8 bytes / entry; 1k entries total */ svn_fs_x__serialize_rep_header, svn_fs_x__deserialize_rep_header, - sizeof(representation_cache_key_t), - apr_pstrcat(pool, prefix, "REPHEADER", SVN_VA_NULL), + sizeof(svn_fs_x__representation_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "REPHEADER", + SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* initialize node change list cache, if caching has been enabled */ SVN_ERR(create_cache(&(ffd->changes_cache), @@ -510,11 +493,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_changes, svn_fs_x__deserialize_changes, sizeof(svn_revnum_t), - apr_pstrcat(pool, prefix, "CHANGES", SVN_VA_NULL), + apr_pstrcat(scratch_pool, prefix, "CHANGES", + SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); /* if enabled, cache fulltext and other derived information */ if (cache_fulltexts) @@ -525,12 +509,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ /* Values are svn_stringbuf_t */ NULL, NULL, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "TEXT", SVN_VA_NULL), + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "TEXT", + SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->properties_cache), NULL, @@ -538,13 +523,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_properties, svn_fs_x__deserialize_properties, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "PROP", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "PROP", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->mergeinfo_cache), NULL, @@ -553,12 +538,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_mergeinfo, svn_fs_x__deserialize_mergeinfo, APR_HASH_KEY_STRING, - apr_pstrcat(pool, prefix, "MERGEINFO", + apr_pstrcat(scratch_pool, prefix, "MERGEINFO", SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->mergeinfo_existence_cache), NULL, @@ -567,12 +552,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs /* Values are svn_stringbuf_t */ NULL, NULL, APR_HASH_KEY_STRING, - apr_pstrcat(pool, prefix, "HAS_MERGEINFO", + apr_pstrcat(scratch_pool, prefix, "HAS_MERGEINFO", SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); } else { @@ -591,13 +576,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_properties, svn_fs_x__deserialize_properties, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "REVPROP", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "REVPROP", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_DEFAULT_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); } else { @@ -613,13 +598,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_txdelta_window, svn_fs_x__deserialize_txdelta_window, - sizeof(window_cache_key_t), - apr_pstrcat(pool, prefix, "TXDELTA_WINDOW", + sizeof(svn_fs_x__window_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "TXDELTA_WINDOW", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->combined_window_cache), NULL, @@ -627,13 +612,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 0, 0, /* Do not use inprocess cache */ /* Values are svn_stringbuf_t */ NULL, NULL, - sizeof(window_cache_key_t), - apr_pstrcat(pool, prefix, "COMBINED_WINDOW", + sizeof(svn_fs_x__window_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "COMBINED_WINDOW", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_LOW_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); } else { @@ -647,39 +632,39 @@ svn_fs_x__initialize_caches(svn_fs_t *fs 16, 4, /* Important, largish objects */ svn_fs_x__serialize_noderevs_container, svn_fs_x__deserialize_noderevs_container, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "NODEREVSCNT", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "NODEREVSCNT", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->changes_container_cache), NULL, membuffer, 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_changes_container, svn_fs_x__deserialize_changes_container, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "CHANGESCNT", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "CHANGESCNT", SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->reps_container_cache), NULL, membuffer, 0, 0, /* Do not use inprocess cache */ svn_fs_x__serialize_reps_container, svn_fs_x__deserialize_reps_container, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "REPSCNT", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "REPSCNT", SVN_VA_NULL), 0, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->l2p_header_cache), NULL, @@ -688,13 +673,13 @@ svn_fs_x__initialize_caches(svn_fs_t *fs a reasonable number of revisions (1k) */ svn_fs_x__serialize_l2p_header, svn_fs_x__deserialize_l2p_header, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "L2P_HEADER", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "L2P_HEADER", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->l2p_page_cache), NULL, membuffer, @@ -703,25 +688,25 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_l2p_page, svn_fs_x__deserialize_l2p_page, sizeof(svn_fs_x__page_cache_key_t), - apr_pstrcat(pool, prefix, "L2P_PAGE", + apr_pstrcat(scratch_pool, prefix, "L2P_PAGE", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->p2l_header_cache), NULL, membuffer, 4, 1, /* Large entries. Rarely used. */ svn_fs_x__serialize_p2l_header, svn_fs_x__deserialize_p2l_header, - sizeof(pair_cache_key_t), - apr_pstrcat(pool, prefix, "P2L_HEADER", + sizeof(svn_fs_x__pair_cache_key_t), + apr_pstrcat(scratch_pool, prefix, "P2L_HEADER", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); SVN_ERR(create_cache(&(ffd->p2l_page_cache), NULL, membuffer, @@ -729,12 +714,12 @@ svn_fs_x__initialize_caches(svn_fs_t *fs svn_fs_x__serialize_p2l_page, svn_fs_x__deserialize_p2l_page, sizeof(svn_fs_x__page_cache_key_t), - apr_pstrcat(pool, prefix, "P2L_PAGE", + apr_pstrcat(scratch_pool, prefix, "P2L_PAGE", SVN_VA_NULL), SVN_CACHE__MEMBUFFER_HIGH_PRIORITY, fs, no_handler, - fs->pool, pool)); + fs->pool, scratch_pool)); return SVN_NO_ERROR; }
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/changes.c URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/changes.c?rev=1653578&r1=1653577&r2=1653578&view=diff ============================================================================== --- subversion/branches/pin-externals/subversion/libsvn_fs_x/changes.c (original) +++ subversion/branches/pin-externals/subversion/libsvn_fs_x/changes.c Wed Jan 21 16:22:19 2015 @@ -79,9 +79,7 @@ typedef struct binary_change_t /* Relevant parts of the node revision ID of the change. * Empty, if REV_ID is not "used". */ - svn_fs_x__id_part_t node_id; - svn_fs_x__id_part_t copy_id; - svn_fs_x__id_part_t noderev_id; + svn_fs_x__id_t noderev_id; } binary_change_t; @@ -104,19 +102,19 @@ struct svn_fs_x__changes_t apr_array_header_t *offsets; }; -/* Create and return a new container object, allocated in POOL and with - * and initial capacity of INITIAL_COUNT changes. The PATH and BUILDER +/* Create and return a new container object, allocated in RESULT_POOL with + * an initial capacity of INITIAL_COUNT changes. The PATH and BUILDER * members must be initialized by the caller afterwards. */ static svn_fs_x__changes_t * changes_create_body(apr_size_t initial_count, - apr_pool_t *pool) + apr_pool_t *result_pool) { - svn_fs_x__changes_t *changes = apr_pcalloc(pool, sizeof(*changes)); + svn_fs_x__changes_t *changes = apr_pcalloc(result_pool, sizeof(*changes)); - changes->changes = apr_array_make(pool, (int)initial_count, + changes->changes = apr_array_make(result_pool, (int)initial_count, sizeof(binary_change_t)); - changes->offsets = apr_array_make(pool, 16, sizeof(int)); + changes->offsets = apr_array_make(result_pool, 16, sizeof(int)); APR_ARRAY_PUSH(changes->offsets, int) = 0; return changes; @@ -124,10 +122,11 @@ changes_create_body(apr_size_t initial_c svn_fs_x__changes_t * svn_fs_x__changes_create(apr_size_t initial_count, - apr_pool_t *pool) + apr_pool_t *result_pool) { - svn_fs_x__changes_t *changes = changes_create_body(initial_count, pool); - changes->builder = svn_fs_x__string_table_builder_create(pool); + svn_fs_x__changes_t *changes = changes_create_body(initial_count, + result_pool); + changes->builder = svn_fs_x__string_table_builder_create(result_pool); return changes; } @@ -136,24 +135,25 @@ svn_fs_x__changes_create(apr_size_t init */ static svn_error_t * append_change(svn_fs_x__changes_t *changes, - change_t *change) + svn_fs_x__change_t *change) { binary_change_t binary_change = { 0 }; svn_boolean_t is_txn_id; - svn_fs_path_change2_t *info; /* CHANGE must be sufficiently complete */ SVN_ERR_ASSERT(change); SVN_ERR_ASSERT(change->path.data); + /* Relevant parts of the revision ID of the change. */ + binary_change.noderev_id = change->noderev_id; + /* define the kind of change and what specific information is present */ - info = &change->info; - is_txn_id = info->node_rev_id && svn_fs_x__id_is_txn(info->node_rev_id); - binary_change.flags = (info->text_mod ? CHANGE_TEXT_MOD : 0) - | (info->prop_mod ? CHANGE_PROP_MOD : 0) + is_txn_id = svn_fs_x__is_txn(binary_change.noderev_id.change_set); + binary_change.flags = (change->text_mod ? CHANGE_TEXT_MOD : 0) + | (change->prop_mod ? CHANGE_PROP_MOD : 0) | (is_txn_id ? CHANGE_TXN_NODE : 0) - | ((int)info->change_kind << CHANGE_KIND_SHIFT) - | ((int)info->node_kind << CHANGE_NODE_SHIFT); + | ((int)change->change_kind << CHANGE_KIND_SHIFT) + | ((int)change->node_kind << CHANGE_NODE_SHIFT); /* Path of the change. */ binary_change.path @@ -162,12 +162,12 @@ append_change(svn_fs_x__changes_t *chang change->path.len); /* copy-from information, if presence is indicated by FLAGS */ - if (SVN_IS_VALID_REVNUM(info->copyfrom_rev)) + if (SVN_IS_VALID_REVNUM(change->copyfrom_rev)) { - binary_change.copyfrom_rev = info->copyfrom_rev; + binary_change.copyfrom_rev = change->copyfrom_rev; binary_change.copyfrom_path = svn_fs_x__string_table_builder_add(changes->builder, - info->copyfrom_path, + change->copyfrom_path, 0); } else @@ -176,19 +176,6 @@ append_change(svn_fs_x__changes_t *chang binary_change.copyfrom_path = 0; } - /* Relevant parts of the revision ID of the change. */ - if (info->node_rev_id) - { - binary_change.node_id = *svn_fs_x__id_node_id(info->node_rev_id); - binary_change.copy_id = *svn_fs_x__id_copy_id(info->node_rev_id); - binary_change.noderev_id = *svn_fs_x__id_noderev_id(info->node_rev_id); - } - else - { - binary_change.noderev_id.number = 0; - binary_change.noderev_id.change_set = SVN_FS_X__INVALID_CHANGE_SET; - } - APR_ARRAY_PUSH(changes->changes, binary_change_t) = binary_change; return SVN_NO_ERROR; @@ -207,7 +194,7 @@ svn_fs_x__changes_append_list(apr_size_t /* simply append the list and all changes */ for (i = 0; i < list->nelts; ++i) - append_change(changes, APR_ARRAY_IDX(list, i, change_t *)); + append_change(changes, APR_ARRAY_IDX(list, i, svn_fs_x__change_t *)); /* terminate the list by storing the next changes offset */ APR_ARRAY_PUSH(changes->offsets, int) = changes->changes->nelts; @@ -259,44 +246,40 @@ svn_fs_x__changes_get_list(apr_array_hea last = APR_ARRAY_IDX(changes->offsets, (int)idx + 1, int); /* construct result */ - *list = apr_array_make(pool, last - first, sizeof(change_t*)); + *list = apr_array_make(pool, last - first, sizeof(svn_fs_x__change_t*)); for (i = first; i < last; ++i) { const binary_change_t *binary_change = &APR_ARRAY_IDX(changes->changes, i, binary_change_t); - /* convert BINARY_CHANGE into a standard FSX change_t */ - change_t *change = apr_pcalloc(pool, sizeof(*change)); - svn_fs_path_change2_t *info = &change->info; + /* convert BINARY_CHANGE into a standard FSX svn_fs_x__change_t */ + svn_fs_x__change_t *change = apr_pcalloc(pool, sizeof(*change)); change->path.data = svn_fs_x__string_table_get(changes->paths, binary_change->path, &change->path.len, pool); if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET) - info->node_rev_id = svn_fs_x__id_create(&binary_change->node_id, - &binary_change->copy_id, - &binary_change->noderev_id, - pool); + change->noderev_id = binary_change->noderev_id; - info->change_kind = (svn_fs_path_change_kind_t) + change->change_kind = (svn_fs_path_change_kind_t) ((binary_change->flags & CHANGE_KIND_MASK) >> CHANGE_KIND_SHIFT); - info->text_mod = (binary_change->flags & CHANGE_TEXT_MOD) != 0; - info->prop_mod = (binary_change->flags & CHANGE_PROP_MOD) != 0; - info->node_kind = (svn_node_kind_t) + change->text_mod = (binary_change->flags & CHANGE_TEXT_MOD) != 0; + change->prop_mod = (binary_change->flags & CHANGE_PROP_MOD) != 0; + change->node_kind = (svn_node_kind_t) ((binary_change->flags & CHANGE_NODE_MASK) >> CHANGE_NODE_SHIFT); - info->copyfrom_rev = binary_change->copyfrom_rev; - info->copyfrom_known = TRUE; + change->copyfrom_rev = binary_change->copyfrom_rev; + change->copyfrom_known = TRUE; if (SVN_IS_VALID_REVNUM(binary_change->copyfrom_rev)) - info->copyfrom_path + change->copyfrom_path = svn_fs_x__string_table_get(changes->paths, binary_change->copyfrom_path, NULL, pool); /* add it to the result */ - APR_ARRAY_PUSH(*list, change_t*) = change; + APR_ARRAY_PUSH(*list, svn_fs_x__change_t*) = change; } return SVN_NO_ERROR; @@ -305,16 +288,16 @@ svn_fs_x__changes_get_list(apr_array_hea svn_error_t * svn_fs_x__write_changes_container(svn_stream_t *stream, const svn_fs_x__changes_t *changes, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { int i; string_table_t *paths = changes->paths ? changes->paths : svn_fs_x__string_table_create(changes->builder, - pool); + scratch_pool); - svn_packed__data_root_t *root = svn_packed__data_create_root(pool); + svn_packed__data_root_t *root = svn_packed__data_create_root(scratch_pool); /* one top-level stream for each array */ svn_packed__int_stream_t *offsets_stream @@ -330,11 +313,7 @@ svn_fs_x__write_changes_container(svn_st svn_packed__create_int_substream(changes_stream, TRUE, FALSE); svn_packed__create_int_substream(changes_stream, TRUE, TRUE); svn_packed__create_int_substream(changes_stream, TRUE, FALSE); - svn_packed__create_int_substream(changes_stream, TRUE, TRUE); - svn_packed__create_int_substream(changes_stream, TRUE, FALSE); - svn_packed__create_int_substream(changes_stream, TRUE, TRUE); - svn_packed__create_int_substream(changes_stream, TRUE, FALSE); - + /* serialize offsets array */ for (i = 0; i < changes->offsets->nelts; ++i) svn_packed__add_uint(offsets_stream, @@ -352,17 +331,13 @@ svn_fs_x__write_changes_container(svn_st svn_packed__add_int(changes_stream, change->copyfrom_rev); svn_packed__add_uint(changes_stream, change->copyfrom_path); - svn_packed__add_int(changes_stream, change->node_id.change_set); - svn_packed__add_uint(changes_stream, change->node_id.number); - svn_packed__add_int(changes_stream, change->copy_id.change_set); - svn_packed__add_uint(changes_stream, change->copy_id.number); svn_packed__add_int(changes_stream, change->noderev_id.change_set); svn_packed__add_uint(changes_stream, change->noderev_id.number); } /* write to disk */ - SVN_ERR(svn_fs_x__write_string_table(stream, paths, pool)); - SVN_ERR(svn_packed__data_write(stream, root, pool)); + SVN_ERR(svn_fs_x__write_string_table(stream, paths, scratch_pool)); + SVN_ERR(svn_packed__data_write(stream, root, scratch_pool)); return SVN_NO_ERROR; } @@ -412,10 +387,6 @@ svn_fs_x__read_changes_container(svn_fs_ change.copyfrom_rev = (svn_revnum_t)svn_packed__get_int(changes_stream); change.copyfrom_path = (apr_size_t)svn_packed__get_uint(changes_stream); - change.node_id.change_set = svn_packed__get_int(changes_stream); - change.node_id.number = svn_packed__get_uint(changes_stream); - change.copy_id.change_set = svn_packed__get_int(changes_stream); - change.copy_id.number = svn_packed__get_uint(changes_stream); change.noderev_id.change_set = svn_packed__get_int(changes_stream); change.noderev_id.number = svn_packed__get_uint(changes_stream); @@ -525,43 +496,38 @@ svn_fs_x__changes_get_list_func(void **o last = offsets[idx+1]; /* construct result */ - list = apr_array_make(pool, last - first, sizeof(change_t*)); + list = apr_array_make(pool, last - first, sizeof(svn_fs_x__change_t*)); for (i = first; i < last; ++i) { const binary_change_t *binary_change = &changes[i]; - /* convert BINARY_CHANGE into a standard FSX change_t */ - change_t *change = apr_pcalloc(pool, sizeof(*change)); - svn_fs_path_change2_t *info = &change->info; + /* convert BINARY_CHANGE into a standard FSX svn_fs_x__change_t */ + svn_fs_x__change_t *change = apr_pcalloc(pool, sizeof(*change)); change->path.data = svn_fs_x__string_table_get_func(paths, binary_change->path, &change->path.len, pool); - if (binary_change->noderev_id.change_set != SVN_FS_X__INVALID_CHANGE_SET) - info->node_rev_id = svn_fs_x__id_create(&binary_change->node_id, - &binary_change->copy_id, - &binary_change->noderev_id, - pool); + change->noderev_id = binary_change->noderev_id; - info->change_kind = (svn_fs_path_change_kind_t) + change->change_kind = (svn_fs_path_change_kind_t) ((binary_change->flags & CHANGE_KIND_MASK) >> CHANGE_KIND_SHIFT); - info->text_mod = (binary_change->flags & CHANGE_TEXT_MOD) != 0; - info->prop_mod = (binary_change->flags & CHANGE_PROP_MOD) != 0; - info->node_kind = (svn_node_kind_t) + change->text_mod = (binary_change->flags & CHANGE_TEXT_MOD) != 0; + change->prop_mod = (binary_change->flags & CHANGE_PROP_MOD) != 0; + change->node_kind = (svn_node_kind_t) ((binary_change->flags & CHANGE_NODE_MASK) >> CHANGE_NODE_SHIFT); - info->copyfrom_rev = binary_change->copyfrom_rev; - info->copyfrom_known = TRUE; + change->copyfrom_rev = binary_change->copyfrom_rev; + change->copyfrom_known = TRUE; if (SVN_IS_VALID_REVNUM(binary_change->copyfrom_rev)) - info->copyfrom_path + change->copyfrom_path = svn_fs_x__string_table_get_func(paths, binary_change->copyfrom_path, NULL, pool); /* add it to the result */ - APR_ARRAY_PUSH(list, change_t*) = change; + APR_ARRAY_PUSH(list, svn_fs_x__change_t*) = change; } *out = list; Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/changes.h URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/changes.h?rev=1653578&r1=1653577&r2=1653578&view=diff ============================================================================== --- subversion/branches/pin-externals/subversion/libsvn_fs_x/changes.h (original) +++ subversion/branches/pin-externals/subversion/libsvn_fs_x/changes.h Wed Jan 21 16:22:19 2015 @@ -32,25 +32,27 @@ * * In its serialized form, the svn_fs_x__changes_t container extracts most * of that redundancy and the run-time representation is also much smaller - * than sum of the respective change_t* arrays. + * than sum of the respective svn_fs_x__change_t* arrays. * * As with other containers, this one has two modes: 'construction', in * which you may add data to it, and 'getter' in which there is only r/o * access to the data. */ -/* An opaque collection of change lists (apr_array_header_t * of change_t*). +/* An opaque collection of change lists (apr_array_header_t * of + * svn_fs_x__change_t *). */ typedef struct svn_fs_x__changes_t svn_fs_x__changes_t; /* Create and populate changes containers. */ /* Create and return a new changes container with an initial capacity of - * INITIAL_COUNT change_t objects. Allocate the result in POOL. + * INITIAL_COUNT svn_fs_x__change_t objects. + * Allocate the result in RESULT_POOL. */ svn_fs_x__changes_t * svn_fs_x__changes_create(apr_size_t initial_count, - apr_pool_t *pool); + apr_pool_t *result_pool); /* Start a new change list CHANGES (implicitly terminating the previous one) * and return its index in *LIST_INDEX. Append all changes from LIST to @@ -80,13 +82,13 @@ svn_fs_x__changes_get_list(apr_array_hea /* I/O interface. */ -/* Write a serialized representation of CHANGES to STREAM. Use POOL for - * temporary allocations. +/* Write a serialized representation of CHANGES to STREAM. + * Use SCRATCH_POOL for temporary allocations. */ svn_error_t * svn_fs_x__write_changes_container(svn_stream_t *stream, const svn_fs_x__changes_t *changes, - apr_pool_t *pool); + apr_pool_t *scratch_pool); /* Read a changes container from its serialized representation in STREAM. * Allocate the result in RESULT_POOL and return it in *CHANGES_P. Use
