From 00b8e31689c6400d8ad915067f021b8e246df989 Mon Sep 17 00:00:00 2001 From: jsm Date: Sun, 25 Mar 2001 20:43:58 +0000 Subject: Make mostly gcc -W clean, and other cleanup: Use const. Add __noreturn__ attributes. Add a __format__ attribute. Add __unused__ attributes. Use symbolic constants for open() and lseek(). Declare types of all function parameters; convert some function definitions to ISO C form. Ensure standard file descriptors are open on startup. Check for errors writing output of makedefs. Avoid duplicate definitions of variables. --- hack/hack.dog.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'hack/hack.dog.c') diff --git a/hack/hack.dog.c b/hack/hack.dog.c index 4194e76f..5a8ebfb3 100644 --- a/hack/hack.dog.c +++ b/hack/hack.dog.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.dog.c,v 1.4 1997/10/19 16:57:50 christos Exp $ */ +/* $NetBSD: hack.dog.c,v 1.5 2001/03/25 20:43:59 jsm Exp $ */ /* * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. @@ -6,7 +6,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.dog.c,v 1.4 1997/10/19 16:57:50 christos Exp $"); +__RCSID("$NetBSD: hack.dog.c,v 1.5 2001/03/25 20:43:59 jsm Exp $"); #endif /* not lint */ #include "hack.h" @@ -15,11 +15,11 @@ __RCSID("$NetBSD: hack.dog.c,v 1.4 1997/10/19 16:57:50 christos Exp $"); #include "def.edog.h" #include "def.mkroom.h" -struct permonst li_dog = +const struct permonst li_dog = {"little dog", 'd', 2, 18, 6, 1, 6, sizeof(struct edog)}; -struct permonst dog = +const struct permonst dog = {"dog", 'd', 4, 16, 5, 1, 6, sizeof(struct edog)}; -struct permonst la_dog = +const struct permonst la_dog = {"large dog", 'd', 6, 15, 4, 2, 4, sizeof(struct edog)}; @@ -131,13 +131,12 @@ dogfood(obj) /* return 0 (no move), 1 (move) or 2 (dead) */ int -dog_move(mtmp, after) - struct monst *mtmp; +dog_move(struct monst *mtmp, int after) { int nx, ny, omx, omy, appr, nearer, j; int udist, chi = 0, i, whappr; struct monst *mtmp2; - struct permonst *mdat = mtmp->data; + const struct permonst *mdat = mtmp->data; struct edog *edog = EDOG(mtmp); struct obj *obj; struct trap *trap; -- cgit v1.2.3-56-ge451