Author: araujo
Date: Fri Oct 21 03:10:05 2016
New Revision: 307697
URL: https://svnweb.freebsd.org/changeset/base/307697

Log:
  MFC r303541, r303542, r303543, r303545, r303546, r303547, r304225, r304226, 
r304605, r304676, r305212, r305863:
  
  r303541:
  Use nitems() from sys/param.h.
  
  Sponsored by: gandi.net (BSD Day Taiwan)
  MFC after:    2 weeks.
  
  r303542:
  Use nitems() from sys/param.h.
  
  MFC after:    2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r303543:
  Use nitems() from sys/param.h.
  
  MFC after:    2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r303545:
  Use nitems() from sys/param.h.
  
  MFC after:    2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r303546:
  Use nitems() from sys/param.h.
  
  MFC after:    2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r303547:
  Use nitems() from sys/param.h.
  
  MFC after:    2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r304225:
  Use nitems() from sys/param.h.
  
  MFC after:    2 weeks.
  
  r304226:
  Use nitems() from sys/param.h.
  
  MFC after:    2 weeks.
  
  r304605:
  Fix calloc(3) argument order.
  
  Reviewed by:  trasz
  MFC after:    4 weeks.
  Differential Revision:        https://reviews.freebsd.org/D7532
  
  r304676:
  Fix calloc(3) argument order.
  
  MFC after:    4 weeks.
  
  r305212:
  - Invert calloc(3) argument order.
  
  MFC after:    4 weeks
  
  r305863:
  Invert calloc(3) argument order.
  
  Reviewed by:  ed.
  MFC after:    4 weeks.
  Differential Revision:        https://reviews.freebsd.org/D7902

Modified:
  stable/11/sbin/natd/natd.c
  stable/11/usr.bin/calendar/io.c
  stable/11/usr.bin/gzip/gzip.c
  stable/11/usr.bin/indent/indent.c
  stable/11/usr.bin/locale/locale.c
  stable/11/usr.bin/localedef/collate.c
  stable/11/usr.bin/netstat/pfkey.c
  stable/11/usr.bin/procstat/procstat_files.c
  stable/11/usr.bin/rpcgen/rpc_main.c
  stable/11/usr.bin/systat/main.c
  stable/11/usr.sbin/ctld/chap.c
  stable/11/usr.sbin/ctld/keys.c
  stable/11/usr.sbin/ctld/pdu.c
  stable/11/usr.sbin/fifolog/lib/fifolog_int.c
  stable/11/usr.sbin/fifolog/lib/fifolog_reader.c
  stable/11/usr.sbin/iscsid/chap.c
  stable/11/usr.sbin/iscsid/keys.c
  stable/11/usr.sbin/iscsid/pdu.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/natd/natd.c
==============================================================================
--- stable/11/sbin/natd/natd.c  Fri Oct 21 02:16:11 2016        (r307696)
+++ stable/11/sbin/natd/natd.c  Fri Oct 21 03:10:05 2016        (r307697)
@@ -2006,7 +2006,7 @@ NewInstance(const char *name)
                }
        }
        ninstance++;
-       ip = calloc(sizeof *ip, 1);
+       ip = calloc(1, sizeof(*ip));
        ip->name = strdup(name);
        ip->la = LibAliasInit (ip->la);
        ip->assignAliasAddr     = 0;

Modified: stable/11/usr.bin/calendar/io.c
==============================================================================
--- stable/11/usr.bin/calendar/io.c     Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/calendar/io.c     Fri Oct 21 03:10:05 2016        
(r307697)
@@ -118,7 +118,7 @@ cal_fopen(const char *file)
                return (NULL);
        }
 
-       for (i = 0; i < sizeof(calendarHomes)/sizeof(calendarHomes[0]) ; i++) {
+       for (i = 0; i < nitems(calendarHomes); i++) {
                if (chdir(calendarHomes[i]) != 0)
                        continue;
 

Modified: stable/11/usr.bin/gzip/gzip.c
==============================================================================
--- stable/11/usr.bin/gzip/gzip.c       Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/gzip/gzip.c       Fri Oct 21 03:10:05 2016        
(r307697)
@@ -155,7 +155,7 @@ static suffixes_t suffixes[] = {
 #endif /* SMALL */
 #undef SUFFIX
 };
-#define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
+#define NUM_SUFFIXES (nitems(suffixes))
 #define SUFFIX_MAXLEN  30
 
 static const char      gzip_version[] = "FreeBSD gzip 20150413";

Modified: stable/11/usr.bin/indent/indent.c
==============================================================================
--- stable/11/usr.bin/indent/indent.c   Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/indent/indent.c   Fri Oct 21 03:10:05 2016        
(r307697)
@@ -1133,7 +1133,7 @@ check_type:
                    while ((c = getc(input)) == '\n');
                    ungetc(c, input);
                }
-               if ((size_t)ifdef_level < 
sizeof(state_stack)/sizeof(state_stack[0])) {
+               if ((size_t)ifdef_level < nitems(state_stack)) {
                    match_state[ifdef_level].tos = -1;
                    state_stack[ifdef_level++] = ps;
                }

Modified: stable/11/usr.bin/locale/locale.c
==============================================================================
--- stable/11/usr.bin/locale/locale.c   Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/locale/locale.c   Fri Oct 21 03:10:05 2016        
(r307697)
@@ -220,10 +220,10 @@ struct _kwinfo {
          "(POSIX legacy)" }                                    /* compat */
 
 };
-#define        NKWINFO (sizeof(kwinfo)/sizeof(kwinfo[0]))
+#define        NKWINFO (nitems(kwinfo))
 
 const char *boguslocales[] = { "UTF-8" };
-#define        NBOGUS  (sizeof(boguslocales)/sizeof(boguslocales[0]))
+#define        NBOGUS  (nitems(boguslocales))
 
 int
 main(int argc, char *argv[])

Modified: stable/11/usr.bin/localedef/collate.c
==============================================================================
--- stable/11/usr.bin/localedef/collate.c       Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/localedef/collate.c       Fri Oct 21 03:10:05 2016        
(r307697)
@@ -490,7 +490,7 @@ define_collsym(char *name)
 {
        collsym_t       *sym;
 
-       if ((sym = calloc(sizeof (*sym), 1)) == NULL) {
+       if ((sym = calloc(1, sizeof(*sym))) == NULL) {
                fprintf(stderr,"out of memory");
                return;
        }
@@ -536,7 +536,7 @@ get_collundef(char *name)
 
        srch.name = name;
        if ((ud = RB_FIND(collundefs, &collundefs, &srch)) == NULL) {
-               if (((ud = calloc(sizeof (*ud), 1)) == NULL) ||
+               if (((ud = calloc(1, sizeof(*ud))) == NULL) ||
                    ((ud->name = strdup(name)) == NULL)) {
                        fprintf(stderr,"out of memory");
                        free(ud);
@@ -561,7 +561,7 @@ get_collchar(wchar_t wc, int create)
        srch.wc = wc;
        cc = RB_FIND(collchars, &collchars, &srch);
        if ((cc == NULL) && create) {
-               if ((cc = calloc(sizeof (*cc), 1)) == NULL) {
+               if ((cc = calloc(1, sizeof(*cc))) == NULL) {
                        fprintf(stderr, "out of memory");
                        return (NULL);
                }
@@ -793,7 +793,7 @@ define_collelem(char *name, wchar_t *wcs
                return;
        }
 
-       if ((e = calloc(sizeof (*e), 1)) == NULL) {
+       if ((e = calloc(1, sizeof(*e))) == NULL) {
                fprintf(stderr, "out of memory");
                return;
        }
@@ -927,7 +927,7 @@ add_order_subst(void)
        s = RB_FIND(substs_ref, &substs_ref[curr_weight], &srch);
 
        if (s == NULL) {
-               if ((s = calloc(sizeof (*s), 1)) == NULL) {
+               if ((s = calloc(1, sizeof(*s))) == NULL) {
                        fprintf(stderr,"out of memory");
                        return;
                }
@@ -1035,7 +1035,7 @@ add_weight(int32_t ref, int pass)
        if (RB_FIND(weights, &weights[pass], &srch) != NULL)
                return;
 
-       if ((w = calloc(sizeof (*w), 1)) == NULL) {
+       if ((w = calloc(1, sizeof(*w))) == NULL) {
                fprintf(stderr, "out of memory");
                return;
        }

Modified: stable/11/usr.bin/netstat/pfkey.c
==============================================================================
--- stable/11/usr.bin/netstat/pfkey.c   Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/netstat/pfkey.c   Fri Oct 21 03:10:05 2016        
(r307697)
@@ -101,8 +101,7 @@ static const char *pfkey_msgtype_names (
 static const char *
 pfkey_msgtype_names(int x)
 {
-       const int max =
-           sizeof(pfkey_msgtypenames)/sizeof(pfkey_msgtypenames[0]);
+       const int max = nitems(pfkey_msgtypenames);
        static char buf[20];
 
        if (x < max && pfkey_msgtypenames[x])

Modified: stable/11/usr.bin/procstat/procstat_files.c
==============================================================================
--- stable/11/usr.bin/procstat/procstat_files.c Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/procstat/procstat_files.c Fri Oct 21 03:10:05 2016        
(r307697)
@@ -235,8 +235,7 @@ static struct cap_desc {
        { CAP_SOCK_CLIENT,      "scl" },
        { CAP_SOCK_SERVER,      "ssr" },
 };
-static const u_int     cap_desc_count = sizeof(cap_desc) /
-                           sizeof(cap_desc[0]);
+static const u_int     cap_desc_count = nitems(cap_desc);
 
 static u_int
 width_capability(cap_rights_t *rightsp)

Modified: stable/11/usr.bin/rpcgen/rpc_main.c
==============================================================================
--- stable/11/usr.bin/rpcgen/rpc_main.c Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/rpcgen/rpc_main.c Fri Oct 21 03:10:05 2016        
(r307697)
@@ -82,11 +82,11 @@ static char pathbuf[MAXPATHLEN + 1];
 static const char *allv[] = {
        "rpcgen", "-s", "udp", "-s", "tcp",
 };
-static int allc = sizeof (allv)/sizeof (allv[0]);
+static int allc = nitems(allv);
 static const char *allnv[] = {
        "rpcgen", "-s", "netpath",
 };
-static int allnc = sizeof (allnv)/sizeof (allnv[0]);
+static int allnc = nitems(allnv);
 
 /*
  * machinations for handling expanding argument list

Modified: stable/11/usr.bin/systat/main.c
==============================================================================
--- stable/11/usr.bin/systat/main.c     Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.bin/systat/main.c     Fri Oct 21 03:10:05 2016        
(r307697)
@@ -261,7 +261,7 @@ display(void)
        int i, j;
 
        /* Get the load average over the last minute. */
-       (void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0]));
+       (void) getloadavg(avenrun, nitems(avenrun));
        (*curcmd->c_fetch)();
        if (curcmd->c_flags & CF_LOADAV) {
                j = 5.0*avenrun[0] + 0.5;
@@ -293,7 +293,7 @@ display(void)
                    GETSYSCTL("kstat.zfs.misc.arcstats.l2_hdr_size", arc[5]);
                    GETSYSCTL("kstat.zfs.misc.arcstats.other_size", arc[6]);
                    wmove(wload, 0, 0); wclrtoeol(wload);
-                   for (i = 0 ; i < sizeof(arc) / sizeof(arc[0]) ; i++) {
+                   for (i = 0 ; i < nitems(arc); i++) {
                        if (arc[i] > 10llu * 1024 * 1024 * 1024 ) {
                                wprintw(wload, "%7lluG", arc[i] >> 30);
                        }
@@ -318,7 +318,7 @@ void
 load(void)
 {
 
-       (void) getloadavg(avenrun, sizeof(avenrun)/sizeof(avenrun[0]));
+       (void) getloadavg(avenrun, nitems(avenrun));
        mvprintw(CMDLINE, 0, "%4.1f %4.1f %4.1f",
            avenrun[0], avenrun[1], avenrun[2]);
        clrtoeol();

Modified: stable/11/usr.sbin/ctld/chap.c
==============================================================================
--- stable/11/usr.sbin/ctld/chap.c      Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.sbin/ctld/chap.c      Fri Oct 21 03:10:05 2016        
(r307697)
@@ -232,7 +232,7 @@ chap_new(void)
 {
        struct chap *chap;
 
-       chap = calloc(sizeof(*chap), 1);
+       chap = calloc(1, sizeof(*chap));
        if (chap == NULL)
                log_err(1, "calloc");
 
@@ -333,7 +333,7 @@ rchap_new(const char *secret)
 {
        struct rchap *rchap;
 
-       rchap = calloc(sizeof(*rchap), 1);
+       rchap = calloc(1, sizeof(*rchap));
        if (rchap == NULL)
                log_err(1, "calloc");
 

Modified: stable/11/usr.sbin/ctld/keys.c
==============================================================================
--- stable/11/usr.sbin/ctld/keys.c      Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.sbin/ctld/keys.c      Fri Oct 21 03:10:05 2016        
(r307697)
@@ -43,7 +43,7 @@ keys_new(void)
 {
        struct keys *keys;
 
-       keys = calloc(sizeof(*keys), 1);
+       keys = calloc(1, sizeof(*keys));
        if (keys == NULL)
                log_err(1, "calloc");
 

Modified: stable/11/usr.sbin/ctld/pdu.c
==============================================================================
--- stable/11/usr.sbin/ctld/pdu.c       Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.sbin/ctld/pdu.c       Fri Oct 21 03:10:05 2016        
(r307697)
@@ -81,11 +81,11 @@ pdu_new(struct connection *conn)
 {
        struct pdu *pdu;
 
-       pdu = calloc(sizeof(*pdu), 1);
+       pdu = calloc(1, sizeof(*pdu));
        if (pdu == NULL)
                log_err(1, "calloc");
 
-       pdu->pdu_bhs = calloc(sizeof(*pdu->pdu_bhs), 1);
+       pdu->pdu_bhs = calloc(1, sizeof(*pdu->pdu_bhs));
        if (pdu->pdu_bhs == NULL)
                log_err(1, "calloc");
 

Modified: stable/11/usr.sbin/fifolog/lib/fifolog_int.c
==============================================================================
--- stable/11/usr.sbin/fifolog/lib/fifolog_int.c        Fri Oct 21 02:16:11 
2016        (r307696)
+++ stable/11/usr.sbin/fifolog/lib/fifolog_int.c        Fri Oct 21 03:10:05 
2016        (r307697)
@@ -125,7 +125,7 @@ fifolog_int_open_i(struct fifolog_file *
 
        /* Initialize zlib handling */
 
-       f->zs = calloc(sizeof *f->zs, 1);
+       f->zs = calloc(1, sizeof(*f->zs));
        if (f->zs == NULL)
                return ("cannot malloc");
 

Modified: stable/11/usr.sbin/fifolog/lib/fifolog_reader.c
==============================================================================
--- stable/11/usr.sbin/fifolog/lib/fifolog_reader.c     Fri Oct 21 02:16:11 
2016        (r307696)
+++ stable/11/usr.sbin/fifolog/lib/fifolog_reader.c     Fri Oct 21 03:10:05 
2016        (r307697)
@@ -59,7 +59,7 @@ fifolog_reader_open(const char *fname)
        struct fifolog_reader *fr;
        int i;
 
-       fr = calloc(sizeof *fr, 1);
+       fr = calloc(1, sizeof(*fr));
        if (fr == NULL)
                err(1, "Cannot malloc");
 

Modified: stable/11/usr.sbin/iscsid/chap.c
==============================================================================
--- stable/11/usr.sbin/iscsid/chap.c    Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.sbin/iscsid/chap.c    Fri Oct 21 03:10:05 2016        
(r307697)
@@ -232,7 +232,7 @@ chap_new(void)
 {
        struct chap *chap;
 
-       chap = calloc(sizeof(*chap), 1);
+       chap = calloc(1, sizeof(*chap));
        if (chap == NULL)
                log_err(1, "calloc");
 
@@ -333,7 +333,7 @@ rchap_new(const char *secret)
 {
        struct rchap *rchap;
 
-       rchap = calloc(sizeof(*rchap), 1);
+       rchap = calloc(1, sizeof(*rchap));
        if (rchap == NULL)
                log_err(1, "calloc");
 

Modified: stable/11/usr.sbin/iscsid/keys.c
==============================================================================
--- stable/11/usr.sbin/iscsid/keys.c    Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.sbin/iscsid/keys.c    Fri Oct 21 03:10:05 2016        
(r307697)
@@ -43,7 +43,7 @@ keys_new(void)
 {
        struct keys *keys;
 
-       keys = calloc(sizeof(*keys), 1);
+       keys = calloc(1, sizeof(*keys));
        if (keys == NULL)
                log_err(1, "calloc");
 

Modified: stable/11/usr.sbin/iscsid/pdu.c
==============================================================================
--- stable/11/usr.sbin/iscsid/pdu.c     Fri Oct 21 02:16:11 2016        
(r307696)
+++ stable/11/usr.sbin/iscsid/pdu.c     Fri Oct 21 03:10:05 2016        
(r307697)
@@ -81,11 +81,11 @@ pdu_new(struct connection *conn)
 {
        struct pdu *pdu;
 
-       pdu = calloc(sizeof(*pdu), 1);
+       pdu = calloc(1, sizeof(*pdu));
        if (pdu == NULL)
                log_err(1, "calloc");
 
-       pdu->pdu_bhs = calloc(sizeof(*pdu->pdu_bhs), 1);
+       pdu->pdu_bhs = calloc(1, sizeof(*pdu->pdu_bhs));
        if (pdu->pdu_bhs == NULL)
                log_err(1, "calloc");
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to