Show More
@@ -74,7 +74,7 b' int splitlines(const char *a, int len, s' | |||||
74 | if (*p == '\n' || p == a + len - 1) |
|
74 | if (*p == '\n' || p == a + len - 1) | |
75 | i++; |
|
75 | i++; | |
76 |
|
76 | |||
77 | *lr = l = malloc(sizeof(struct line) * i); |
|
77 | *lr = l = (struct line *)malloc(sizeof(struct line) * i); | |
78 | if (!l) |
|
78 | if (!l) | |
79 | return -1; |
|
79 | return -1; | |
80 |
|
80 | |||
@@ -113,7 +113,7 b' static int equatelines(struct line *a, i' | |||||
113 | while (buckets < bn + 1) |
|
113 | while (buckets < bn + 1) | |
114 | buckets *= 2; |
|
114 | buckets *= 2; | |
115 |
|
115 | |||
116 | h = malloc(buckets * sizeof(struct pos)); |
|
116 | h = (struct pos *)malloc(buckets * sizeof(struct pos)); | |
117 | buckets = buckets - 1; |
|
117 | buckets = buckets - 1; | |
118 | if (!h) |
|
118 | if (!h) | |
119 | return 0; |
|
119 | return 0; | |
@@ -237,9 +237,10 b' static struct hunklist diff(struct line ' | |||||
237 |
|
237 | |||
238 | /* allocate and fill arrays */ |
|
238 | /* allocate and fill arrays */ | |
239 | t = equatelines(a, an, b, bn); |
|
239 | t = equatelines(a, an, b, bn); | |
240 | pos = calloc(bn, sizeof(struct pos)); |
|
240 | pos = (struct pos *)calloc(bn, sizeof(struct pos)); | |
241 | /* we can't have more matches than lines in the shorter file */ |
|
241 | /* we can't have more matches than lines in the shorter file */ | |
242 |
l.head = l.base = malloc(sizeof(struct hunk) * |
|
242 | l.head = l.base = (struct hunk *)malloc(sizeof(struct hunk) * | |
|
243 | ((an<bn ? an:bn) + 1)); | |||
243 |
|
244 | |||
244 | if (pos && l.base && t) { |
|
245 | if (pos && l.base && t) { | |
245 | /* generate the matching block list */ |
|
246 | /* generate the matching block list */ |
@@ -58,9 +58,9 b' static struct flist *lalloc(int size)' | |||||
58 | { |
|
58 | { | |
59 | struct flist *a = NULL; |
|
59 | struct flist *a = NULL; | |
60 |
|
60 | |||
61 | a = malloc(sizeof(struct flist)); |
|
61 | a = (struct flist *)malloc(sizeof(struct flist)); | |
62 | if (a) { |
|
62 | if (a) { | |
63 | a->base = malloc(sizeof(struct frag) * size); |
|
63 | a->base = (struct frag *)malloc(sizeof(struct frag) * size); | |
64 | if (!a->base) { |
|
64 | if (!a->base) { | |
65 | free(a); |
|
65 | free(a); | |
66 | a = NULL; |
|
66 | a = NULL; |
General Comments 0
You need to be logged in to leave comments.
Login now