git: ea73ff9752f7 - main - ifconfig: remove global_args variable.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 Jun 2023 06:27:04 UTC
The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=ea73ff9752f77b3ed0d20f3d958fda8b51b0cf23 commit ea73ff9752f77b3ed0d20f3d958fda8b51b0cf23 Author: Alexander V. Chernikov <melifaro@FreeBSD.org> AuthorDate: 2023-06-13 06:25:10 +0000 Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> CommitDate: 2023-06-13 06:25:16 +0000 ifconfig: remove global_args variable. This variable was temporarily introduced in the beginning of the code cleanup. Use on-stack instance in main() instead. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D40439 MFC after: 2 weeks --- sbin/ifconfig/ifconfig.c | 5 ++--- sbin/ifconfig/ifconfig.h | 1 - sbin/ifconfig/ifmedia.c | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 0ccca3666bed..7b01b2d547ba 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -103,8 +103,6 @@ static int doalias; static int clearaddr; int newaddr = 1; -struct ifconfig_args global_args; - int exit_code = 0; static char ifname_to_print[IFNAMSIZ]; /* Helper for printifnamemaybe() */ @@ -615,7 +613,8 @@ main(int ac, char *av[]) #ifdef JAIL int jid; #endif - struct ifconfig_args *args = &global_args; + struct ifconfig_args _args = {}; + struct ifconfig_args *args = &_args; f_inet = f_inet6 = f_ether = f_addr = NULL; diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 45d05d1bf077..187743a315c5 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -254,7 +254,6 @@ extern struct ifreq ifr; extern int allmedia; extern int newaddr; extern int exit_code; -extern struct ifconfig_args global_args; extern char *f_inet, *f_inet6, *f_ether, *f_addr; void setifcap(if_ctx *ctx, const char *, int value); diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c index b3331b97e358..122756207d1b 100644 --- a/sbin/ifconfig/ifmedia.c +++ b/sbin/ifconfig/ifmedia.c @@ -144,7 +144,7 @@ media_status(if_ctx *ctx) putchar('\n'); } - if (global_args.supmedia) { + if (ctx->args->supmedia) { printf("\tsupported media:\n"); for (int i = 0; i < ifmr->ifm_count; ++i) { printf("\t\t");