Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/hack Simplify alloc() to avoid ifdef(LINT) workaround.



details:   https://anonhg.NetBSD.org/src/rev/ac515354e476
branches:  trunk
changeset: 750876:ac515354e476
user:      wiz <wiz%NetBSD.org@localhost>
date:      Sun Jan 17 22:55:20 2010 +0000

description:
Simplify alloc() to avoid ifdef(LINT) workaround.

diffstat:

 games/hack/alloc.c |  30 ++++--------------------------
 1 files changed, 4 insertions(+), 26 deletions(-)

diffs (60 lines):

diff -r 2983d5f27291 -r ac515354e476 games/hack/alloc.c
--- a/games/hack/alloc.c        Sun Jan 17 22:52:00 2010 +0000
+++ b/games/hack/alloc.c        Sun Jan 17 22:55:20 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: alloc.c,v 1.7 2009/08/12 07:28:40 dholland Exp $       */
+/*     $NetBSD: alloc.c,v 1.8 2010/01/17 22:55:20 wiz Exp $    */
 
 /*
  * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -63,41 +63,21 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: alloc.c,v 1.7 2009/08/12 07:28:40 dholland Exp $");
+__RCSID("$NetBSD: alloc.c,v 1.8 2010/01/17 22:55:20 wiz Exp $");
 #endif                         /* not lint */
 
 #include <stdlib.h>
 #include "hack.h"
 #include "extern.h"
 
-#ifdef LINT
-
-/*
-   a ridiculous definition, suppressing
-       "possible pointer alignment problem" for (long *) malloc()
-       "enlarg defined but never used"
-       "ftell defined (in <stdio.h>) but never used"
-   from lint
-*/
-long *
-alloc(unsigned n)
-{
-       long            dummy = ftell(stderr);
-       if (n)
-               dummy = 0;      /* make sure arg is used */
-       return (&dummy);
-}
-
-#else
-
 long *
 alloc(unsigned lth)
 {
-       char  *ptr;
+       long  *ptr;
 
        if (!(ptr = malloc(lth)))
                panic("Cannot get %d bytes", lth);
-       return ((long *) ptr);
+       return (ptr);
 }
 
 #if 0 /* unused */
@@ -111,5 +91,3 @@
        return ((long *) nptr);
 }
 #endif
-
-#endif /* LINT */



Home | Main Index | Thread Index | Old Index