From owner-svn-src-head@FreeBSD.ORG Tue Jan 27 07:40:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 675A6106568A; Tue, 27 Jan 2009 07:40:17 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A0E78FC08; Tue, 27 Jan 2009 07:40:17 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n0R7eH6x077861; Tue, 27 Jan 2009 07:40:17 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n0R7eHY7077859; Tue, 27 Jan 2009 07:40:17 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200901270740.n0R7eHY7077859@svn.freebsd.org> From: Luigi Rizzo Date: Tue, 27 Jan 2009 07:40:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r187762 - head/sbin/ipfw X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jan 2009 07:40:18 -0000 Author: luigi Date: Tue Jan 27 07:40:16 2009 New Revision: 187762 URL: http://svn.freebsd.org/changeset/base/187762 Log: remove a couple of rarely used #define; change PRINT_UINT from a macro to a function (renaming is postponed to reduce clutter) Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Tue Jan 27 07:29:37 2009 (r187761) +++ head/sbin/ipfw/ipfw2.c Tue Jan 27 07:40:16 2009 (r187762) @@ -77,7 +77,6 @@ int comment_only, /* only print action and comment */ verbose; -#define IP_MASK_ALL 0xffffffff /* * the following macro returns an error message if we run out of * arguments. @@ -113,14 +112,16 @@ int } \ } while (0) -#define PRINT_UINT_ARG(str, arg) do { \ - if (str != NULL) \ - printf("%s",str); \ - if (arg == IP_FW_TABLEARG) \ - printf("tablearg"); \ - else \ - printf("%u", (uint32_t)arg); \ -} while (0) +static void +PRINT_UINT_ARG(const char *str, uint32_t arg) +{ + if (str != NULL) + printf("%s",str); + if (arg == IP_FW_TABLEARG) + printf("tablearg"); + else + printf("%u", arg); +} /* * _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 */ }; -#define TABLEARG "tablearg" - static __inline uint64_t align_uint64(uint64_t *pll) { uint64_t ret; @@ -2958,7 +2957,7 @@ fill_ip(ipfw_insn_ip *cmd, char *av) return; } /* 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); return; } @@ -4916,7 +4915,7 @@ chkarg: if (action->arg1 <= 0 || action->arg1 >= IP_FW_TABLEARG) errx(EX_DATAERR, "illegal argument for %s", *(av - 1)); - } else if (_substrcmp(*av, TABLEARG) == 0) { + } else if (_substrcmp(*av, "tablearg") == 0) { action->arg1 = IP_FW_TABLEARG; } else if (i == TOK_DIVERT || i == TOK_TEE) { struct servent *s;