mercurial/bdiff.c
changeset 827 a61728b58dc0
parent 597 e530637ea060
child 836 1fe3b14c7044
equal deleted inserted replaced
826:16700cdd9055 827:a61728b58dc0
   227 	int t;
   227 	int t;
   228 
   228 
   229 	/* allocate and fill arrays */
   229 	/* allocate and fill arrays */
   230 	t = equatelines(a, an, b, bn);
   230 	t = equatelines(a, an, b, bn);
   231 	pos = calloc(bn, sizeof(struct pos));
   231 	pos = calloc(bn, sizeof(struct pos));
   232 	l.head = l.base = malloc(sizeof(struct hunk) * ((an + bn) / 4 + 2));
   232 	/* we can't have more matches than lines in the shorter file */
       
   233 	l.head = l.base = malloc(sizeof(struct hunk) * ((an<bn ? an:bn) + 1));
   233 
   234 
   234 	if (pos && l.base && t) {
   235 	if (pos && l.base && t) {
   235 		/* generate the matching block list */
   236 		/* generate the matching block list */
   236 		recurse(a, b, pos, 0, an, 0, bn, &l);
   237 		recurse(a, b, pos, 0, an, 0, bn, &l);
   237 		l.head->a1 = an;
   238 		l.head->a1 = an;