--- a/mercurial/bdiff.c Thu Sep 27 23:57:57 2007 -0500
+++ b/mercurial/bdiff.c Thu Sep 27 23:58:54 2007 -0500
@@ -67,12 +67,13 @@
{
int g, h, i;
const char *p, *b = a;
+ const char * const plast = a + len - 1;
struct line *l;
/* count the lines */
i = 1; /* extra line for sentinel */
for (p = a; p < a + len; p++)
- if (*p == '\n' || p == a + len - 1)
+ if (*p == '\n' || p == plast)
i++;
*lr = l = (struct line *)malloc(sizeof(struct line) * i);
@@ -92,7 +93,7 @@
h ^= g >> 24;
h ^= g;
}
- if (*p == '\n' || p == a + len - 1) {
+ if (*p == '\n' || p == plast) {
l->len = p - b + 1;
l->h = h * l->len;
l->l = b;