##// END OF EJS Templates
bdiff: don't check border condition in loop...
Gregory Szorc -
r30461:d195fa65 default
parent child Browse files
Show More
@@ -47,10 +47,10 b' int bdiff_splitlines(const char *a, ssiz'
47
47
48 /* build the line array and calculate hashes */
48 /* build the line array and calculate hashes */
49 hash = 0;
49 hash = 0;
50 for (p = a; p < a + len; p++) {
50 for (p = a; p < plast; p++) {
51 hash = HASH(hash, *p);
51 hash = HASH(hash, *p);
52
52
53 if (*p == '\n' || p == plast) {
53 if (*p == '\n') {
54 l->hash = hash;
54 l->hash = hash;
55 hash = 0;
55 hash = 0;
56 l->len = p - b + 1;
56 l->len = p - b + 1;
@@ -61,6 +61,15 b' int bdiff_splitlines(const char *a, ssiz'
61 }
61 }
62 }
62 }
63
63
64 if (p == plast) {
65 hash = HASH(hash, *p);
66 l->hash = hash;
67 l->len = p - b + 1;
68 l->l = b;
69 l->n = INT_MAX;
70 l++;
71 }
72
64 /* set up a sentinel */
73 /* set up a sentinel */
65 l->hash = 0;
74 l->hash = 0;
66 l->len = 0;
75 l->len = 0;
General Comments 0
You need to be logged in to leave comments. Login now