mirror of
https://git.FreeBSD.org/src.git
synced 2024-10-19 02:29:40 +00:00
ipf: Use nitems(foo) instead of sizeof(foo)/sizeof(foo[0])
Pull Request: https://github.com/freebsd/freebsd-src/pull/888 Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
This commit is contained in:
parent
7028e630d6
commit
70fad8acae
@ -10,6 +10,7 @@
|
||||
# include "netinet/ip_scan.h"
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/param.h>
|
||||
#include <syslog.h>
|
||||
#ifdef TEST_LEXER
|
||||
# define NO_YACC
|
||||
@ -675,7 +676,7 @@ yysetfixeddict(wordtab_t *newdict)
|
||||
if (yydebug)
|
||||
printf("yysetfixeddict(%lx)\n", (u_long)newdict);
|
||||
|
||||
if (yysavedepth == sizeof(yysavewords)/sizeof(yysavewords[0])) {
|
||||
if (yysavedepth == nitems(yysavewords)) {
|
||||
fprintf(stderr, "%d: at maximum dictionary depth\n",
|
||||
yylineNum);
|
||||
return;
|
||||
@ -694,7 +695,7 @@ yysetdict(wordtab_t *newdict)
|
||||
if (yydebug)
|
||||
printf("yysetdict(%lx)\n", (u_long)newdict);
|
||||
|
||||
if (yysavedepth == sizeof(yysavewords)/sizeof(yysavewords[0])) {
|
||||
if (yysavedepth == nitems(yysavewords)) {
|
||||
fprintf(stderr, "%d: at maximum dictionary depth\n",
|
||||
yylineNum);
|
||||
return;
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#if !defined(__SVR4) && !defined(__svr4__)
|
||||
#include <strings.h>
|
||||
#endif
|
||||
@ -76,7 +76,7 @@ fac_toname(int facpri)
|
||||
|
||||
fac = facpri & LOG_FACMASK;
|
||||
j = fac >> 3;
|
||||
if (j < (sizeof(facs)/sizeof(facs[0]))) {
|
||||
if (j < nitems(facs)) {
|
||||
if (facs[j].value == fac)
|
||||
return (facs[j].name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user