summaryrefslogtreecommitdiffstats
path: root/hack/hack.engrave.c
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2011-08-06 20:18:26 +0000
committerdholland <dholland@NetBSD.org>2011-08-06 20:18:26 +0000
commit9454bf2a02784b7f28fbab922d3d8b56b2193786 (patch)
treea5acc680f74543e2bb47b6067344e7e9e5759f5d /hack/hack.engrave.c
parenta96166e2f80ef376b0a2cdea16f09df48fe56d8c (diff)
downloadbsdgames-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.engrave.c')
-rw-r--r--hack/hack.engrave.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hack/hack.engrave.c b/hack/hack.engrave.c
index e440f9f1..4cd68bb9 100644
--- a/hack/hack.engrave.c
+++ b/hack/hack.engrave.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hack.engrave.c,v 1.10 2011/08/06 20:00:33 dholland Exp $ */
+/* $NetBSD: hack.engrave.c,v 1.11 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.engrave.c,v 1.10 2011/08/06 20:00:33 dholland Exp $");
+__RCSID("$NetBSD: hack.engrave.c,v 1.11 2011/08/06 20:18:26 dholland Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -185,8 +185,8 @@ make_engr_at(int x, int y, const char *s)
if ((ep = engr_at(x, y)) != NULL)
del_engr(ep);
- ep = (struct engr *)
- alloc((unsigned) (sizeof(struct engr) + strlen(s) + 1));
+ ep = alloc(sizeof(*ep) + strlen(s) + 1);
+
ep->nxt_engr = head_engr;
head_engr = ep;
ep->engr_x = x;
@@ -316,7 +316,7 @@ doengrave(void)
}
if (oep)
len += strlen(oep->engr_txt) + spct;
- ep = (struct engr *) alloc((unsigned) (sizeof(struct engr) + len + 1));
+ ep = alloc(sizeof(*ep) + len + 1);
ep->nxt_engr = head_engr;
head_engr = ep;
ep->engr_x = u.ux;
@@ -367,8 +367,8 @@ rest_engravings(int fd)
mread(fd, &lth, sizeof(unsigned));
if (lth == 0)
return;
- ep = (struct engr *) alloc(sizeof(struct engr) + lth);
- mread(fd, ep, sizeof(struct engr) + lth);
+ ep = alloc(sizeof(*ep) + lth);
+ mread(fd, ep, sizeof(*ep) + lth);
ep->nxt_engr = head_engr;
ep->engr_txt = (char *) (ep + 1); /* Andreas Bormann */
head_engr = ep;