Print this page
10075 make usr/src/tools smatch clean

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/findunref/findunref.c
          +++ new/usr/src/tools/findunref/findunref.c
↓ open down ↓ 15 lines elided ↑ open up ↑
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   *
  21   21   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  22   22   * Use is subject to license terms.
  23   23   */
  24   24  
  25   25  /*
       26 + * Copyright (c) 2018, Joyent, Inc.
       27 + */
       28 +
       29 +/*
  26   30   * Finds all unreferenced files in a source tree that do not match a list of
  27   31   * permitted pathnames.
  28   32   */
  29   33  
  30   34  #include <ctype.h>
  31   35  #include <errno.h>
  32   36  #include <fnmatch.h>
  33   37  #include <ftw.h>
  34   38  #include <stdarg.h>
  35   39  #include <stdio.h>
↓ open down ↓ 157 lines elided ↑ open up ↑
 193  197   */
 194  198  static pnset_t *
 195  199  hg_manifest(const char *hgroot)
 196  200  {
 197  201          FILE    *fp = NULL;
 198  202          char    *hgcmd = NULL;
 199  203          char    *newline;
 200  204          pnset_t *pnsetp;
 201  205          char    path[MAXPATHLEN];
 202  206  
 203      -        pnsetp = calloc(sizeof (pnset_t), 1);
      207 +        pnsetp = calloc(1, sizeof (pnset_t));
 204  208          if (pnsetp == NULL ||
 205  209              asprintf(&hgcmd, "hg manifest -R %s", hgroot) == -1)
 206  210                  goto fail;
 207  211  
 208  212          fp = popen(hgcmd, "r");
 209  213          if (fp == NULL)
 210  214                  goto fail;
 211  215  
 212  216          while (fgets(path, sizeof (path), fp) != NULL) {
 213  217                  newline = strrchr(path, '\n');
↓ open down ↓ 21 lines elided ↑ open up ↑
 235  239   */
 236  240  static pnset_t *
 237  241  git_manifest(const char *gitroot)
 238  242  {
 239  243          FILE    *fp = NULL;
 240  244          char    *gitcmd = NULL;
 241  245          char    *newline;
 242  246          pnset_t *pnsetp;
 243  247          char    path[MAXPATHLEN];
 244  248  
 245      -        pnsetp = calloc(sizeof (pnset_t), 1);
      249 +        pnsetp = calloc(1, sizeof (pnset_t));
 246  250          if (pnsetp == NULL ||
 247  251              asprintf(&gitcmd, "git --git-dir=%s/.git ls-files", gitroot) == -1)
 248  252                  goto fail;
 249  253  
 250  254          fp = popen(gitcmd, "r");
 251  255          if (fp == NULL)
 252  256                  goto fail;
 253  257  
 254  258          while (fgets(path, sizeof (path), fp) != NULL) {
 255  259                  newline = strrchr(path, '\n');
↓ open down ↓ 137 lines elided ↑ open up ↑
 393  397   */
 394  398  static pnset_t *
 395  399  make_exset(const char *exceptfile)
 396  400  {
 397  401          FILE            *fp;
 398  402          char            line[MAXPATHLEN];
 399  403          char            *newline;
 400  404          pnset_t         *pnsetp;
 401  405          unsigned int    i;
 402  406  
 403      -        pnsetp = calloc(sizeof (pnset_t), 1);
      407 +        pnsetp = calloc(1, sizeof (pnset_t));
 404  408          if (pnsetp == NULL)
 405  409                  return (NULL);
 406  410  
 407  411          /*
 408  412           * Add any exceptions from the file.
 409  413           */
 410  414          fp = fopen(exceptfile, "r");
 411  415          if (fp == NULL) {
 412  416                  warn("cannot open exception file \"%s\"", exceptfile);
 413  417                  goto fail;
↓ open down ↓ 188 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX