/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/diff-delta.c

Do a lot of renaming.

Change the config from 'max_entries_per_source' to 'max_bytes_to_index'.
I'm not 100% happy, because it is max_bytes_to_delta_index_per_source, but
that is just getting rediculously long.
Internally, change the code to take a 'settings' function, which currently
returns a tuple. I'm thinking to change it to a dict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
377
377
create_delta_index(const struct source_info *src,
378
378
                   struct delta_index *old,
379
379
                   struct delta_index **fresh,
380
 
                   int max_entries)
 
380
                   int max_bytes_to_index)
381
381
{
382
382
    unsigned int i, hsize, hmask, num_entries, prev_val, *hash_count;
383
 
    unsigned int total_num_entries, stride;
 
383
    unsigned int total_num_entries, stride, max_entries;
384
384
    const unsigned char *data, *buffer;
385
385
    struct delta_index *index;
386
386
    struct unpacked_index_entry *entry, **hash;
396
396
     */
397
397
    stride = RABIN_WINDOW;
398
398
    num_entries = (src->size - 1)  / RABIN_WINDOW;
399
 
    if (max_entries > 0 && num_entries > max_entries) {
400
 
        /* Limit the max number of matching entries. This reduces the 'best'
401
 
         * possible match, but means we don't consume all of ram.
402
 
         */
403
 
        num_entries = max_entries;
404
 
        stride = (src->size - 1) / num_entries;
 
399
    if (max_bytes_to_index > 0) {
 
400
        max_entries = max_bytes_to_index / RABIN_WINDOW;
 
401
        if (num_entries > max_entries) {
 
402
            /* Limit the max number of matching entries. This reduces the 'best'
 
403
             * possible match, but means we don't consume all of ram.
 
404
             */
 
405
            num_entries = max_entries;
 
406
            stride = (src->size - 1) / num_entries;
 
407
        }
405
408
    }
406
409
    if (old != NULL)
407
410
        total_num_entries = num_entries + old->num_entries;