Mercurial > hg > mercurial-crew-with-dirclash
diff mercurial/bdiff.c @ 1978:10606ee61107
do proper typecasting on malloc() and calloc() calls
to support build on Solaris 2.6 using Sun Pro SC4.0 (C++ 4.1) compiler.
author | TK Soh <teekaysoh@yahoo.com> |
---|---|
date | Mon, 20 Mar 2006 08:46:29 +0100 |
parents | 5afd459db177 |
children | 1ac0574f1768 |
line wrap: on
line diff
--- a/mercurial/bdiff.c +++ b/mercurial/bdiff.c @@ -74,7 +74,7 @@ int splitlines(const char *a, int len, s if (*p == '\n' || p == a + len - 1) i++; - *lr = l = malloc(sizeof(struct line) * i); + *lr = l = (struct line *)malloc(sizeof(struct line) * i); if (!l) return -1; @@ -113,7 +113,7 @@ static int equatelines(struct line *a, i while (buckets < bn + 1) buckets *= 2; - h = malloc(buckets * sizeof(struct pos)); + h = (struct pos *)malloc(buckets * sizeof(struct pos)); buckets = buckets - 1; if (!h) return 0; @@ -237,9 +237,10 @@ static struct hunklist diff(struct line /* allocate and fill arrays */ t = equatelines(a, an, b, bn); - pos = calloc(bn, sizeof(struct pos)); + pos = (struct pos *)calloc(bn, sizeof(struct pos)); /* we can't have more matches than lines in the shorter file */ - l.head = l.base = malloc(sizeof(struct hunk) * ((an<bn ? an:bn) + 1)); + l.head = l.base = (struct hunk *)malloc(sizeof(struct hunk) * + ((an<bn ? an:bn) + 1)); if (pos && l.base && t) { /* generate the matching block list */