summaryrefslogtreecommitdiff
path: root/do_text.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-15 13:10:52 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-10-15 13:10:52 -0700
commitc420f450d0a2b1f26d4043334bb8b6524fea4b07 (patch)
treec78fad4226f66e4003a2991a26d31cf11298a196 /do_text.c
parent2900d7a7e7929414268cb142bf00c57d370e1396 (diff)
Stop casting return value of malloc() and calloc()
Not needed in C89 and later, and may hide errors Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'do_text.c')
-rw-r--r--do_text.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/do_text.c b/do_text.c
index 6ba8715..34947b9 100644
--- a/do_text.c
+++ b/do_text.c
@@ -72,14 +72,14 @@ InitText(XParms xp, Parms p, int64_t reps)
totalLines = '\177' - ' ' + 1;
if (totalLines > reps) totalLines = reps;
- charBuf = (char **) malloc(totalLines*sizeof (char *));
+ charBuf = malloc(totalLines * sizeof (char *));
if (p->special)
- items = (XTextItem *) malloc(totalLines*SEGS*sizeof (XTextItem));
+ items = malloc(totalLines * SEGS * sizeof (XTextItem));
for (int i = 0; i != totalLines; i++) {
char ch;
- charBuf[i] = (char *) malloc (sizeof (char)*charsPerLine);
+ charBuf[i] = malloc (sizeof (char) * charsPerLine);
ch = i + ' ';
for (int j = 0; j != charsPerLine; j++) {
charBuf[i][j] = ch;
@@ -169,23 +169,23 @@ InitText16(XParms xp, Parms p, int64_t reps)
charsPerLine = (charsPerLine + 3) & ~3; /* make a multiple of four */
p->objects = charsPerLine;
- items = (XTextItem *) malloc(totalLines*SEGS*sizeof (XTextItem));
+ items = malloc(totalLines * SEGS * sizeof (XTextItem));
for (int i = 0; i < totalLines; i++) {
char *pbuf0, *pbuf1, *pbuf2;
pbuf0 = items[i*SEGS+0].chars =
- (char *) malloc (sizeof (char)*charsPerLine/2);
+ malloc (sizeof (char) * charsPerLine/2);
items[i*SEGS+0].nchars = charsPerLine/4;
items[i*SEGS+0].delta = 0;
items[i*SEGS+0].font = font->fid;
pbuf1 = items[i*SEGS+1].chars =
- (char *) malloc (sizeof (char)*charsPerLine);
+ malloc (sizeof (char) * charsPerLine);
items[i*SEGS+1].nchars = charsPerLine/2;
items[i*SEGS+1].delta = 3;
items[i*SEGS+1].font = bfont->fid;
pbuf2 = items[i*SEGS+2].chars =
- (char *) malloc (sizeof (char)*charsPerLine/2);
+ malloc (sizeof (char) * charsPerLine/2);
items[i*SEGS+2].nchars = charsPerLine/4;
items[i*SEGS+2].delta = 3;
items[i*SEGS+2].font = font->fid;
@@ -204,10 +204,10 @@ InitText16(XParms xp, Parms p, int64_t reps)
}
}
} else {
- charBuf = (char **) malloc(totalLines*sizeof (char *));
+ charBuf = malloc(totalLines * sizeof (char *));
for (int i = 0; i < totalLines; i++) {
char *pbuf0 = charBuf[i] =
- (char *) malloc (sizeof (char)*charsPerLine*2);
+ malloc (sizeof (char) * charsPerLine * 2);
for (int j = 0; j < charsPerLine; j++) {
GetRealChar(font, totalChars, ch);
*pbuf0++ = ch / columns + font->min_byte1;
@@ -453,10 +453,10 @@ InitAAText(XParms xp, Parms p, int64_t reps)
totalLines = '\177' - ' ' + 1;
if (totalLines > reps) totalLines = reps;
- charBuf = (char **) malloc(totalLines*sizeof (char *));
+ charBuf = malloc(totalLines * sizeof (char *));
for (int i = 0; i != totalLines; i++) {
- charBuf[i] = (char *) malloc (sizeof (char)*charsPerLine);
+ charBuf[i] = malloc (sizeof (char) * charsPerLine);
ch = i + ' ';
for (int j = 0; j != charsPerLine; j++) {
charBuf[i][j] = ch;