# HG changeset patch # User TK Soh # Date 2006-03-20 07:46:29 # Node ID 10606ee611079a029dabe41c564bb026f6246d34 # Parent 7eb694a1c1af6bb8250c84f96ca98ee63e59a33c do proper typecasting on malloc() and calloc() calls to support build on Solaris 2.6 using Sun Pro SC4.0 (C++ 4.1) compiler. diff --git a/mercurial/bdiff.c b/mercurial/bdiff.c --- 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) * ((anbase = malloc(sizeof(struct frag) * size); + a->base = (struct frag *)malloc(sizeof(struct frag) * size); if (!a->base) { free(a); a = NULL;