From c01bd7436f6090b56269cc0f7f3902a85d8a1424 Mon Sep 17 00:00:00 2001 From: espie Date: Sun, 26 Nov 2023 16:04:17 +0000 Subject: [PATCH] mark functions as static when they're unused elsewhere, makes the code slightly easier to understand. okay and tweak kn@ --- bin/pax/buf_subs.c | 9 ++++++--- bin/pax/extern.h | 14 +------------- bin/pax/file_subs.c | 17 +++++++++++------ bin/pax/options.c | 12 +++++++----- bin/pax/pax.c | 5 +++-- bin/pax/tables.c | 5 +++-- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/bin/pax/buf_subs.c b/bin/pax/buf_subs.c index e510f542e55..d278b3d4b4c 100644 --- a/bin/pax/buf_subs.c +++ b/bin/pax/buf_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf_subs.c,v 1.31 2019/06/28 13:34:59 deraadt Exp $ */ +/* $OpenBSD: buf_subs.c,v 1.32 2023/11/26 16:04:17 espie Exp $ */ /* $NetBSD: buf_subs.c,v 1.5 1995/03/21 09:07:08 cgd Exp $ */ /*- @@ -48,6 +48,9 @@ * routines which implement archive and file buffering */ +static int buf_fill(void); +static int buf_flush(int); + #define MINFBSZ 512 /* default block size for hole detect */ #define MAXFLT 10 /* default media read error limit */ @@ -825,7 +828,7 @@ cp_file(ARCHD *arcn, int fd1, int fd2) * 0 when finished (user specified termination in ar_next()). */ -int +static int buf_fill(void) { int cnt; @@ -873,7 +876,7 @@ buf_fill(void) * 0 if all is ok, -1 when a write error occurs. */ -int +static int buf_flush(int bufcnt) { int cnt; diff --git a/bin/pax/extern.h b/bin/pax/extern.h index 67a21d86611..3d7303c42cb 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.60 2020/03/23 20:04:19 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.61 2023/11/26 16:04:17 espie Exp $ */ /* $NetBSD: extern.h,v 1.5 1996/03/26 23:54:16 mrg Exp $ */ /*- @@ -92,8 +92,6 @@ int wr_skip(off_t); int wr_rdfile(ARCHD *, int, off_t *); int rd_wrfile(ARCHD *, int, off_t *); void cp_file(ARCHD *, int, int); -int buf_fill(void); -int buf_flush(int); /* * cpio.c @@ -127,16 +125,10 @@ int lnk_creat(ARCHD *); int cross_lnk(ARCHD *); int chk_same(ARCHD *); int node_creat(ARCHD *); -int unlnk_exist(char *, int); -int chk_path(char *, uid_t, gid_t, int); void set_ftime(const char *, const struct timespec *, const struct timespec *, int); -void fset_ftime(const char *, int, const struct timespec *, - const struct timespec *, int); int set_ids(char *, uid_t, gid_t); -int fset_ids(char *, int, uid_t, gid_t); void set_pmode(char *, mode_t); -void fset_pmode(char *, int, mode_t); int set_attr(const struct file_times *, int _force_times, mode_t, int _do_mode, int _in_sig); int file_write(int, char *, int, int *, int *, int, char *); @@ -178,8 +170,6 @@ extern FSUB fsub[]; extern int ford[]; void options(int, char **); OPLIST * opt_next(void); -int opt_add(const char *); -int bad_opt(void); extern char *chdname; /* @@ -235,7 +225,6 @@ extern char *tempfile; extern char *tempbase; extern int havechd; -void sig_cleanup(int); /* * sel_subs.c @@ -279,7 +268,6 @@ int dir_start(void); void add_dir(char *, struct stat *, int); void delete_dir(dev_t, ino_t); void proc_dir(int _in_sig); -u_int st_hash(const char *, int, int); /* * tar.c diff --git a/bin/pax/file_subs.c b/bin/pax/file_subs.c index 34c59d22d69..6f81f94001c 100644 --- a/bin/pax/file_subs.c +++ b/bin/pax/file_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file_subs.c,v 1.55 2020/03/23 20:04:19 espie Exp $ */ +/* $OpenBSD: file_subs.c,v 1.56 2023/11/26 16:04:17 espie Exp $ */ /* $NetBSD: file_subs.c,v 1.4 1995/03/21 09:07:18 cgd Exp $ */ /*- @@ -46,8 +46,13 @@ #include "pax.h" #include "extern.h" -static int -mk_link(char *, struct stat *, char *, int); +static int fset_ids(char *, int, uid_t, gid_t); +static int unlnk_exist(char *, int); +static int chk_path(char *, uid_t, gid_t, int); +static int mk_link(char *, struct stat *, char *, int); +static void fset_ftime(const char *, int, const struct timespec *, + const struct timespec *, int); +static void fset_pmode(char *, int, mode_t); /* * routines that deal with file operations such as: creating, removing; @@ -537,7 +542,7 @@ badlink: * 1 we found a directory and we were going to create a directory. */ -int +static int unlnk_exist(char *name, int type) { struct stat sb; @@ -715,7 +720,7 @@ set_ftime(const char *fnm, const struct timespec *mtimp, fnm); } -void +static void fset_ftime(const char *fnm, int fd, const struct timespec *mtimp, const struct timespec *atimp, int frc) { @@ -797,7 +802,7 @@ set_pmode(char *fnm, mode_t mode) syswarn(1, errno, "Could not set permissions on %s", fnm); } -void +static void fset_pmode(char *fnm, int fd, mode_t mode) { mode &= ABITS; diff --git a/bin/pax/options.c b/bin/pax/options.c index 1ed9f98f5d6..835c38f00b2 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.105 2023/01/17 16:20:28 tb Exp $ */ +/* $OpenBSD: options.c,v 1.106 2023/11/26 16:04:17 espie Exp $ */ /* $NetBSD: options.c,v 1.6 1996/03/26 23:54:18 mrg Exp $ */ /*- @@ -49,6 +49,8 @@ #include "tar.h" #include "extern.h" +static int bad_opt(void); +static int opt_add(const char *); /* * argv[0] names. Used for tar and cpio emulation */ @@ -1104,9 +1106,9 @@ tar_options(int argc, char **argv) } } -int mkpath(char *); +static int mkpath(char *); -int +static int mkpath(char *path) { struct stat sb; @@ -1474,7 +1476,7 @@ opt_next(void) * when the format does not support options. */ -int +static int bad_opt(void) { OPLIST *opt; @@ -1500,7 +1502,7 @@ bad_opt(void) * 0 if format in name=value format, -1 if -o is passed junk */ -int +static int opt_add(const char *str) { OPLIST *opt; diff --git a/bin/pax/pax.c b/bin/pax/pax.c index 1bdb6160bd5..b961d0cea54 100644 --- a/bin/pax/pax.c +++ b/bin/pax/pax.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pax.c,v 1.56 2023/11/09 18:54:15 kn Exp $ */ +/* $OpenBSD: pax.c,v 1.57 2023/11/26 16:04:17 espie Exp $ */ /* $NetBSD: pax.c,v 1.5 1996/03/26 23:54:20 mrg Exp $ */ /*- @@ -52,6 +52,7 @@ #include "pax.h" #include "extern.h" static int gen_init(void); +static void sig_cleanup(int); /* * PAX main routines, general globals and some simple start up routines @@ -337,7 +338,7 @@ main(int argc, char **argv) * never.... */ -void +static void sig_cleanup(int which_sig) { /* diff --git a/bin/pax/tables.c b/bin/pax/tables.c index f3021df95b4..99247266f2f 100644 --- a/bin/pax/tables.c +++ b/bin/pax/tables.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tables.c,v 1.54 2019/06/28 05:35:34 deraadt Exp $ */ +/* $OpenBSD: tables.c,v 1.55 2023/11/26 16:04:17 espie Exp $ */ /* $NetBSD: tables.c,v 1.4 1995/03/21 09:07:45 cgd Exp $ */ /*- @@ -47,6 +47,7 @@ #include "pax.h" #include "extern.h" +static u_int st_hash(const char *, int, int); /* * Routines for controlling the contents of all the different databases pax @@ -1723,7 +1724,7 @@ proc_dir(int in_sig) * the hash value of the string MOD (%) the table size. */ -u_int +static u_int st_hash(const char *name, int len, int tabsz) { const char *pt; -- 2.20.1