X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=diff-delta.c;h=7da9205a5da6a4f016bc6b556bee01895cdcc19d;hb=9a1ae9ab03abaffc977421f182997f3e735e7098;hp=25a798d050c6319f3d524c9c605ab70ea35ae7a1;hpb=6858d494926437ad7b7e9199ea39953eb90c7bab;p=git.git diff --git a/diff-delta.c b/diff-delta.c index 25a798d05..7da9205a5 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -22,6 +22,7 @@ #include #include "delta.h" +#include "git-compat-util.h" /* maximum hash entry list for the same hash bucket */ #define HASH_LIMIT 64 @@ -131,7 +132,7 @@ struct delta_index { const void *src_buf; unsigned long src_size; unsigned int hash_mask; - struct index_entry *hash[0]; + struct index_entry *hash[FLEX_ARRAY]; }; struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) @@ -147,7 +148,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) return NULL; /* Determine index hash size. Note that indexing skips the - first byte to allow for optimizing the rabin polynomial + first byte to allow for optimizing the Rabin's polynomial initialization in create_delta(). */ entries = (bufsize - 1) / RABIN_WINDOW; hsize = entries / 4; @@ -204,7 +205,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize) /* * Determine a limit on the number of entries in the same hash - * bucket. This guard us against patological data sets causing + * bucket. This guards us against pathological data sets causing * really bad hash distribution with most entries in the same hash * bucket that would bring us to O(m*n) computing costs (m and n * corresponding to reference and target buffer sizes). @@ -239,7 +240,7 @@ void free_delta_index(struct delta_index *index) /* * The maximum size for any opcode sequence, including the initial header - * plus rabin window plus biggest copy. + * plus Rabin window plus biggest copy. */ #define MAX_OP_SIZE (5 + 5 + 1 + RABIN_WINDOW + 7) @@ -283,7 +284,7 @@ create_delta(const struct delta_index *index, ref_data = index->src_buf; ref_top = ref_data + index->src_size; data = trg_buf; - top = trg_buf + trg_size; + top = (const unsigned char *) trg_buf + trg_size; outpos++; val = 0;