Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/gen - sprinkle CONSTCOND



details:   https://anonhg.NetBSD.org/src/rev/ccd91534138a
branches:  trunk
changeset: 778219:ccd91534138a
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Mar 20 00:03:12 2012 +0000

description:
- sprinkle CONSTCOND
- back to char * to simplify code, requested by gimpy

diffstat:

 lib/libc/gen/nlist_ecoff.c |  21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diffs (68 lines):

diff -r 99d03d6e5a0c -r ccd91534138a lib/libc/gen/nlist_ecoff.c
--- a/lib/libc/gen/nlist_ecoff.c        Mon Mar 19 22:32:16 2012 +0000
+++ b/lib/libc/gen/nlist_ecoff.c        Tue Mar 20 00:03:12 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nlist_ecoff.c,v 1.20 2012/03/19 16:20:58 christos Exp $ */
+/* $NetBSD: nlist_ecoff.c,v 1.21 2012/03/20 00:03:12 christos Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou
@@ -36,7 +36,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: nlist_ecoff.c,v 1.20 2012/03/19 16:20:58 christos Exp $");
+__RCSID("$NetBSD: nlist_ecoff.c,v 1.21 2012/03/20 00:03:12 christos Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
@@ -58,19 +58,18 @@
 #endif
 
 #ifdef NLIST_ECOFF
-#define        check(off, size)        ((off < 0) || (off + size > mappedsize))
+#define        check(off, size) \
+       (/*CONSTCOND*/(off < 0) || (off + size > mappedsize))
 
 int
-__fdnlist_ecoff(fd, list)
-       int fd;
-       struct nlist *list;
+__fdnlist_ecoff(int fd, struct nlist *list)
 {
        struct nlist *p;
        struct ecoff_exechdr *exechdrp;
        struct ecoff_symhdr *symhdrp;
        struct ecoff_extsym *esyms;
        struct stat st;
-       void *mappedfile;
+       char *mappedfile;
        size_t mappedsize;
        u_long symhdroff, extstroff;
        u_int symhdrsize;
@@ -122,12 +121,12 @@
        if ((symhdroff + sizeof *symhdrp) > mappedsize ||
            sizeof *symhdrp != symhdrsize)
                goto unmap;
-       symhdrp = (void *)((char *)mappedfile + symhdroff);
+       symhdrp = (void *)&mappedfile[symhdroff];
 
        nesyms = symhdrp->esymMax;
        if (check(symhdrp->cbExtOffset, nesyms * sizeof *esyms))
                goto unmap;
-       esyms = (void *)((char *)mappedfile + symhdrp->cbExtOffset);
+       esyms = (void *)&mappedfile[symhdrp->cbExtOffset];
        extstroff = symhdrp->cbSsExtOffset;
 
        /*
@@ -157,8 +156,8 @@
                        if (*nlistname == '_')
                                nlistname++;
 
-                       symtabname = (void *)((char *)
-                           mappedfile + (extstroff + esyms[i].es_strindex));
+                       symtabname = (void *)&mappedfile[extstroff
+                           + esyms[i].es_strindex];
 
                        if (!strcmp(symtabname, nlistname)) {
                                /*



Home | Main Index | Thread Index | Old Index