static + __dead

This commit is contained in:
joerg 2011-09-04 20:27:05 +00:00
parent 8f81f2eef9
commit d6555585cf
4 changed files with 67 additions and 66 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: gencat.c,v 1.30 2009/07/13 19:05:41 roy Exp $ */
/* $NetBSD: gencat.c,v 1.31 2011/09/04 20:27:05 joerg Exp $ */
/*
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
__RCSID("$NetBSD: gencat.c,v 1.30 2009/07/13 19:05:41 roy Exp $");
__RCSID("$NetBSD: gencat.c,v 1.31 2011/09/04 20:27:05 joerg Exp $");
#endif
/***********************************************************
@ -108,7 +108,7 @@ struct _setT {
LIST_ENTRY(_setT) entries;
};
LIST_HEAD(sethead, _setT) sethead;
static LIST_HEAD(sethead, _setT) sethead;
static struct _setT *curSet;
static const char *curfile;
@ -116,7 +116,7 @@ static char *curline = NULL;
static long lineno = 0;
static char *cskip(char *);
static void error(const char *);
__dead static void error(const char *);
static char *get_line(int);
static char *getmsg(int, char *, char);
static void warning(const char *, const char *);
@ -125,20 +125,19 @@ static char *xstrdup(const char *);
static void *xmalloc(size_t);
static void *xrealloc(void *, size_t);
void MCParse(int fd);
void MCReadCat(int fd);
void MCWriteCat(int fd);
void MCDelMsg(int msgId);
void MCAddMsg(int msgId, const char *msg);
void MCAddSet(int setId);
void MCDelSet(int setId);
int main(int, char **);
void usage(void);
static void MCParse(int fd);
static void MCReadCat(int fd);
static void MCWriteCat(int fd);
static void MCDelMsg(int msgId);
static void MCAddMsg(int msgId, const char *msg);
static void MCAddSet(int setId);
static void MCDelSet(int setId);
__dead static void usage(void);
#define CORRUPT "corrupt message catalog"
#define NOMEMORY "out of memory"
void
static void
usage(void)
{
fprintf(stderr, "usage: %s catfile msgfile ...\n", getprogname());
@ -442,7 +441,7 @@ getmsg(int fd, char *cptr, char quote)
return (msg);
}
void
static void
MCParse(int fd)
{
char *cptr, *str;
@ -533,7 +532,7 @@ MCParse(int fd)
}
}
void
static void
MCReadCat(int fd)
{
void *msgcat; /* message catalog data */
@ -631,7 +630,7 @@ MCReadCat(int fd)
* avoids additional housekeeping variables and/or a lot of seeks
* that would otherwise be required.
*/
void
static void
MCWriteCat(int fd)
{
int nsets; /* number of sets */
@ -736,7 +735,7 @@ MCWriteCat(int fd)
write(fd, msgcat, msgcat_size);
}
void
static void
MCAddSet(int setId)
{
struct _setT *p, *q;
@ -773,7 +772,7 @@ MCAddSet(int setId)
curSet = p;
}
void
static void
MCAddMsg(int msgId, const char *str)
{
struct _msgT *p, *q;
@ -811,7 +810,7 @@ MCAddMsg(int msgId, const char *str)
p->str = xstrdup(str);
}
void
static void
MCDelSet(int setId)
{
struct _setT *set;
@ -842,7 +841,7 @@ MCDelSet(int setId)
warning(NULL, "specified set doesn't exist");
}
void
static void
MCDelMsg(int msgId)
{
struct _msgT *msg;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hexdump.h,v 1.12 2010/11/27 20:46:38 christos Exp $ */
/* $NetBSD: hexdump.h,v 1.13 2011/09/04 20:27:27 joerg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -81,10 +81,6 @@ extern enum _vflag vflag;
void add(const char *);
void addfile(char *);
void badcnt(char *);
void badconv(char *);
void badfmt(const char *);
void badsfmt(void);
void bpad(PR *);
void conv_c(PR *, u_char *);
void conv_u(PR *, u_char *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.26 2009/01/18 21:34:32 apb Exp $ */
/* $NetBSD: parse.c,v 1.27 2011/09/04 20:27:27 joerg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: parse.c,v 1.26 2009/01/18 21:34:32 apb Exp $");
__RCSID("$NetBSD: parse.c,v 1.27 2011/09/04 20:27:27 joerg Exp $");
#endif
#endif /* not lint */
@ -57,6 +57,11 @@ __RCSID("$NetBSD: parse.c,v 1.26 2009/01/18 21:34:32 apb Exp $");
#include "hexdump.h"
__dead static void badcnt(char *);
__dead static void badconv(char *);
__dead static void badfmt(const char *);
__dead static void badsfmt(void);
FU *endfu; /* format at end-of-data */
void
@ -518,25 +523,25 @@ escape(char *p1)
}
}
void
static void
badcnt(char *s)
{
errx(1, "%s: bad byte count", s);
}
void
static void
badsfmt(void)
{
errx(1, "%%s: requires a precision or a byte count");
}
void
static void
badfmt(const char *fmt)
{
errx(1, "\"%s\": bad format", fmt);
}
void
static void
badconv(char *ch)
{
errx(1, "%%%s: bad conversion character", ch);

View File

@ -1,4 +1,4 @@
/* $NetBSD: join.c,v 1.30 2009/04/12 11:18:21 lukem Exp $ */
/* $NetBSD: join.c,v 1.31 2011/09/04 20:27:52 joerg Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991\
#if 0
static char sccsid[] = "from: @(#)join.c 5.1 (Berkeley) 11/18/91";
#else
__RCSID("$NetBSD: join.c,v 1.30 2009/04/12 11:18:21 lukem Exp $");
__RCSID("$NetBSD: join.c,v 1.31 2011/09/04 20:27:52 joerg Exp $");
#endif
#endif /* not lint */
@ -74,8 +74,8 @@ typedef struct {
u_long fieldalloc; /* line field(s) allocated count */
} LINE;
char nolineline[1] = { '\0' };
LINE noline = {nolineline, 0, 0, 0, 0}; /* arg for outfield if no line to output */
static char nolineline[1] = { '\0' };
static LINE noline = {nolineline, 0, 0, 0, 0}; /* arg for outfield if no line to output */
typedef struct {
FILE *fp; /* file descriptor */
@ -88,34 +88,35 @@ typedef struct {
u_long setcnt; /* set count */
u_long setalloc; /* set allocated count */
} INPUT;
INPUT input1 = { NULL, 0, 0, 1, NULL, -1, 0, 0, },
static INPUT input1 = { NULL, 0, 0, 1, NULL, -1, 0, 0, },
input2 = { NULL, 0, 0, 2, NULL, -1, 0, 0, };
typedef struct {
u_long fileno; /* file number */
u_long fieldno; /* field number */
} OLIST;
OLIST *olist; /* output field list */
u_long olistcnt; /* output field list count */
u_long olistalloc; /* output field allocated count */
int joinout = 1; /* show lines with matched join fields (-v) */
int needsep; /* need separator character */
int spans = 1; /* span multiple delimiters (-t) */
char *empty; /* empty field replacement string (-e) */
const char *tabchar = " \t"; /* delimiter characters (-t) */
static OLIST *olist; /* output field list */
static u_long olistcnt; /* output field list count */
static u_long olistalloc; /* output field allocated count */
int cmp(LINE *, u_long, LINE *, u_long);
void enomem(void);
void fieldarg(char *);
void joinlines(INPUT *, INPUT *);
int main(int, char **);
void obsolete(char **);
void outfield(LINE *, u_long);
void outoneline(INPUT *, LINE *);
void outtwoline(INPUT *, LINE *, INPUT *, LINE *);
void slurp(INPUT *);
void usage(void);
static int joinout = 1; /* show lines with matched join fields (-v) */
static int needsep; /* need separator character */
static int spans = 1; /* span multiple delimiters (-t) */
static char *empty; /* empty field replacement string (-e) */
static const char *tabchar = " \t"; /* delimiter characters (-t) */
static int cmp(LINE *, u_long, LINE *, u_long);
__dead static void enomem(void);
static void fieldarg(char *);
static void joinlines(INPUT *, INPUT *);
static void obsolete(char **);
static void outfield(LINE *, u_long);
static void outoneline(INPUT *, LINE *);
static void outtwoline(INPUT *, LINE *, INPUT *, LINE *);
static void slurp(INPUT *);
__dead static void usage(void);
int
main(int argc, char *argv[])
@ -295,7 +296,7 @@ main(int argc, char *argv[])
return 0;
}
void
static void
slurp(INPUT *F)
{
LINE *lp;
@ -401,7 +402,7 @@ slurp(INPUT *F)
}
}
int
static int
cmp(LINE *lp1, u_long fieldno1, LINE *lp2, u_long fieldno2)
{
@ -412,7 +413,7 @@ cmp(LINE *lp1, u_long fieldno1, LINE *lp2, u_long fieldno2)
return (strcmp(lp1->fields[fieldno1], lp2->fields[fieldno2]));
}
void
static void
joinlines(INPUT *F1, INPUT *F2)
{
u_long cnt1, cnt2;
@ -432,7 +433,7 @@ joinlines(INPUT *F1, INPUT *F2)
outtwoline(F1, &F1->set[cnt1], F2, &F2->set[cnt2]);
}
void
static void
outoneline(INPUT *F, LINE *lp)
{
u_long cnt;
@ -458,7 +459,7 @@ outoneline(INPUT *F, LINE *lp)
needsep = 0;
}
void
static void
outtwoline(INPUT *F1, LINE *lp1, INPUT *F2, LINE *lp2)
{
u_long cnt;
@ -489,7 +490,7 @@ outtwoline(INPUT *F1, LINE *lp1, INPUT *F2, LINE *lp2)
needsep = 0;
}
void
static void
outfield(LINE *lp, u_long fieldno)
{
if (needsep++)
@ -512,7 +513,7 @@ outfield(LINE *lp, u_long fieldno)
* Convert an output list argument "2.1, 1.3, 2.4" into an array of output
* fields.
*/
void
static void
fieldarg(char *option)
{
u_long fieldno;
@ -542,7 +543,7 @@ fieldarg(char *option)
}
}
void
static void
obsolete(char **argv)
{
size_t len;
@ -619,13 +620,13 @@ jbad: errx(1, "illegal option -- %s", ap);
}
}
void
static void
enomem(void)
{
errx(1, "no memory");
}
void
static void
usage(void)
{
(void)fprintf(stderr,