Source-Changes-HG archive

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

[src/trunk]: src/usr.bin static + __dead



details:   https://anonhg.NetBSD.org/src/rev/3bbe48f60359
branches:  trunk
changeset: 769151:3bbe48f60359
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Sep 01 13:37:33 2011 +0000

description:
static + __dead

diffstat:

 usr.bin/du/du.c     |   20 ++++----
 usr.bin/fgen/fgen.l |  121 +++++++++++++++++++++++++--------------------------
 2 files changed, 70 insertions(+), 71 deletions(-)

diffs (truncated from 356 to 300 lines):

diff -r 18cb913f52df -r 3bbe48f60359 usr.bin/du/du.c
--- a/usr.bin/du/du.c   Thu Sep 01 13:25:02 2011 +0000
+++ b/usr.bin/du/du.c   Thu Sep 01 13:37:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: du.c,v 1.34 2010/07/08 20:52:22 rmind Exp $    */
+/*     $NetBSD: du.c,v 1.35 2011/09/01 13:37:33 joerg Exp $    */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@
 #if 0
 static char sccsid[] = "@(#)du.c       8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: du.c,v 1.34 2010/07/08 20:52:22 rmind Exp $");
+__RCSID("$NetBSD: du.c,v 1.35 2011/09/01 13:37:33 joerg Exp $");
 #endif
 #endif /* not lint */
 
@@ -61,12 +61,12 @@
 #include <unistd.h>
 #include <limits.h>
 
-int    linkchk(dev_t, ino_t);
-void   prstat(const char *, int64_t);
-void   usage(void);
+static int     linkchk(dev_t, ino_t);
+static void    prstat(const char *, int64_t);
+__dead static void     usage(void);
 
-int hflag;
-long blocksize;
+static int hflag;
+static long blocksize;
 
 int
 main(int argc, char *argv[])
@@ -248,7 +248,7 @@
        exit(rval);
 }
 
-void
+static void
 prstat(const char *fname, int64_t blocks)
 {
        if (hflag) {
@@ -265,7 +265,7 @@
                    fname);
 }
 
-int
+static int
 linkchk(dev_t dev, ino_t ino)
 {
        static struct entry {
@@ -340,7 +340,7 @@
        return 0;
 }
 
-void
+static void
 usage(void)
 {
 
diff -r 18cb913f52df -r 3bbe48f60359 usr.bin/fgen/fgen.l
--- a/usr.bin/fgen/fgen.l       Thu Sep 01 13:25:02 2011 +0000
+++ b/usr.bin/fgen/fgen.l       Thu Sep 01 13:37:33 2011 +0000
@@ -1,5 +1,5 @@
 %{
-/*     $NetBSD: fgen.l,v 1.34 2010/02/08 20:14:55 eeh Exp $    */
+/*     $NetBSD: fgen.l,v 1.35 2011/09/01 13:44:25 joerg Exp $  */
 /* FLEX input for FORTH input file scanner */
 /*  
  * Copyright (c) 1998 Eduardo Horvath.
@@ -42,7 +42,7 @@
 #endif
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: fgen.l,v 1.34 2010/02/08 20:14:55 eeh Exp $");
+__RCSID("$NetBSD: fgen.l,v 1.35 2011/09/01 13:44:25 joerg Exp $");
 #endif
 
 %}
@@ -68,41 +68,41 @@
 #include <unistd.h>
 
 #include "fgen.h"
-TOKEN ltoken;
+static TOKEN ltoken;
 
 /*
  * Global variables that control the parse state.
  */
 
-struct fcode *dictionary = NULL;
-struct macro *aliases = NULL;
-int outf = 1; /* stdout */
-int state = 0;
-int nextfcode = 0x800; 
-int numbase = TOK_HEX;
-long outpos;
-char *outbuf = NULL;
-char *outfile, *infile;
+static struct fcode *dictionary = NULL;
+static struct macro *aliases = NULL;
+static int outf = 1; /* stdout */
+static int state = 0;
+static int nextfcode = 0x800; 
+static int numbase = TOK_HEX;
+static long outpos;
+static char *outbuf = NULL;
+static char *outfile, *infile;
 #define BUFCLICK       (1024*1024)
-size_t outbufsiz = 0;
-char *myname = NULL;
-int offsetsize = 8;
-int defining = 0;
-int tokenizer = 0;
-int need_end0 = 1;
+static size_t outbufsiz = 0;
+static char *myname = NULL;
+static int offsetsize = 8;
+static int defining = 0;
+static int tokenizer = 0;
+static int need_end0 = 1;
 
 #define PSTKSIZ                1024
-Cell parse_stack[PSTKSIZ];
-int parse_stack_ptr = 0;
+static Cell parse_stack[PSTKSIZ];
+static int parse_stack_ptr = 0;
 
-void   token_err(int, const char *, const char *, const char *, ...)
-       __attribute__((__format__(__printf__, 4, 5)));
-YY_DECL;
+static void    token_err(int, const char *, const char *, const char *, ...)
+    __printflike(4, 5) __dead;
+static YY_DECL;
 
-int debug = 0;
+static int debug = 0;
 #define ASSERT if (debug) assert
 #define STATE(y, x)    do { if (debug) printf( "%lx State %s: token `%s'\n", outpos, x, y); } while (0)
-int mark_fload = 0;
+static int mark_fload = 0;
 
 %}
 
@@ -302,29 +302,28 @@
 %%
 
 /* Function definitions */
-void push(Cell);
-Cell pop(void);
-int depth(void);
-int fadd(struct fcode *, struct fcode *);
-struct fcode *flookup(struct fcode *, const char *);
-int aadd(struct macro *, struct macro *);
-struct macro *alookup(struct macro *, const char *);
-void initdic(void);
-void usage(const char *);
-void tokenize(YY_BUFFER_STATE);
-int emit(const char *);
-int spit(long);
-int offspit(long);
-void sspit(const char *);
-int apply_macros(YY_BUFFER_STATE, const char *);
-int main(int argc, char *argv[]);
-Cell cvt(const char *, char **, int base);
+static void push(Cell);
+static Cell pop(void);
+static int depth(void);
+static int fadd(struct fcode *, struct fcode *);
+static struct fcode *flookup(struct fcode *, const char *);
+static int aadd(struct macro *, struct macro *);
+static struct macro *alookup(struct macro *, const char *);
+static void initdic(void);
+__dead static void usage(const char *);
+static void tokenize(YY_BUFFER_STATE);
+static int emit(const char *);
+static int spit(long);
+static int offspit(long);
+static void sspit(const char *);
+static int apply_macros(YY_BUFFER_STATE, const char *);
+static Cell cvt(const char *, char **, int base);
 
 /*
  * Standard FCode names and numbers.  Includes standard
  * tokenizer aliases.
  */
-struct fcode fcodes[] = {
+static struct fcode fcodes[] = {
                { "end0",                       0x0000, 0, NULL, NULL },
                { "b(lit)",                     0x0010, 0, NULL, NULL },
                { "b(')",                       0x0011, 0, NULL, NULL },
@@ -701,7 +700,7 @@
 /*
  * Default macros -- can be overridden by colon definitions.
  */
-struct macro macros[] = {
+static struct macro macros[] = {
        { "eval",       "evaluate", 0, NULL, NULL }, /* Build a more balanced tree */
        { "(.)",        "dup abs <# u#s swap sign u#>", 0, NULL, NULL },
        { "<<",         "lshift", 0, NULL, NULL },
@@ -746,7 +745,7 @@
  * ASCII -> long int converter, eats `.'s
  */
 #define strtol(x, y, z)                cvt(x, y, z)
-Cell
+static Cell
 cvt(const char *s, char **e, int base)
 {
        Cell v = 0;
@@ -782,7 +781,7 @@
  * Parser stack control functions.
  */
 
-void
+static void
 push(Cell val)
 {
        if (debug > 1)
@@ -794,7 +793,7 @@
        }
 }
 
-Cell
+static Cell
 pop(void)
 {
        ASSERT(parse_stack_ptr);
@@ -803,7 +802,7 @@
        return parse_stack[--parse_stack_ptr];
 }
 
-int
+static int
 depth(void)
 {
        return (parse_stack_ptr);
@@ -812,7 +811,7 @@
 /*
  * Insert fcode into dictionary.
  */
-int
+static int
 fadd(struct fcode *dict, struct fcode *new)
 {
        int res = strcmp(dict->name, new->name);
@@ -854,7 +853,7 @@
 /*
  * Look for a code in the dictionary.
  */
-struct fcode *
+static struct fcode *
 flookup(struct fcode *dict, const char *str)
 {
        int res;
@@ -876,7 +875,7 @@
 /*
  * Insert alias into macros.
  */
-int
+static int
 aadd(struct macro *dict, struct macro *new)
 {
        int res = strcmp(dict->name, new->name);
@@ -916,7 +915,7 @@
 /*
  * Look for a macro in the aliases.
  */
-struct macro *
+static struct macro *
 alookup(struct macro *dict, const char *str)
 {
        int res;
@@ -936,7 +935,7 @@
  * Bootstrap the dictionary and then install
  * all the standard FCodes.
  */
-void
+static void
 initdic(void)
 {
        struct fcode *code = fcodes;
@@ -967,7 +966,7 @@
 
 }
 
-int
+static int
 apply_macros(YY_BUFFER_STATE yinput, const char *str)
 {
        struct macro *xform = alookup(aliases, str);
@@ -987,7 +986,7 @@
        return (xform != NULL);
 }
 
-void
+static void
 usage(const char *me)



Home | Main Index | Thread Index | Old Index