X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=diff-delta.c;h=fa16d06c8d1e85a458428c673cb2f589857f5424;hb=de51faf3888505fa3d661d4c35f32ecaf9fa1087;hp=8b9172aa2ef7402b0a847815bb11a26d1c4444fe;hpb=1d7f171c3a456b980d821ee0f68e01535a5f7e36;p=git.git diff --git a/diff-delta.c b/diff-delta.c index 8b9172aa2..fa16d06c8 100644 --- a/diff-delta.c +++ b/diff-delta.c @@ -148,11 +148,11 @@ 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; - for (i = 4; (1 << i) < hsize && i < 31; i++); + for (i = 4; (1u << i) < hsize && i < 31; i++); hsize = 1 << i; hmask = hsize - 1; @@ -205,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). @@ -240,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) @@ -392,7 +392,7 @@ create_delta(const struct delta_index *index, outsize = max_size + MAX_OP_SIZE + 1; if (max_size && outpos > max_size) break; - out = realloc(out, outsize); + out = xrealloc(out, outsize); if (!out) { free(tmp); return NULL;