Mercurial > hg
changeset 5614:5133e9f61700
Fix bdiff test failures on AIX.
The test fails when, in the call to calloc(), the number of elements (bn)
is 0. In that case, calloc() on AIX will return NULL, while the code expects
a valid heap pointer. Both results are permissible under C99, Unix98 etc.
Work around by ensuring that at least 1 element is requested.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Tue, 23 Oct 2007 10:39:24 +0000 |
parents | 60bd4e707a7d |
children | ce383c80a177 924fd86f0579 |
files | mercurial/bdiff.c |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/bdiff.c Tue Dec 04 23:10:13 2007 +0100 +++ b/mercurial/bdiff.c Tue Oct 23 10:39:24 2007 +0000 @@ -245,7 +245,7 @@ /* allocate and fill arrays */ t = equatelines(a, an, b, bn); - pos = (struct pos *)calloc(bn, sizeof(struct pos)); + pos = (struct pos *)calloc((bn>0)?bn:1, sizeof(struct pos)); /* we can't have more matches than lines in the shorter file */ l.head = l.base = (struct hunk *)malloc(sizeof(struct hunk) * ((an<bn ? an:bn) + 1));