diff options
author | dholland <dholland@NetBSD.org> | 2011-08-06 20:18:26 +0000 |
---|---|---|
committer | dholland <dholland@NetBSD.org> | 2011-08-06 20:18:26 +0000 |
commit | 9454bf2a02784b7f28fbab922d3d8b56b2193786 (patch) | |
tree | a5acc680f74543e2bb47b6067344e7e9e5759f5d /hack/hack.pager.c | |
parent | a96166e2f80ef376b0a2cdea16f09df48fe56d8c (diff) | |
download | bsdgames-darwin-9454bf2a02784b7f28fbab922d3d8b56b2193786.tar.gz bsdgames-darwin-9454bf2a02784b7f28fbab922d3d8b56b2193786.tar.zst bsdgames-darwin-9454bf2a02784b7f28fbab922d3d8b56b2193786.zip |
Use the right type for the malloc wrapper function, and don't cast the
return value.
(XXX: Except for a pile of allocation macros that produce typed pointer
results; there the typechecking of the result assignment is more valuable
than the warning if the alloc function isn't declared properly. These
macros should go away.)
Diffstat (limited to 'hack/hack.pager.c')
-rw-r--r-- | hack/hack.pager.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/hack/hack.pager.c b/hack/hack.pager.c index 2043b919..6384f7e7 100644 --- a/hack/hack.pager.c +++ b/hack/hack.pager.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.pager.c,v 1.16 2011/08/06 19:53:24 dholland Exp $ */ +/* $NetBSD: hack.pager.c,v 1.17 2011/08/06 20:18:26 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: hack.pager.c,v 1.16 2011/08/06 19:53:24 dholland Exp $"); +__RCSID("$NetBSD: hack.pager.c,v 1.17 2011/08/06 20:18:26 dholland Exp $"); #endif /* not lint */ /* This file contains the command routine dowhatis() and a pager. */ @@ -150,7 +150,7 @@ page_more(FILE *fp, int strip) sig_t prevsig = signal(SIGINT, intruph); set_pager(0); - bufr = (char *) alloc((unsigned) CO); + bufr = alloc(CO); bufr[CO - 1] = 0; while (fgets(bufr, CO - 1, fp) && (!strip || *bufr == '\t') && !got_intrup) { ep = strchr(bufr, '\n'); @@ -289,8 +289,7 @@ cornline(int mode, const char *text) len = strlen(text); if (len > maxlen) maxlen = len; - tl = (struct line *) - alloc((unsigned) (len + sizeof(struct line) + 1)); + tl = alloc(len + sizeof(*tl) + 1); tl->next_line = 0; tl->line_text = (char *) (tl + 1); (void) strcpy(tl->line_text, text); |