git: 7aecd12d9cbd - main - ifconfig: use c99 designated initializers for DEF_CMD
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 May 2022 20:59:49 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7aecd12d9cbd9419dc07f7847055977cfbc8131f commit 7aecd12d9cbd9419dc07f7847055977cfbc8131f Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-12-20 05:53:41 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2022-05-24 20:59:32 +0000 ifconfig: use c99 designated initializers for DEF_CMD Reviewed by: hselasky, jhb, kp Sponsored by: NVIDIA Networking MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D32551 --- sbin/ifconfig/ifconfig.h | 56 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 8f4e494fdde0..76f6ef926a5c 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -76,13 +76,55 @@ void callback_register(callback_func *, void *); void name(const char *arg1, const char *arg2, int s, \ const struct afswtch *afp) -#define DEF_CMD(name, param, func) { name, param, { .c_func = func }, 0, NULL } -#define DEF_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func }, 0, NULL } -#define DEF_CMD_OPTARG(name, func) { name, OPTARG, { .c_func = func }, 0, NULL } -#define DEF_CMD_ARG2(name, func) { name, NEXTARG2, { .c_func2 = func }, 0, NULL } -#define DEF_CLONE_CMD(name, param, func) { name, param, { .c_func = func }, 1, NULL } -#define DEF_CLONE_CMD_ARG(name, func) { name, NEXTARG, { .c_func = func }, 1, NULL } -#define DEF_CLONE_CMD_ARG2(name, func) { name, NEXTARG2, { .c_func2 = func }, 1, NULL } +#define DEF_CMD(name, param, func) { \ + .c_name = (name), \ + .c_parameter = (param), \ + .c_u = { .c_func = (func) }, \ + .c_iscloneop = 0, \ + .c_next = NULL, +} +#define DEF_CMD_ARG(name, func) { \ + .c_name = (name), \ + .c_parameter = NEXTARG, \ + .c_u = { .c_func = (func) }, \ + .c_iscloneop = 0, \ + .c_next = NULL, \ +} +#define DEF_CMD_OPTARG(name, func) { \ + .c_name = (name), \ + .c_parameter = OPTARG, \ + .c_u = { .c_func = (func) }, \ + .c_iscloneop = 0, \ + .c_next = NULL, \ +} +#define DEF_CMD_ARG2(name, func) { \ + .c_name = (name), \ + .c_parameter = NEXTARG2, \ + .c_u = { .c_func2 = (func) }, \ + .c_iscloneop = 0, \ + .c_next = NULL, \ +} +#define DEF_CLONE_CMD(name, param, func) { \ + .c_name = (name), \ + .c_parameter = (param), \ + .c_u = { .c_func = (func) }, \ + .c_iscloneop = 1, \ + .c_next = NULL, \ +} +#define DEF_CLONE_CMD_ARG(name, func) { \ + .c_name = (name), \ + .c_parameter = NEXTARG, \ + .c_u = { .c_func = (func) }, \ + .c_iscloneop = 1, \ + .c_next = NULL, \ +} +#define DEF_CLONE_CMD_ARG2(name, func) { \ + .c_name = (name), \ + .c_parameter = NEXTARG2, \ + .c_u = { .c_func2 = (func) }, \ + .c_iscloneop = 1, \ + .c_next = NULL, \ +} struct ifaddrs; struct addrinfo;