Michal Mazurek
2016-02-08 14:04:28 UTC
Move some declarations out of hexdump.h
Mark some declarations as __dead or static
Remove a commented out declaration
Convert some spaces to tabs
Index: display.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/display.c,v
retrieving revision 1.21
diff -u -p -r1.21 display.c
--- display.c 16 Jan 2015 06:40:08 -0000 1.21
+++ display.c 8 Feb 2016 13:56:10 -0000
@@ -49,7 +49,10 @@ enum _vflag vflag = FIRST;
static off_t address; /* address/offset in stream */
static off_t eaddress; /* end address */
-static __inline void print(PR *, u_char *);
+static void bpad(PR *);
+static void doskip(const char *, int);
+static __inline void print(PR *, u_char *);
+static u_char *get(void);
void
display(void)
@@ -196,7 +199,7 @@ print(PR *pr, u_char *bp)
}
}
-void
+static void
bpad(PR *pr)
{
static const char *spec = " -0+#";
@@ -216,7 +219,7 @@ bpad(PR *pr)
static char **_argv;
-u_char *
+static u_char *
get(void)
{
static int ateof = 1;
@@ -319,7 +322,7 @@ next(char **argv)
/* NOTREACHED */
}
-void
+static void
doskip(const char *fname, int statok)
{
off_t cnt;
Index: hexdump.h
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/hexdump.h,v
retrieving revision 1.10
diff -u -p -r1.10 hexdump.h
--- hexdump.h 19 Apr 2014 09:28:20 -0000 1.10
+++ hexdump.h 8 Feb 2016 13:56:10 -0000
@@ -78,30 +78,19 @@ extern int exitval; /* final exit valu
extern FS *fshead; /* head of format strings list */
extern long length; /* max bytes to read */
extern off_t skip; /* bytes to skip */
-extern char *iobuf; /* stdio I/O buffer */
-extern size_t iobufsiz; /* size of stdio I/O buffer */
+extern char *iobuf; /* stdio I/O buffer */
+extern size_t iobufsiz; /* size of stdio I/O buffer */
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 *);
void display(void);
-void doskip(const char *, int);
-/*void err(const char *, ...);*/
void *emalloc(int);
-void escape(char *);
-u_char *get(void);
void newsyntax(int, char ***);
int next(char **);
void nomem(void);
void oldsyntax(int, char ***);
void rewrite(FS *);
int size(FS *);
-void usage(void);
-void oldusage(void);
Index: hexsyntax.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/hexsyntax.c,v
retrieving revision 1.12
diff -u -p -r1.12 hexsyntax.c
--- hexsyntax.c 6 May 2011 15:46:29 -0000 1.12
+++ hexsyntax.c 8 Feb 2016 13:56:10 -0000
@@ -43,6 +43,8 @@
off_t skip; /* bytes to skip */
+static __dead void usage(void);
+
void
newsyntax(int argc, char ***argvp)
{
@@ -121,7 +123,7 @@ newsyntax(int argc, char ***argvp)
*argvp += optind;
}
-void
+static __dead void
usage(void)
{
extern char *__progname;
Index: odsyntax.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/odsyntax.c,v
retrieving revision 1.26
diff -u -p -r1.26 odsyntax.c
--- odsyntax.c 16 Sep 2015 08:47:26 -0000 1.26
+++ odsyntax.c 8 Feb 2016 13:56:10 -0000
@@ -44,10 +44,10 @@
int odmode;
-static void odoffset(int, char ***);
-static void posixtypes(char *);
-static void odadd(const char *);
-
+static void odadd(const char *);
+static void odoffset(int, char ***);
+static __dead void oldusage(void);
+static void posixtypes(char *);
/*
* formats used for -t
@@ -293,7 +293,7 @@ posixtypes(char *type_string)
}
}
-void
+static __dead void
oldusage(void)
{
extern char *__progname;
Index: parse.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/parse.c,v
retrieving revision 1.17
diff -u -p -r1.17 parse.c
--- parse.c 27 Oct 2009 23:59:39 -0000 1.17
+++ parse.c 8 Feb 2016 13:56:10 -0000
@@ -45,6 +45,12 @@
FU *endfu; /* format at end-of-data */
+static __dead void badcnt(char *);
+static __dead void badconv(char *);
+static __dead void badfmt(const char *);
+static __dead void badsfmt(void);
+static void escape(char *);
+
void
addfile(char *name)
{
@@ -453,7 +459,7 @@ rewrite(FS *fs)
#endif
}
-void
+static void
escape(char *p1)
{
char *p2;
@@ -501,25 +507,25 @@ escape(char *p1)
}
}
-void
+static __dead void
badcnt(char *s)
{
errx(1, "%s: bad byte count", s);
}
-void
+static __dead void
badsfmt(void)
{
errx(1, "%%s: requires a precision or a byte count");
}
-void
+static __dead void
badfmt(const char *fmt)
{
errx(1, "\"%s\": bad format", fmt);
}
-void
+static __dead void
badconv(char *ch)
{
errx(1, "%%%s: bad conversion character", ch);
Mark some declarations as __dead or static
Remove a commented out declaration
Convert some spaces to tabs
Index: display.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/display.c,v
retrieving revision 1.21
diff -u -p -r1.21 display.c
--- display.c 16 Jan 2015 06:40:08 -0000 1.21
+++ display.c 8 Feb 2016 13:56:10 -0000
@@ -49,7 +49,10 @@ enum _vflag vflag = FIRST;
static off_t address; /* address/offset in stream */
static off_t eaddress; /* end address */
-static __inline void print(PR *, u_char *);
+static void bpad(PR *);
+static void doskip(const char *, int);
+static __inline void print(PR *, u_char *);
+static u_char *get(void);
void
display(void)
@@ -196,7 +199,7 @@ print(PR *pr, u_char *bp)
}
}
-void
+static void
bpad(PR *pr)
{
static const char *spec = " -0+#";
@@ -216,7 +219,7 @@ bpad(PR *pr)
static char **_argv;
-u_char *
+static u_char *
get(void)
{
static int ateof = 1;
@@ -319,7 +322,7 @@ next(char **argv)
/* NOTREACHED */
}
-void
+static void
doskip(const char *fname, int statok)
{
off_t cnt;
Index: hexdump.h
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/hexdump.h,v
retrieving revision 1.10
diff -u -p -r1.10 hexdump.h
--- hexdump.h 19 Apr 2014 09:28:20 -0000 1.10
+++ hexdump.h 8 Feb 2016 13:56:10 -0000
@@ -78,30 +78,19 @@ extern int exitval; /* final exit valu
extern FS *fshead; /* head of format strings list */
extern long length; /* max bytes to read */
extern off_t skip; /* bytes to skip */
-extern char *iobuf; /* stdio I/O buffer */
-extern size_t iobufsiz; /* size of stdio I/O buffer */
+extern char *iobuf; /* stdio I/O buffer */
+extern size_t iobufsiz; /* size of stdio I/O buffer */
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 *);
void display(void);
-void doskip(const char *, int);
-/*void err(const char *, ...);*/
void *emalloc(int);
-void escape(char *);
-u_char *get(void);
void newsyntax(int, char ***);
int next(char **);
void nomem(void);
void oldsyntax(int, char ***);
void rewrite(FS *);
int size(FS *);
-void usage(void);
-void oldusage(void);
Index: hexsyntax.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/hexsyntax.c,v
retrieving revision 1.12
diff -u -p -r1.12 hexsyntax.c
--- hexsyntax.c 6 May 2011 15:46:29 -0000 1.12
+++ hexsyntax.c 8 Feb 2016 13:56:10 -0000
@@ -43,6 +43,8 @@
off_t skip; /* bytes to skip */
+static __dead void usage(void);
+
void
newsyntax(int argc, char ***argvp)
{
@@ -121,7 +123,7 @@ newsyntax(int argc, char ***argvp)
*argvp += optind;
}
-void
+static __dead void
usage(void)
{
extern char *__progname;
Index: odsyntax.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/odsyntax.c,v
retrieving revision 1.26
diff -u -p -r1.26 odsyntax.c
--- odsyntax.c 16 Sep 2015 08:47:26 -0000 1.26
+++ odsyntax.c 8 Feb 2016 13:56:10 -0000
@@ -44,10 +44,10 @@
int odmode;
-static void odoffset(int, char ***);
-static void posixtypes(char *);
-static void odadd(const char *);
-
+static void odadd(const char *);
+static void odoffset(int, char ***);
+static __dead void oldusage(void);
+static void posixtypes(char *);
/*
* formats used for -t
@@ -293,7 +293,7 @@ posixtypes(char *type_string)
}
}
-void
+static __dead void
oldusage(void)
{
extern char *__progname;
Index: parse.c
===================================================================
RCS file: /cvs/src/usr.bin/hexdump/parse.c,v
retrieving revision 1.17
diff -u -p -r1.17 parse.c
--- parse.c 27 Oct 2009 23:59:39 -0000 1.17
+++ parse.c 8 Feb 2016 13:56:10 -0000
@@ -45,6 +45,12 @@
FU *endfu; /* format at end-of-data */
+static __dead void badcnt(char *);
+static __dead void badconv(char *);
+static __dead void badfmt(const char *);
+static __dead void badsfmt(void);
+static void escape(char *);
+
void
addfile(char *name)
{
@@ -453,7 +459,7 @@ rewrite(FS *fs)
#endif
}
-void
+static void
escape(char *p1)
{
char *p2;
@@ -501,25 +507,25 @@ escape(char *p1)
}
}
-void
+static __dead void
badcnt(char *s)
{
errx(1, "%s: bad byte count", s);
}
-void
+static __dead void
badsfmt(void)
{
errx(1, "%%s: requires a precision or a byte count");
}
-void
+static __dead void
badfmt(const char *fmt)
{
errx(1, "\"%s\": bad format", fmt);
}
-void
+static __dead void
badconv(char *ch)
{
errx(1, "%%%s: bad conversion character", ch);
--
Michal Mazurek
Michal Mazurek