# HG changeset patch # User TK Soh # Date 1142840789 -3600 # 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 -r 7eb694a1c1af -r 10606ee61107 mercurial/bdiff.c --- 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) * ((anbase = malloc(sizeof(struct frag) * size); + a->base = (struct frag *)malloc(sizeof(struct frag) * size); if (!a->base) { free(a); a = NULL;