do proper typecasting on malloc() and calloc() calls
to support build on Solaris 2.6 using Sun Pro SC4.0 (C++ 4.1) compiler.
--- a/mercurial/bdiff.c Sun Mar 19 21:26:58 2006 +0100
+++ b/mercurial/bdiff.c Mon Mar 20 08:46:29 2006 +0100
@@ -74,7 +74,7 @@
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 @@
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 @@
/* 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 */
--- a/mercurial/mpatch.c Sun Mar 19 21:26:58 2006 +0100
+++ b/mercurial/mpatch.c Mon Mar 20 08:46:29 2006 +0100
@@ -58,9 +58,9 @@
{
struct flist *a = NULL;
- a = malloc(sizeof(struct flist));
+ a = (struct flist *)malloc(sizeof(struct flist));
if (a) {
- a->base = malloc(sizeof(struct frag) * size);
+ a->base = (struct frag *)malloc(sizeof(struct frag) * size);
if (!a->base) {
free(a);
a = NULL;