remove a couple of rarely used #define;
change PRINT_UINT from a macro to a function (renaming is postponed to reduce clutter)
This commit is contained in:
parent
597979c4b7
commit
be39e0b2b1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=187762
@ -77,7 +77,6 @@ int
|
|||||||
comment_only, /* only print action and comment */
|
comment_only, /* only print action and comment */
|
||||||
verbose;
|
verbose;
|
||||||
|
|
||||||
#define IP_MASK_ALL 0xffffffff
|
|
||||||
/*
|
/*
|
||||||
* the following macro returns an error message if we run out of
|
* the following macro returns an error message if we run out of
|
||||||
* arguments.
|
* arguments.
|
||||||
@ -113,14 +112,16 @@ int
|
|||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define PRINT_UINT_ARG(str, arg) do { \
|
static void
|
||||||
if (str != NULL) \
|
PRINT_UINT_ARG(const char *str, uint32_t arg)
|
||||||
printf("%s",str); \
|
{
|
||||||
if (arg == IP_FW_TABLEARG) \
|
if (str != NULL)
|
||||||
printf("tablearg"); \
|
printf("%s",str);
|
||||||
else \
|
if (arg == IP_FW_TABLEARG)
|
||||||
printf("%u", (uint32_t)arg); \
|
printf("tablearg");
|
||||||
} while (0)
|
else
|
||||||
|
printf("%u", arg);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* _s_x is a structure that stores a string <-> token pairs, used in
|
* _s_x is a structure that stores a string <-> token pairs, used in
|
||||||
@ -501,8 +502,6 @@ struct _s_x rule_options[] = {
|
|||||||
{ NULL, 0 } /* terminator */
|
{ NULL, 0 } /* terminator */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TABLEARG "tablearg"
|
|
||||||
|
|
||||||
static __inline uint64_t
|
static __inline uint64_t
|
||||||
align_uint64(uint64_t *pll) {
|
align_uint64(uint64_t *pll) {
|
||||||
uint64_t ret;
|
uint64_t ret;
|
||||||
@ -2958,7 +2957,7 @@ fill_ip(ipfw_insn_ip *cmd, char *av)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* A single IP can be stored in an optimized format */
|
/* A single IP can be stored in an optimized format */
|
||||||
if (d[1] == IP_MASK_ALL && av == NULL && len == 0) {
|
if (d[1] == ~0 && av == NULL && len == 0) {
|
||||||
cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32);
|
cmd->o.len |= F_INSN_SIZE(ipfw_insn_u32);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4916,7 +4915,7 @@ add(int ac, char *av[])
|
|||||||
if (action->arg1 <= 0 || action->arg1 >= IP_FW_TABLEARG)
|
if (action->arg1 <= 0 || action->arg1 >= IP_FW_TABLEARG)
|
||||||
errx(EX_DATAERR, "illegal argument for %s",
|
errx(EX_DATAERR, "illegal argument for %s",
|
||||||
*(av - 1));
|
*(av - 1));
|
||||||
} else if (_substrcmp(*av, TABLEARG) == 0) {
|
} else if (_substrcmp(*av, "tablearg") == 0) {
|
||||||
action->arg1 = IP_FW_TABLEARG;
|
action->arg1 = IP_FW_TABLEARG;
|
||||||
} else if (i == TOK_DIVERT || i == TOK_TEE) {
|
} else if (i == TOK_DIVERT || i == TOK_TEE) {
|
||||||
struct servent *s;
|
struct servent *s;
|
||||||
|
Loading…
Reference in New Issue
Block a user